summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Add.pm25
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Delete.pm13
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageInfo.pm5
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository.pm12
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm6
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageRepository/Source.pm7
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingElement.pm20
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Paths.pm8
-rw-r--r--usr.sbin/pkg_add/OpenBSD/SharedItems.pm21
-rw-r--r--usr.sbin/pkg_add/OpenBSD/SharedLibs.pm9
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Temp.pm5
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Ustar.pm7
-rw-r--r--usr.sbin/pkg_add/OpenBSD/Vstat.pm7
-rw-r--r--usr.sbin/pkg_add/pkg_add5
-rw-r--r--usr.sbin/pkg_add/pkg_create5
-rw-r--r--usr.sbin/pkg_add/pkg_delete5
-rw-r--r--usr.sbin/pkg_add/pkg_merge3
-rw-r--r--usr.sbin/pkg_add/pkg_mklocatedb8
18 files changed, 103 insertions, 68 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm
index a2885f3e54b..79572f0e029 100644
--- a/usr.sbin/pkg_add/OpenBSD/Add.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Add.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Add.pm,v 1.77 2007/06/12 09:53:36 espie Exp $
+# $OpenBSD: Add.pm,v 1.78 2007/06/16 09:29:37 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -21,6 +21,7 @@ package OpenBSD::Add;
use OpenBSD::Error;
use OpenBSD::PackageInfo;
use OpenBSD::ArcCheck;
+use OpenBSD::Paths;
use File::Copy;
sub manpages_index
@@ -215,7 +216,7 @@ sub set_modes
if ($v =~ m/^\d+$/o) {
chmod oct($v), $name;
} else {
- System('chmod', $self->{mode}, $name);
+ System(OpenBSD::Paths->chmod, $self->{mode}, $name);
}
}
}
@@ -286,7 +287,7 @@ sub install
package OpenBSD::PackingElement::NewUser;
-sub command { '/usr/sbin/useradd' }
+sub command { OpenBSD::Paths->useradd }
sub build_args
{
@@ -303,7 +304,7 @@ sub build_args
package OpenBSD::PackingElement::NewGroup;
-sub command { '/usr/sbin/groupadd' }
+sub command { OpenBSD::Paths->groupadd }
sub build_args
{
@@ -321,7 +322,7 @@ sub install
my $name = $self->{name};
$self->SUPER::install($state);
- open(my $pipe, '-|', '/sbin/sysctl', '-n', $name);
+ open(my $pipe, '-|', OpenBSD::Paths->sysctl, '-n', $name);
my $actual = <$pipe>;
chomp $actual;
if ($self->{mode} eq '=' && $actual eq $self->{value}) {
@@ -335,7 +336,9 @@ sub install
$self->{value}, "\n";
return;
}
- VSystem($state->{very_verbose}, '/sbin/sysctl', $name.'='.$self->{value});
+ VSystem($state->{very_verbose},
+ OpenBSD::Paths->sysctl,
+ $name.'='.$self->{value});
}
package OpenBSD::PackingElement::FileBase;
@@ -561,7 +564,8 @@ sub install
return if $state->{not};
my $fullname = $state->{destdir}.$self->fullname;
VSystem($state->{very_verbose},
- "install-info", "--info-dir=".dirname($fullname), $fullname);
+ OpenBSD::Paths->install_info,
+ "--info-dir=".dirname($fullname), $fullname);
}
package OpenBSD::PackingElement::Shell;
@@ -573,17 +577,18 @@ sub install
my $fullname = $self->fullname;
my $destdir = $state->{destdir};
# go append to /etc/shells if needed
- open(my $shells, '<', $destdir.'/etc/shells') or return;
+ open(my $shells, '<', $destdir.OpenBSD::Paths->shells) or return;
local $_;
while(<$shells>) {
s/^\#.*//o;
return if $_ =~ m/^\Q$fullname\E\s*$/;
}
close($shells);
- open(my $shells2, '>>', $destdir.'/etc/shells') or return;
+ open(my $shells2, '>>', $destdir.OpenBSD::Paths->shells) or return;
print $shells2 $fullname, "\n";
close $shells2;
- print "Shell $fullname appended to $destdir/etc/shells\n";
+ print "Shell $fullname appended to $destdir",
+ OpenBSD::Paths->shells, "\n";
}
package OpenBSD::PackingElement::Dir;
diff --git a/usr.sbin/pkg_add/OpenBSD/Delete.pm b/usr.sbin/pkg_add/OpenBSD/Delete.pm
index 940df2f95f4..e8f77a8c5f0 100644
--- a/usr.sbin/pkg_add/OpenBSD/Delete.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Delete.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Delete.pm,v 1.66 2007/06/14 09:29:32 espie Exp $
+# $OpenBSD: Delete.pm,v 1.67 2007/06/16 09:29:37 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -22,6 +22,7 @@ use OpenBSD::Error;
use OpenBSD::Vstat;
use OpenBSD::PackageInfo;
use OpenBSD::RequiredBy;
+use OpenBSD::Paths;
use File::Basename;
sub rename_file_to_temp
@@ -518,7 +519,8 @@ sub delete
unless ($state->{not}) {
my $fullname = $state->{destdir}.$self->fullname;
VSystem($state->{very_verbose},
- "install-info", "--delete", "--info-dir=".dirname($fullname), $fullname);
+ OpenBSD::Paths->install_info,
+ "--delete", "--info-dir=".dirname($fullname), $fullname);
}
$self->SUPER::delete($state);
}
@@ -531,7 +533,7 @@ sub delete
my $destdir = $state->{destdir};
my $fullname = $self->fullname;
my @l=();
- if (open(my $shells, '<', $destdir.'/etc/shells')) {
+ if (open(my $shells, '<', $destdir.OpenBSD::Paths->shells)) {
local $_;
while(<$shells>) {
push(@l, $_);
@@ -541,10 +543,11 @@ sub delete
}
}
close($shells);
- open(my $shells2, '>', $destdir.'/etc/shells');
+ open(my $shells2, '>', $destdir.OpenBSD::Paths->shells);
print $shells2 @l;
close $shells2;
- print "Shell $fullname removed from $destdir/etc/shells\n";
+ print "Shell $fullname removed from $destdir",
+ OpenBSD::Paths->shells, "\n";
}
}
$self->SUPER::delete($state);
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm
index 371b6d7d0a5..7d0e1712177 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageInfo.pm,v 1.34 2007/06/09 11:16:54 espie Exp $
+# $OpenBSD: PackageInfo.pm,v 1.35 2007/06/16 09:29:37 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -25,6 +25,7 @@ our @EXPORT=qw(installed_packages installed_info installed_name info_names is_in
REQUIRED_BY REQUIRING DISPLAY UNDISPLAY MTREE_DIRS);
use OpenBSD::PackageName;
+use OpenBSD::Paths;
use constant {
CONTENTS => '+CONTENTS',
COMMENT => '+COMMENT',
@@ -39,7 +40,7 @@ use constant {
MTREE_DIRS => '+MTREE_DIRS' };
use Fcntl qw/:flock/;
-my $pkg_db = $ENV{"PKG_DBDIR"} || '/var/db/pkg';
+my $pkg_db = $ENV{"PKG_DBDIR"} || OpenBSD::Paths->pkgdb;
my ($list, $stemlist);
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
index 9aea21681a2..979bc5ddc2b 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackageRepository.pm,v 1.45 2007/06/12 09:53:36 espie Exp $
+# $OpenBSD: PackageRepository.pm,v 1.46 2007/06/16 09:29:37 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -28,6 +28,7 @@ package OpenBSD::PackageRepository;
our @ISA=(qw(OpenBSD::PackageRepositoryBase));
use OpenBSD::PackageLocation;
+use OpenBSD::Paths;
sub _new
{
@@ -214,7 +215,7 @@ sub open_pipe
return $fh;
} else {
open STDERR, ">/dev/null";
- exec {"/usr/bin/gzip"}
+ exec {OpenBSD::Paths->gzip}
"gzip",
"-d",
"-c",
@@ -275,7 +276,7 @@ sub open_pipe
return $fh;
} else {
open STDERR, ">/dev/null";
- exec {"/usr/bin/gzip"}
+ exec {OpenBSD::Paths->gzip}
"gzip",
"-d",
"-c",
@@ -372,7 +373,7 @@ sub open_pipe
open(STDIN, '<&', $rdfh) or die "Bad dup";
close($rdfh);
close($wrfh);
- exec {"/usr/bin/gzip"}
+ exec {OpenBSD::Paths->gzip}
"gzip",
"-d",
"-c",
@@ -432,8 +433,7 @@ our %distant = ();
sub grab_object
{
my ($self, $object) = @_;
- my $ftp = defined $ENV{'FETCH_CMD'} ? $ENV{'FETCH_CMD'} : "/usr/bin/ftp";
- exec {$ftp}
+ exec {OpenBSD::Paths->ftp}
"ftp",
"-o",
"-", $self->url($object->{name})
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm
index 1a118221eb0..a20715856d8 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/SCP.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: SCP.pm,v 1.15 2007/06/04 18:52:02 espie Exp $
+# $OpenBSD: SCP.pm,v 1.16 2007/06/16 09:29:37 espie Exp $
#
# Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org>
#
@@ -23,6 +23,7 @@ our @ISA=qw(OpenBSD::PackageRepository::Distant);
use IPC::Open2;
use IO::Handle;
+use OpenBSD::Paths;
sub urlscheme
{
@@ -39,7 +40,8 @@ sub initiate
my ($rdfh, $wrfh);
- $self->{controller} = open2($rdfh, $wrfh, 'ssh', $self->{host}, 'perl', '-x');
+ $self->{controller} = open2($rdfh, $wrfh, OpenBSD::Paths->ssh,
+ $self->{host}, 'perl', '-x');
$self->{cmdfh} = $wrfh;
$self->{getfh} = $rdfh;
$wrfh->autoflush(1);
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Source.pm b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Source.pm
index 975294d67a3..732f2a0b7d3 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackageRepository/Source.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackageRepository/Source.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Source.pm,v 1.5 2007/06/04 14:40:39 espie Exp $
+# $OpenBSD: Source.pm,v 1.6 2007/06/16 09:29:37 espie Exp $
#
# Copyright (c) 2003-2006 Marc Espie <espie@openbsd.org>
#
@@ -21,6 +21,7 @@ use warnings;
package OpenBSD::PackageRepository::Source;
our @ISA=(qw(OpenBSD::PackageRepository));
use OpenBSD::PackageInfo;
+use OpenBSD::Paths;
sub urlscheme
{
@@ -42,14 +43,14 @@ sub build_package
if (defined $ENV{'MAKE'}) {
$make = $ENV{'MAKE'};
} else {
- $make = '/usr/bin/make';
+ $make = OpenBSD::Paths->make;
}
if (defined $self->{baseurl} && $self->{baseurl} ne '') {
$dir = $self->{baseurl}
} elsif (defined $ENV{PORTSDIR}) {
$dir = $ENV{PORTSDIR};
} else {
- $dir = '/usr/ports';
+ $dir = OpenBSD::Paths->portsdir;
}
# figure out the repository name and the pkgname
my $pkgfile = `cd $dir && SUBDIR=$pkgpath ECHO_MSG=: $make show=PKGFILE`;
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
index 37f672e6882..b97ded0a837 100644
--- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
+++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: PackingElement.pm,v 1.135 2007/06/14 09:11:49 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.136 2007/06/16 09:29:37 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -18,6 +18,7 @@
use strict;
use warnings;
use OpenBSD::PackageInfo;
+use OpenBSD::Paths;
# perl ipc
require 5.008_000;
@@ -471,8 +472,8 @@ sub format
}
open my $oldout, '>&STDOUT';
open STDOUT, '>', "$base/$out" or die "Can't write to $base/$out";
- system('groff', '-Tascii', '-mandoc', '-Wall', '-mtty-char',
- @extra, $fname);
+ system(OpenBSD::Paths->groff,
+ '-Tascii', '-mandoc', '-Wall', '-mtty-char', @extra, $fname);
open STDOUT, '>&', $oldout;
}
@@ -1021,7 +1022,8 @@ sub run
OpenBSD::PackingElement::Lib::ensure_ldconfig($state);
print $self->keyword, " ", $self->{expanded}, "\n" if $state->{beverbose};
- $state->system('/bin/sh', '-c', $self->{expanded}) unless $state->{not};
+ $state->system(OpenBSD::Paths->sh, '-c', $self->{expanded})
+ unless $state->{not};
}
package OpenBSD::PackingElement::Exec;
@@ -1149,11 +1151,11 @@ sub finish_fontdirs
map { update_fontalias($_) } @l unless $state->{not};
print "You may wish to update your font path for ", join(' ', @l), "\n";
return if $state->{not};
- run_if_exists($state, "/usr/X11R6/bin/mkfontdir", @l);
+ run_if_exists($state, OpenBSD::Paths->mkfontdir, @l);
map { restore_fontdir($_) } @l;
- run_if_exists($state, "/usr/X11R6/bin/fc-cache", @l);
+ run_if_exists($state, OpenBSD::Paths->fc_cache, @l);
}
}
@@ -1377,11 +1379,13 @@ sub check
}
}
if (!defined $machine_arch) {
- chomp($machine_arch = `/usr/bin/arch -s`);
+ my $cmd = OpenBSD::Paths->arch." -s";
+ chomp($machine_arch = `$cmd`);
}
return 1 if $ok eq $machine_arch;
if (!defined $arch) {
- chomp($arch = `/usr/bin/uname -m`);
+ my $cmd = OpenBSD::Paths->uname." -m";
+ chomp($arch = `$cmd`);
}
return 1 if $ok eq $arch;
}
diff --git a/usr.sbin/pkg_add/OpenBSD/Paths.pm b/usr.sbin/pkg_add/OpenBSD/Paths.pm
index e4d43e2aca2..b2ebd79fd64 100644
--- a/usr.sbin/pkg_add/OpenBSD/Paths.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Paths.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Paths.pm,v 1.2 2007/06/12 09:57:50 espie Exp $
+# $OpenBSD: Paths.pm,v 1.3 2007/06/16 09:29:37 espie Exp $
#
# Copyright (c) 2007 Marc Espie <espie@openbsd.org>
#
@@ -22,6 +22,7 @@ package OpenBSD::Paths;
# Commands
sub ldconfig() { '/sbin/ldconfig' }
+sub chroot() { '/usr/sbin/chroot' }
sub mkfontdir() { '/usr/X11R6/bin/mkfontdir' }
sub fc_cache() { '/usr/X11R6/bin/fc-cache' }
sub install_info() { '/usr/bin/install-info' }
@@ -29,7 +30,7 @@ sub useradd() { '/usr/sbin/useradd' }
sub groupadd() { '/usr/sbin/groupadd' }
sub sysctl() { '/sbin/sysctl' }
sub openssl() { '/usr/sbin/openssl' }
-sub chmod() { '/bin/chmod' }
+sub chmod() { '/bin/chmod' } # external command is used for symbolic modes.
sub gzip() { '/usr/bin/gzip' }
sub ftp() { $ENV{'FETCH_CMD'} || '/usr/bin/ftp' }
sub groff() { '/usr/bin/groff' }
@@ -41,7 +42,7 @@ sub groupdel() { '/usr/sbin/groupdel' }
sub mknod() { '/sbin/mknod' }
sub mount() { '/sbin/mount' }
sub df() { '/bin/df' }
-sub ssh() { '/us/bin/ssh' }
+sub ssh() { '/usr/bin/ssh' }
sub make() { '/usr/bin/make' }
sub mklocatedb() { '/usr/libexec/locate.mklocatedb' }
@@ -57,5 +58,6 @@ sub master_keys() { ("/etc/master_key") }
sub font_cruft() { ("fonts.alias", "fonts.dir", "fonts.cache-1") }
sub man_cruft() { ("whatis.db") }
+sub info_cruft() { ("dir") }
1;
diff --git a/usr.sbin/pkg_add/OpenBSD/SharedItems.pm b/usr.sbin/pkg_add/OpenBSD/SharedItems.pm
index d722b7f62c4..960defa5c6e 100644
--- a/usr.sbin/pkg_add/OpenBSD/SharedItems.pm
+++ b/usr.sbin/pkg_add/OpenBSD/SharedItems.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: SharedItems.pm,v 1.11 2007/06/01 14:58:29 espie Exp $
+# $OpenBSD: SharedItems.pm,v 1.12 2007/06/16 09:29:37 espie Exp $
#
# Copyright (c) 2004-2006 Marc Espie <espie@openbsd.org>
#
@@ -22,6 +22,7 @@ package OpenBSD::SharedItems;
use OpenBSD::Error;
use OpenBSD::PackageInfo;
use OpenBSD::PackingList;
+use OpenBSD::Paths;
sub find_items_in_installed_packages
{
@@ -85,7 +86,7 @@ sub cleanup
$state->progress->show($done, $total);
next if $remaining->{users}->{$user};
if ($state->{extra}) {
- System("/usr/sbin/userdel", $user);
+ System(OpenBSD::Paths->userdel, $user);
} else {
$state->set_pkgname($pkgname);
$state->print("You should also run /usr/sbin/userdel $user\n");
@@ -98,7 +99,7 @@ sub cleanup
$state->progress->show($done, $total);
next if $remaining->{groups}->{$group};
if ($state->{extra}) {
- System("/usr/sbin/groupdel", $group);
+ System(OpenBSD::Paths->groupdel, $group);
} else {
$state->set_pkgname($pkgname);
$state->print("You should also run /usr/sbin/groupdel $group\n");
@@ -124,7 +125,9 @@ sub cleanup
my ($self, $state) = @_;
my $fullname = $state->{destdir}.$self->fullname;
$state->print("You may wish to remove ", $fullname, " from man.conf\n");
- unlink("$fullname/whatis.db");
+ for my $f (OpenBSD::Paths->man_cruft) {
+ unlink("$fullname/$f");
+ }
}
package OpenBSD::PackingElement::Fontdir;
@@ -133,9 +136,9 @@ sub cleanup
my ($self, $state) = @_;
my $fullname = $state->{destdir}.$self->fullname;
$state->print("You may wish to remove ", $fullname, " from your font path\n");
- unlink("$fullname/fonts.alias");
- unlink("$fullname/fonts.dir");
- unlink("$fullname/fonts.cache-1");
+ for my $f (OpenBSD::Paths->font_cruft) {
+ unlink("$fullname/$f");
+ }
}
package OpenBSD::PackingElement::Infodir;
@@ -143,7 +146,9 @@ sub cleanup
{
my ($self, $state) = @_;
my $fullname = $state->{destdir}.$self->fullname;
- unlink("$fullname/dir");
+ for my $f (OpenBSD::Paths->info_cruft) {
+ unlink("$fullname/$f");
+ }
}
1;
diff --git a/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm b/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm
index 45bde1db1e6..6db12a41263 100644
--- a/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm
+++ b/usr.sbin/pkg_add/OpenBSD/SharedLibs.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: SharedLibs.pm,v 1.27 2007/06/06 10:56:21 espie Exp $
+# $OpenBSD: SharedLibs.pm,v 1.28 2007/06/16 09:29:37 espie Exp $
#
# Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org>
#
@@ -17,6 +17,7 @@
use strict;
use warnings;
+use OpenBSD::Paths;
package OpenBSD::PackingElement;
sub mark_available_lib
@@ -36,7 +37,7 @@ use File::Basename;
use OpenBSD::Error;
my $path;
-my @ldconfig = ('/sbin/ldconfig');
+my @ldconfig = (OpenBSD::Paths->ldconfig);
sub init_path($)
@@ -44,7 +45,7 @@ sub init_path($)
my $destdir = shift;
$path={};
if ($destdir ne '') {
- unshift @ldconfig, 'chroot', $destdir;
+ unshift @ldconfig, OpenBSD::Paths->chroot, $destdir;
}
open my $fh, "-|", @ldconfig, "-r";
if (defined $fh) {
@@ -99,7 +100,7 @@ my $done_plist = {};
sub system_dirs
{
- return ("/usr", "/usr/X11R6");
+ return OpenBSD::Paths->library_dirs;
}
sub add_libs_from_system
diff --git a/usr.sbin/pkg_add/OpenBSD/Temp.pm b/usr.sbin/pkg_add/OpenBSD/Temp.pm
index c207c2d4476..b8b17d46aeb 100644
--- a/usr.sbin/pkg_add/OpenBSD/Temp.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Temp.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Temp.pm,v 1.12 2007/06/14 13:19:39 kili Exp $
+# $OpenBSD: Temp.pm,v 1.13 2007/06/16 09:29:37 espie Exp $
#
# Copyright (c) 2003-2005 Marc Espie <espie@openbsd.org>
#
@@ -20,8 +20,9 @@ use warnings;
package OpenBSD::Temp;
use File::Temp;
+use OpenBSD::Paths;
-our $tempbase = $ENV{'PKG_TMPDIR'} || '/var/tmp';
+our $tempbase = $ENV{'PKG_TMPDIR'} || OpenBSD::Paths->vartmp;
my $dirs = {};
my $files = {};
diff --git a/usr.sbin/pkg_add/OpenBSD/Ustar.pm b/usr.sbin/pkg_add/OpenBSD/Ustar.pm
index 5f7e8167815..172a3b5abc1 100644
--- a/usr.sbin/pkg_add/OpenBSD/Ustar.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Ustar.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Ustar.pm,v 1.49 2007/06/12 09:53:36 espie Exp $
+# $OpenBSD: Ustar.pm,v 1.50 2007/06/16 09:29:37 espie Exp $
#
# Copyright (c) 2002-2007 Marc Espie <espie@openbsd.org>
#
@@ -42,6 +42,7 @@ use constant {
use File::Path ();
use File::Basename ();
use OpenBSD::IdCache;
+use OpenBSD::Paths;
my $uidcache = new OpenBSD::UidCache;
my $gidcache = new OpenBSD::GidCache;
@@ -510,7 +511,9 @@ sub create
{
my $self = shift;
$self->make_basedir($self->{name});
- system('/sbin/mknod', 'mknod', '-m', $self->{mode}, $self->{destdir}.$self->{name}, $self->devicetype, $self->{major}, $self->{minor});
+ system(OpenBSD::Paths->mknod,
+ '-m', $self->{mode}, $self->{destdir}.$self->{name},
+ $self->devicetype, $self->{major}, $self->{minor});
$self->set_modes;
}
diff --git a/usr.sbin/pkg_add/OpenBSD/Vstat.pm b/usr.sbin/pkg_add/OpenBSD/Vstat.pm
index 9e94cfc3f05..025aaa9d675 100644
--- a/usr.sbin/pkg_add/OpenBSD/Vstat.pm
+++ b/usr.sbin/pkg_add/OpenBSD/Vstat.pm
@@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
-# $OpenBSD: Vstat.pm,v 1.40 2007/06/11 09:12:27 espie Exp $
+# $OpenBSD: Vstat.pm,v 1.41 2007/06/16 09:29:37 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -26,6 +26,7 @@ use warnings;
package OpenBSD::Vstat;
use File::Basename;
+use OpenBSD::Paths;
my $devinfo = {};
my $devinfo2 = {};
@@ -47,7 +48,7 @@ sub create_device($)
sub init_devices()
{
delete $ENV{'BLOCKSIZE'};
- open(my $cmd1, "/sbin/mount|") or print STDERR "Can't run mount\n";
+ open(my $cmd1, "-|", OpenBSD::Paths->mount) or print STDERR "Can't run mount\n";
while (<$cmd1>) {
chomp;
if (m/^(.*?)\s+on\s+\/.*?\s+type\s+.*?(?:\s+\((.*?)\))?$/o) {
@@ -80,7 +81,7 @@ sub ask_df($)
my $fname = shift;
my $info = $giveup;
- open(my $cmd2, "-|", "/bin/df", $fname)
+ open(my $cmd2, "-|", OpenBSD::Paths->df, $fname)
or print STDERR "Can't run df\n";
my $blocksize = 512;
while (<$cmd2>) {
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index af08c671865..8bfa10aeba5 100644
--- a/usr.sbin/pkg_add/pkg_add
+++ b/usr.sbin/pkg_add/pkg_add
@@ -1,7 +1,7 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_add,v 1.322 2007/06/11 09:23:20 espie Exp $
+# $OpenBSD: pkg_add,v 1.323 2007/06/16 09:29:37 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -32,6 +32,7 @@ use OpenBSD::Error;
use OpenBSD::Interactive;
use OpenBSD::Add;
use OpenBSD::SharedLibs;
+use OpenBSD::Paths;
# use OpenBSD::UpdateSet;
my $bad = 0;
@@ -541,7 +542,7 @@ try {
};
try {
-$opt_L = '/usr/local' unless defined $opt_L;
+$opt_L = OpenBSD::Paths->localbase unless defined $opt_L;
my $state = OpenBSD::pkg_add::State->new;
$state->{cache} = {};
diff --git a/usr.sbin/pkg_add/pkg_create b/usr.sbin/pkg_add/pkg_create
index f277f9a3a00..77d42fae9a9 100644
--- a/usr.sbin/pkg_add/pkg_create
+++ b/usr.sbin/pkg_add/pkg_create
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_create,v 1.114 2007/06/14 10:16:37 espie Exp $
+# $OpenBSD: pkg_create,v 1.115 2007/06/16 09:29:37 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -26,6 +26,7 @@ use OpenBSD::Temp;
use OpenBSD::Error;
use OpenBSD::Ustar;
use OpenBSD::ArcCheck;
+use OpenBSD::Paths;
use File::Basename;
# Extra stuff needed to archive files
@@ -679,7 +680,7 @@ if ($opt_n) {
local $SIG{'HUP'} = $h;
local $SIG{'KILL'} = $h;
local $SIG{'TERM'} = $h;
- open(my $fh, "|gzip >$wname");
+ open(my $fh, "|-", OpenBSD::Paths->gzip, "-o", $wname);
my $wrarc = OpenBSD::Ustar->new($fh, $plist->infodir);
$plist->create_package($wrarc, $base, $opt_v);
diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete
index c35863fdf17..c8acd8f19f4 100644
--- a/usr.sbin/pkg_add/pkg_delete
+++ b/usr.sbin/pkg_add/pkg_delete
@@ -1,6 +1,6 @@
#!/usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_delete,v 1.108 2007/06/04 14:57:33 espie Exp $
+# $OpenBSD: pkg_delete,v 1.109 2007/06/16 09:29:37 espie Exp $
#
# Copyright (c) 2003-2007 Marc Espie <espie@openbsd.org>
#
@@ -26,6 +26,7 @@ use OpenBSD::Interactive;
use OpenBSD::Delete;
use OpenBSD::PackageInfo;
use OpenBSD::Vstat;
+use OpenBSD::Paths;
# use OpenBSD::UpdateSet;
our %forced = ();
@@ -69,7 +70,7 @@ if ($opt_B ne '') {
}
$ENV{'PKG_DESTDIR'} = $opt_B;
-$opt_L = '/usr/local' unless defined $opt_L;
+$opt_L = OpenBSD::Paths->localbase unless defined $opt_L;
if (defined $opt_p) {
Usage "Option p is obsolete";
diff --git a/usr.sbin/pkg_add/pkg_merge b/usr.sbin/pkg_add/pkg_merge
index 05dde5863bf..c8bd09d61b9 100644
--- a/usr.sbin/pkg_add/pkg_merge
+++ b/usr.sbin/pkg_add/pkg_merge
@@ -22,6 +22,7 @@ use OpenBSD::Getopt;
use OpenBSD::Error;
use OpenBSD::Ustar;
use OpenBSD::ArcCheck;
+use OpenBSD::Paths;
use File::Copy;
use File::Path;
@@ -145,7 +146,7 @@ my @tomerge;
my $prefix = 'a';
my $allprefix = '';
-open( my $outfh, "|gzip -c >$opt_o");
+open( my $outfh, "|-", OpenBSD::Paths->gzip, "-o", $opt_o);
my $wrarc = OpenBSD::Ustar->new($outfh, ".");
for my $pkgname (@ARGV) {
diff --git a/usr.sbin/pkg_add/pkg_mklocatedb b/usr.sbin/pkg_add/pkg_mklocatedb
index 7e562aa8a40..652a2ee441a 100644
--- a/usr.sbin/pkg_add/pkg_mklocatedb
+++ b/usr.sbin/pkg_add/pkg_mklocatedb
@@ -19,6 +19,7 @@ use OpenBSD::PackageInfo;
use OpenBSD::PackingList;
use OpenBSD::Getopt;
use OpenBSD::Error;
+use OpenBSD::Paths;
use File::Path;
package OpenBSD::PackingElement;
@@ -74,7 +75,7 @@ try {
};
my $fh;
-my $MKLOCATEDB="/usr/libexec/locate.mklocatedb";
+my $MKLOCATEDB = OpenBSD::Paths->mklocatedb;
if ($opt_n or -t STDOUT) {
$fh = \*STDOUT;
@@ -82,7 +83,8 @@ if ($opt_n or -t STDOUT) {
open $fh, "|-", $MKLOCATEDB, $MKLOCATEDB or die "couldn't open pipe: $!";
}
if ($opt_s || $opt_x) {
- my ($rev, $arch) = split(/\s+/o, `uname -mr`);
+ my $cmd = OpenBSD::Paths->uname." -mr";
+ my ($rev, $arch) = split(/\s+/o, `$cmd`);
chomp $arch;
$rev =~ s/\.//;
if ($opt_s) {
@@ -122,7 +124,7 @@ if ($opt_r) {
while (my $e = readdir $dir) {
if ($e =~ m/^(\w+\d\d)\.tgz$/o) {
my $set = $1;
- open my $arc, '-|', '/usr/bin/gzip', 'gzip', '-c', '-d', "$opt_r/$e";
+ open my $arc, '-|', OpenBSD::Paths->gzip, '-c', '-d', "$opt_r/$e";
my $u = OpenBSD::Ustar->new($arc, '/');
while (my $f = $u->next) {
my $name = $f->{name};