summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackageInfo.pm7
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingElement.pm6
-rw-r--r--usr.sbin/pkg_add/pkg_create10
-rw-r--r--usr.sbin/pkg_add/pkg_create.18
-rw-r--r--usr.sbin/pkg_add/pkg_delete20
-rw-r--r--usr.sbin/pkg_add/pkg_info24
-rw-r--r--usr.sbin/pkg_add/pkg_info.110
7 files changed, 66 insertions, 19 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm b/usr.sbin/pkg_add/OpenBSD/PackageInfo.pm
index c5da0fd09c1..6ee56a1e512 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.8 2004/10/11 10:07:37 espie Exp $
+# $OpenBSD: PackageInfo.pm,v 1.9 2004/10/11 10:30:34 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -21,7 +21,7 @@ package OpenBSD::PackageInfo;
our @ISA=qw(Exporter);
our @EXPORT=qw(installed_packages installed_info installed_name info_names is_info_name
add_installed delete_installed is_installed borked_package CONTENTS COMMENT DESC INSTALL DEINSTALL REQUIRE
- REQUIRED_BY DISPLAY MTREE_DIRS);
+ REQUIRED_BY DISPLAY UNDISPLAY MTREE_DIRS);
use OpenBSD::PackageName;
use constant {
@@ -33,13 +33,14 @@ use constant {
REQUIRE => '+REQUIRE',
REQUIRED_BY => '+REQUIRED_BY',
DISPLAY => '+DISPLAY',
+ UNDISPLAY => '+UNDISPLAY',
MTREE_DIRS => '+MTREE_DIRS' };
my $pkg_db = $ENV{"PKG_DBDIR"} || '/var/db/pkg';
our $list;
-our @info = (CONTENTS, COMMENT, DESC, REQUIRE, INSTALL, DEINSTALL, REQUIRED_BY, DISPLAY, MTREE_DIRS);
+our @info = (CONTENTS, COMMENT, DESC, REQUIRE, INSTALL, DEINSTALL, REQUIRED_BY, DISPLAY, UNDISPLAY, MTREE_DIRS);
our %info = ();
for my $i (@info) {
diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm
index 62d0ac24920..a6328086e07 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.47 2004/10/05 20:37:03 espie Exp $
+# $OpenBSD: PackingElement.pm,v 1.48 2004/10/11 10:30:34 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -1093,6 +1093,10 @@ package OpenBSD::PackingElement::FDISPLAY;
our @ISA=qw(OpenBSD::PackingElement::SpecialFile);
sub category() { OpenBSD::PackageInfo::DISPLAY }
+package OpenBSD::PackingElement::FUNDISPLAY;
+our @ISA=qw(OpenBSD::PackingElement::SpecialFile);
+sub category() { OpenBSD::PackageInfo::UNDISPLAY }
+
package OpenBSD::PackingElement::FMTREE_DIRS;
our @ISA=qw(OpenBSD::PackingElement::SpecialFile);
sub category() { OpenBSD::PackageInfo::MTREE_DIRS }
diff --git a/usr.sbin/pkg_add/pkg_create b/usr.sbin/pkg_add/pkg_create
index 62b6287ef94..a31369c573c 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.20 2004/10/11 10:07:37 espie Exp $
+# $OpenBSD: pkg_create,v 1.21 2004/10/11 10:30:33 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -219,12 +219,12 @@ our $errors = 0;
our ($opt_p, $opt_f, $opt_c, $opt_d, $opt_v, $opt_i, $opt_k, $opt_r,
$opt_S, $opt_h, $opt_s, $opt_O, $opt_A, $opt_L,
- $opt_M,
+ $opt_M, $opt_U,
$opt_B);
my @contents;
-getopts('p:f:c:d:vi:k:r:M:S:hs:OA:L:B:D:',
+getopts('p:f:c:d:vi:k:r:M:U:S:hs:OA:L:B:D:',
{'D' =>
sub {
local $_ = shift;
@@ -388,6 +388,10 @@ if (defined $opt_M) {
copy_subst($opt_M, $dir.DISPLAY);
}
+if (defined $opt_U) {
+ copy_subst($opt_U, $dir.UNDISPLAY);
+}
+
my @extra_files = ();
OpenBSD::PackingElement::Cwd->add($plist, '.');
for my $special (info_names()) {
diff --git a/usr.sbin/pkg_add/pkg_create.1 b/usr.sbin/pkg_add/pkg_create.1
index 08f1193b935..39d94225197 100644
--- a/usr.sbin/pkg_add/pkg_create.1
+++ b/usr.sbin/pkg_add/pkg_create.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pkg_create.1,v 1.15 2004/10/11 10:07:37 espie Exp $
+.\" $OpenBSD: pkg_create.1,v 1.16 2004/10/11 10:30:33 espie Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -43,6 +43,7 @@
.Op Fl r Ar rscript
.Op Fl S Ar pkg-destdir
.Op Fl M Ar displayfile
+.Op Fl U Ar undisplayfile
.Op Fl L Ar localbase
.Fl c Ar comment
.Fl d Ar description
@@ -166,6 +167,11 @@ Display the file (using
after installing the package.
Useful for things like
legal notices on almost-free software, etc.
+.It Fl U Ar undisplayfile
+Display the file (using
+.Xr more 1 )
+when deinstalling the package.
+Useful for reminders about stuff to clean up.
.El
.Sh PACKING LIST DETAILS
The
diff --git a/usr.sbin/pkg_add/pkg_delete b/usr.sbin/pkg_add/pkg_delete
index a6595a790fc..02604168122 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.48 2004/09/24 09:06:50 espie Exp $
+# $OpenBSD: pkg_delete,v 1.49 2004/10/11 10:30:33 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -485,6 +485,19 @@ sub delete
}
}
+package OpenBSD::PackingElement::FUNDISPLAY;
+use OpenBSD::Error;
+use OpenBSD::PackageInfo;
+
+sub delete
+{
+ my ($self, $state) = @_;
+ my $dir = $state->{dir};
+
+ my $pager = $ENV{'PAGER'} || "/usr/bin/more";
+ System("$pager $dir".UNDISPLAY);
+}
+
package main;
our ($opt_v, $opt_D, $opt_d, $opt_n, $opt_f, $opt_q, $opt_p, $opt_c, $opt_L, $opt_B);
@@ -553,6 +566,11 @@ sub delete_package
for my $item (@{$plist->{groups}}, @{$plist->{users}}, @{$plist->{items}}) {
$item->delete($state);
}
+
+ if ($plist->has(UNDISPLAY)) {
+ $plist->get(UNDISPLAY)->delete($state);
+ }
+
# guard against duplicate pkgdep
my $removed = {};
for my $item (@{$plist->{pkgdep}}) {
diff --git a/usr.sbin/pkg_add/pkg_info b/usr.sbin/pkg_add/pkg_info
index 7e28fe40dc6..cfb50f5ed53 100644
--- a/usr.sbin/pkg_add/pkg_info
+++ b/usr.sbin/pkg_add/pkg_info
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_info,v 1.9 2004/08/12 10:35:06 espie Exp $
+# $OpenBSD: pkg_info,v 1.10 2004/10/11 10:30:33 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -44,7 +44,8 @@ sub get_line
}
our ($opt_c, $opt_D, $opt_d, $opt_f, $opt_I, $opt_i, $opt_k, $opt_L, $opt_m,
- $opt_p, $opt_q, $opt_R, $opt_r, $opt_v, $opt_h, $opt_e, $opt_l, $opt_a);
+ $opt_p, $opt_q, $opt_R, $opt_r, $opt_v, $opt_h, $opt_e, $opt_l, $opt_a,
+ $opt_M, $opt_U);
sub print_info
{
@@ -73,11 +74,16 @@ sub print_info
printfile($dir.DESC);
print "\n";
}
- if ($opt_D && -f $dir.DISPLAY) {
+ if ($opt_M && -f $dir.DISPLAY) {
print $opt_p, "Install notice:\n" unless $opt_q;
printfile($dir.DISPLAY);
print "\n";
}
+ if ($opt_U && -f $dir.UNDISPLAY) {
+ print $opt_p, "Deinstall notice:\n" unless $opt_q;
+ printfile($dir.UNDISPLAY);
+ print "\n";
+ }
if ($opt_i && -f $dir.INSTALL) {
print $opt_p, "Install script:\n" unless $opt_q;
printfile($dir.INSTALL);
@@ -122,13 +128,17 @@ sub print_info
}
}
-getopts('cDdfIikLmpqRrvhe:l:a');
+getopts('cDdfIikLmpqRrvheMU:l:a');
if (defined $opt_e) {
die "Error: -e is not yet supported";
}
-unless ($opt_c || $opt_D || $opt_d || $opt_f || $opt_I || $opt_i ||
+if ($opt_D) {
+ $opt_M = 1;
+}
+
+unless ($opt_c || $opt_M || $opt_U || $opt_d || $opt_f || $opt_I || $opt_i ||
$opt_k || $opt_L || $opt_m || $opt_p || $opt_R || $opt_r) {
if (@ARGV == 0) {
$opt_I = $opt_a = 1;
@@ -138,8 +148,8 @@ unless ($opt_c || $opt_D || $opt_d || $opt_f || $opt_I || $opt_i ||
}
if ($opt_v) {
- $opt_c = $opt_d = $opt_f = $opt_i = $opt_k = $opt_r = $opt_D =
- $opt_m = $opt_R = 1;
+ $opt_c = $opt_d = $opt_f = $opt_i = $opt_k = $opt_r = $opt_M =
+ $opt_U = $opt_m = $opt_R = 1;
}
if (!defined $opt_p) {
diff --git a/usr.sbin/pkg_add/pkg_info.1 b/usr.sbin/pkg_add/pkg_info.1
index 1c1d7b97288..a334a916110 100644
--- a/usr.sbin/pkg_add/pkg_info.1
+++ b/usr.sbin/pkg_add/pkg_info.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: pkg_info.1,v 1.3 2004/10/11 10:07:37 espie Exp $
+.\" $OpenBSD: pkg_info.1,v 1.4 2004/10/11 10:30:33 espie Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -25,7 +25,7 @@
.Nd a utility for displaying information on software packages
.Sh SYNOPSIS
.Nm pkg_info
-.Op Fl cDdfIikLmpqRrvh
+.Op Fl cDdfIikLmpqRrvhMU
.Op Fl e Ar package
.Op Fl l Ar prefix
.Ar pkg-name Op Ar ...
@@ -57,7 +57,7 @@ Show information for all currently installed packages.
.It Fl c
Show the one-line comment field for each package.
.It Fl D
-Show the install-message file (if any) for each package.
+Show the install-message file (if any) for each package (deprecated option).
.It Fl d
Show the long-description field for each package.
.It Fl e Ar pkg-name
@@ -118,6 +118,8 @@ lot of different information fields at once for a package, but don't
necessary want the output intermingled in such a way that they can't
organize it.
This lets you add a special token to the start of each field.
+.It Fl M
+Show the install-message file (if any) for each package.
.It Fl p
Show the installation prefix for each package.
.It Fl q
@@ -129,6 +131,8 @@ raw info (basically, assume a non-human reading).
Show which packages require a given package.
.It Fl r
Show the requirements script (if any) for each package.
+.It Fl U
+Show the deinstall-message file (if any) for each package.
.It Fl v
Turn on verbose output.
.El