explicitly fix the PATH to something sensible
authorespie <espie@openbsd.org>
Mon, 30 Dec 2013 09:01:30 +0000 (09:01 +0000)
committerespie <espie@openbsd.org>
Mon, 30 Dec 2013 09:01:30 +0000 (09:01 +0000)
move "replacing" to a method, so that it can be more specific later.

usr.sbin/pkg_add/OpenBSD/AddDelete.pm

index 8022e55..6ab0cdd 100644 (file)
@@ -1,5 +1,5 @@
 # ex:ts=8 sw=4:
-# $OpenBSD: AddDelete.pm,v 1.58 2013/12/25 15:59:51 espie Exp $
+# $OpenBSD: AddDelete.pm,v 1.59 2013/12/30 09:01:30 espie Exp $
 #
 # Copyright (c) 2007-2010 Marc Espie <espie@openbsd.org>
 #
@@ -182,6 +182,15 @@ sub handle_options
                $state->{interactive} = -t STDIN;
        }
        $state->{localbase} = $state->opt('L') // OpenBSD::Paths->localbase;
+       $ENV{PATH} = join(':',
+           '/bin',
+           '/sbin',
+           '/usr/bin',
+           '/usr/sbin',
+           '/usr/X11R6/bin',
+           "$state->{localbase}/bin",
+           "$state->{localbase}/sbin");
+
        $state->{size_only} = $state->opt('s');
        $state->{quick} = $state->opt('q') || $state->config->istrue("nochecksum");
        $state->{extra} = $state->opt('c');
@@ -386,6 +395,12 @@ sub status
        return $self->{status};
 }
 
+sub replacing
+{
+       my $self = shift;
+       return $self->{replacing};
+}
+
 OpenBSD::Auto::cache(ldconfig,
     sub {
        my $self = shift;