summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2003-12-10 11:12:23 +0000
committerMarc Espie <espie@cvs.openbsd.org>2003-12-10 11:12:23 +0000
commit28ac1ede86fa21e4a2a4ee5e6663414d8724df72 (patch)
treed55784c29483d95babc9562d5571967ad86b1dbb /usr.sbin
parent87fa41eaa11e6eadd7ccc4939c6e66df3bdb402f (diff)
Replace Adding/Deleting with "Pretending to add/delete" in -n mode.
Pick up DISPLAY from staging area, so that it gets found even if -n.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/pkg_add/pkg_add15
-rw-r--r--usr.sbin/pkg_add/pkg_delete5
2 files changed, 11 insertions, 9 deletions
diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add
index 7f614978fbd..5fb8a5c89f7 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.16 2003/12/09 19:10:35 espie Exp $
+# $OpenBSD: pkg_add,v 1.17 2003/12/10 11:12:22 espie Exp $
#
# Copyright (c) 2003 Marc Espie.
#
@@ -131,13 +131,14 @@ sub can_install($)
# This does pre_add a package: finding it and reading its package information
-sub pre_add($)
+sub pre_add($$)
{
- my $pkg = shift;
+ my ($pkg, $not) = @_;
my $pkgname1;
+ my $operation = $not ? "Pretending to add" : "Adding";
if ($pkg ne '-') {
- print "Adding $pkg\n";
+ print "$operation $pkg\n";
$pkgname1 = OpenBSD::PackageName->new($pkg);
return undef unless can_install($pkgname1->{pkgname});
}
@@ -164,7 +165,7 @@ sub pre_add($)
return undef;
}
} else {
- print "Adding ",$pkgname->{pkgname}, "\n";
+ print $operation, " ", $pkgname->{pkgname}, "\n";
return undef unless can_install($pkgname->{pkgname});
}
# second handling of conflicts
@@ -382,7 +383,7 @@ sub really_add($)
add_installed($pkgname);
if ($plist->has(DISPLAY)) {
my $pager = $ENV{'PAGER'} || "/usr/bin/more";
- system($pager, $dest.DISPLAY);
+ system($pager, $dir.DISPLAY);
}
}
@@ -392,7 +393,7 @@ my $cache={};
MAINLOOP:
while (my $pkg = shift @todo) {
if (!defined $cache->{$pkg}) {
- $cache->{$pkg} = pre_add($pkg);
+ $cache->{$pkg} = pre_add($pkg, $opt_n);
}
my $handle = $cache->{$pkg};
next unless defined $handle;
diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete
index 35ddcc6c324..353a514d19c 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.13 2003/12/09 19:22:36 espie Exp $
+# $OpenBSD: pkg_delete,v 1.14 2003/12/10 11:12:22 espie Exp $
#
# Copyright (c) 2003 Marc Espie.
#
@@ -380,7 +380,8 @@ if ($bad) {
}
my $deps = OpenBSD::RequiredBy->new($pkgname)->list();
next if @$deps > 0;
- print "Deleting $pkgname\n";
+ print $opt_n ? "Pretending to delete " : "Deleting ",
+ "$pkgname\n";
$state->{pkgname_tolog} = $pkgname;
delete_package($pkgname, $state);
delete_installed($pkgname);