diff options
author | sada <sada@FreeBSD.org> | 2001-04-24 01:27:50 +0800 |
---|---|---|
committer | sada <sada@FreeBSD.org> | 2001-04-24 01:27:50 +0800 |
commit | 7d39c03f9e7f6ba949adaf00fae11c165fa6f5f5 (patch) | |
tree | 672e82f5b1e119ea6a2c7f142214d56eae447e44 /sysutils | |
parent | d4f932684e7949a7c877b0cafb0ccdb69af2ef40 (diff) | |
download | freebsd-ports-gnome-7d39c03f9e7f6ba949adaf00fae11c165fa6f5f5.tar.gz freebsd-ports-gnome-7d39c03f9e7f6ba949adaf00fae11c165fa6f5f5.tar.zst freebsd-ports-gnome-7d39c03f9e7f6ba949adaf00fae11c165fa6f5f5.zip |
- minor update of the script.
- import script file into port skeleton.
- change maintainer's mail address.
PR: ports/26762
Submitted by: maintainer
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/pkg_remove/Makefile | 21 | ||||
-rw-r--r-- | sysutils/pkg_remove/distinfo | 1 | ||||
-rw-r--r-- | sysutils/pkg_remove/src/pkg_remove.txt | 34 |
3 files changed, 45 insertions, 11 deletions
diff --git a/sysutils/pkg_remove/Makefile b/sysutils/pkg_remove/Makefile index ba8fbb637e1b..9131bd14ca23 100644 --- a/sysutils/pkg_remove/Makefile +++ b/sysutils/pkg_remove/Makefile @@ -6,21 +6,22 @@ # PORTNAME= pkg_remove -PORTVERSION= 1.0 +PORTVERSION= 1.1 CATEGORIES= sysutils -MASTER_SITES= http://www.rr.iij4u.or.jp/~sada/scripts/ -DISTNAME= pkg_remove -EXTRACT_SUFX= .txt +MASTER_SITES= # none +DISTFILES= # none -MAINTAINER= nakaji@tutrp.tut.ac.jp +MAINTAINER= nakaji@jp.freebsd.org -EXTRACT_CMD= ${CP} -EXTRACT_BEFORE_ARGS= -EXTRACT_AFTER_ARGS= . -NO_WRKSUBDIR= yes NO_BUILD= yes +NO_WRKSUBDIR= yes + +SRC= ${.CURDIR}/src + +do-fetch: + @${DO_NADA} do-install: - ${INSTALL_SCRIPT} ${WRKDIR}/pkg_remove.txt ${PREFIX}/bin/pkg_remove + ${INSTALL_SCRIPT} ${SRC}/pkg_remove.txt ${PREFIX}/bin/pkg_remove .include <bsd.port.mk> diff --git a/sysutils/pkg_remove/distinfo b/sysutils/pkg_remove/distinfo deleted file mode 100644 index c81c3d4f24b6..000000000000 --- a/sysutils/pkg_remove/distinfo +++ /dev/null @@ -1 +0,0 @@ -MD5 (pkg_remove.txt) = 7d83feadfe5c902c3afc1230eb5443d4 diff --git a/sysutils/pkg_remove/src/pkg_remove.txt b/sysutils/pkg_remove/src/pkg_remove.txt new file mode 100644 index 000000000000..f45f81c7bfff --- /dev/null +++ b/sysutils/pkg_remove/src/pkg_remove.txt @@ -0,0 +1,34 @@ +#!/usr/bin/perl +# $Id: pkg_remove,v 1.3 1999/11/06 15:47:49 sada Exp $ +use Getopt::Std; +getopts('n'); +die("usage: x [-n] ALL | <package-name> [, <package-name> [..]]\n -n : only tell what will take place.\n") if (@ARGV < 1); +$pkg_dbdir = "/var/db/pkg"; +opendir(PKG_DBDIR, $pkg_dbdir); +while ($pkg = readdir(PKG_DBDIR)) { + next if $pkg =~ m/^\./; + $req_by{$pkg} = ''; + if (-f "$pkg_dbdir/$pkg/+REQUIRED_BY") { + open(REQ_B, "$pkg_dbdir/$pkg/+REQUIRED_BY"); + $req_by{$pkg} = join('', <REQ_B>); + } +} +while ($a = shift) { + while (($key, $val) = each(%req_by)) { + if ($a eq 'ALL' || $key =~ m/$a/) { + &remove_package($key); + } + } +} + +sub remove_package +{ + my ($pkg) = @_; + return if ($pkg_removed{$pkg}); + my @r = split(/\n/, $req_by{$pkg}); + my $p; + &remove_package($p) while $p = shift(@r); + print "remove: $pkg\n"; + system "pkg_delete $pkg" unless ($opt_n); + $pkg_removed{$pkg} = 'YES'; +} |