diff options
author | abs <abs@pkgsrc.org> | 2007-04-15 21:34:49 +0000 |
---|---|---|
committer | abs <abs@pkgsrc.org> | 2007-04-15 21:34:49 +0000 |
commit | b6f4f88238fb9ad84ff4436b9519984a3bcea49f (patch) | |
tree | 760ba86ea8ddbc38575da6a3d0c40747dd5e14c3 /pkgtools | |
parent | 617ca30d3d8e8bfd29708d547ce8546657caa764 (diff) | |
download | pkgsrc-b6f4f88238fb9ad84ff4436b9519984a3bcea49f.tar.gz |
Update pkg_chk to 1.84:
Automatically use SU_CMD for pkg_add and pkg_delete if set by
main pkgsrc and running as a non root user - based on a patch
from Aleksey Cheusov.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkg_chk/Makefile | 4 | ||||
-rwxr-xr-x | pkgtools/pkg_chk/files/pkg_chk.sh | 31 |
2 files changed, 25 insertions, 10 deletions
diff --git a/pkgtools/pkg_chk/Makefile b/pkgtools/pkg_chk/Makefile index 9ab79852bf2..ddb5879ce71 100644 --- a/pkgtools/pkg_chk/Makefile +++ b/pkgtools/pkg_chk/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.46 2006/11/05 21:53:27 tron Exp $ +# $NetBSD: Makefile,v 1.47 2007/04/15 21:34:49 abs Exp $ -DISTNAME= pkg_chk-1.83 +DISTNAME= pkg_chk-1.84 CATEGORIES= pkgtools MASTER_SITES= # empty DISTFILES= # empty diff --git a/pkgtools/pkg_chk/files/pkg_chk.sh b/pkgtools/pkg_chk/files/pkg_chk.sh index 4787f7d63fb..9537a55e0a0 100755 --- a/pkgtools/pkg_chk/files/pkg_chk.sh +++ b/pkgtools/pkg_chk/files/pkg_chk.sh @@ -1,6 +1,6 @@ #!@SH@ -e # -# $Id: pkg_chk.sh,v 1.44 2006/11/05 21:53:27 tron Exp $ +# $Id: pkg_chk.sh,v 1.45 2007/04/15 21:34:49 abs Exp $ # # TODO: Make -g check dependencies and tsort # TODO: Variation of -g which only lists top level packages @@ -97,7 +97,7 @@ delete_pkgs() { for pkg in $* ; do if [ -d $PKG_DBDIR/$pkg ] ; then - run_cmd "${PKG_DELETE} -r $pkg" 1 + run_cmd_su "${PKG_DELETE} -r $pkg" 1 fi done } @@ -173,9 +173,10 @@ extract_variables() if [ -z "$opt_b" -o -n "$opt_s" -o -d $PKGSRCDIR/pkgtools/pkg_chk ] ; then cd $PKGSRCDIR/pkgtools/pkg_chk - extract_make_vars Makefile AWK GREP GZIP_CMD SED SORT TSORT PACKAGES \ - PKG_ADD PKG_DELETE PKG_INFO PKG_DBDIR PKGCHK_CONF \ - PKGCHK_UPDATE_CONF PKGCHK_TAGS PKGCHK_NOTAGS PKG_SUFX + extract_make_vars Makefile \ + AWK GREP GZIP_CMD ID PACKAGES PKGCHK_CONF PKGCHK_NOTAGS \ + PKGCHK_TAGS PKGCHK_UPDATE_CONF PKG_ADD PKG_DBDIR PKG_DELETE \ + PKG_INFO PKG_SUFX SED SORT SU_CMD TSORT if [ -z "$PACKAGES" ];then PACKAGES=$PKGSRCDIR/packages fi @@ -489,7 +490,7 @@ pkg_install() if [ -n "$saved_PKG_PATH" ] ; then export PKG_PATH=$saved_PKG_PATH fi - run_cmd "${PKG_ADD} $PACKAGES/$PKGNAME$PKG_SUFX" + run_cmd_su "${PKG_ADD} $PACKAGES/$PKGNAME$PKG_SUFX" if [ -n "$saved_PKG_PATH" ] ; then unset PKG_PATH fi @@ -548,6 +549,15 @@ run_cmd() fi } +run_cmd_su() + { + if [ -n "$SU_CMD" ]; then + run_cmd "${SU_CMD} '$1'" "$2" + else + run_cmd "$1" "$2" + fi + } + set_path() { arg=$1 @@ -614,7 +624,7 @@ verbose_var() fi } -args=$(getopt BC:D:L:P:U:abcfghiklNnpqrsSuv "$@") +args=$(getopt BC:D:L:P:U:abcfghiklNnpqrsuv "$@") if [ $? != 0 ]; then opt_h=1 fi @@ -679,15 +689,16 @@ test -n "$AWK" || AWK="@AWK@" test -n "$GREP" || GREP="@GREP@" test -n "$GZIP_CMD" || GZIP_CMD="@GZIP_CMD@" export GZIP_CMD +test -n "$ID" || ID="@ID@" test -n "$MAKE" || MAKE="@MAKE@" test -n "$MAKECONF" || MAKECONF="@MAKECONF@" test -n "$PKG_ADD" || PKG_ADD="@PKG_ADD@" +test -n "$PKG_DBDIR" || PKG_DBDIR="@PKG_DBDIR@" test -n "$PKG_DELETE" || PKG_DELETE="@PKG_DELETE@" test -n "$PKG_INFO" || PKG_INFO="@PKG_INFO@" test -n "$SED" || SED="@SED@" test -n "$SORT" || SORT="@SORT@" test -n "$TSORT" || TSORT="@TSORT@" -test -n "$PKG_DBDIR" || PKG_DBDIR="@PKG_DBDIR@" if [ ! -f $MAKECONF ] ; then if [ -f @PREFIX@/etc/mk.conf ] ; then @@ -729,6 +740,10 @@ if [ -d $PACKAGES/All ] ; then PACKAGES="$PACKAGES/All" fi +if [ "`${ID} -u`" = 0 ] ; then + SU_CMD= +fi + if [ -n "$opt_N" ]; then ${PKG_INFO} | \ ${SED} -e "s/[ ].*//" -e "s/-[^-]*$//" \ |