summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_tarup
diff options
context:
space:
mode:
authoragc <agc@pkgsrc.org>2001-09-20 17:06:01 +0000
committeragc <agc@pkgsrc.org>2001-09-20 17:06:01 +0000
commit7ec92c14b7ef70f02c934b7450969809483290cd (patch)
tree947253b3ad53cf9bb011fb4f55ef207befb2e8ae /pkgtools/pkg_tarup
parentcca09ee07f77198785545e75ab86ad11a8b4dacb (diff)
downloadpkgsrc-7ec92c14b7ef70f02c934b7450969809483290cd.tar.gz
Bump pkg_tarup to version 1.0.3
+ Convert a few "grep | awk" pipelines into straight awk. + Add in path names per OS. + Add a just-in-time su so that pkg_tarup can be run as a normal user, and the right things will happen.
Diffstat (limited to 'pkgtools/pkg_tarup')
-rw-r--r--pkgtools/pkg_tarup/Makefile4
-rw-r--r--pkgtools/pkg_tarup/files/pkg_tarup46
2 files changed, 43 insertions, 7 deletions
diff --git a/pkgtools/pkg_tarup/Makefile b/pkgtools/pkg_tarup/Makefile
index 91a2e5515b2..d8c0cad4498 100644
--- a/pkgtools/pkg_tarup/Makefile
+++ b/pkgtools/pkg_tarup/Makefile
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.4 2001/07/10 11:42:06 tron Exp $
+# $NetBSD: Makefile,v 1.5 2001/09/20 17:06:01 agc Exp $
-DISTNAME= pkg_tarup-1.0.2
+DISTNAME= pkg_tarup-1.0.3
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
diff --git a/pkgtools/pkg_tarup/files/pkg_tarup b/pkgtools/pkg_tarup/files/pkg_tarup
index 0c1e7dbafd1..b3bf0cd758a 100644
--- a/pkgtools/pkg_tarup/files/pkg_tarup
+++ b/pkgtools/pkg_tarup/files/pkg_tarup
@@ -1,11 +1,47 @@
#!/bin/sh
-# $Id: pkg_tarup,v 1.4 2001/07/26 11:39:37 hubertf Exp $
+# $Id: pkg_tarup,v 1.5 2001/09/20 17:06:01 agc Exp $
#
# Tar up installed package
#
# (c) Copyright 2000 Hubert Feyrer <hubert@feyrer.de>
#
+OS=`uname -s`
+
+case ${OS} in
+NetBSD)
+ awkprog=/usr/bin/awk
+ echoprog=echo
+ idprog=/usr/bin/id
+ suprog=/usr/bin/su
+ ;;
+SunOS)
+ awkprog=/usr/bin/nawk
+ echoprog=/usr/ucb/echo
+ idprog=/usr/xpg4/bin/id
+ suprog=/usr/bin/su
+ ;;
+Linux)
+ awkprog=/usr/bin/awk
+ echoprog=/bin/echo
+ idprog=/usr/bin/id
+ suprog=/bin/su
+ ;;
+*)
+ echo "Unusual OS - thanks for using pkgsrc"
+ awkprog=awk
+ echoprog=echo
+ idprog=id
+ suprog=su
+ ;;
+esac
+
+if [ `${idprog} -u` != 0 ]; then
+ ${echoprog} "Becoming root@`/bin/hostname` to create a binary package"
+ ${echoprog} -n "`${echoprog} ${suprog} | ${awkprog} '{ print $$1 }'` ";\
+ exec ${suprog} root -c "$0 $@"
+fi
+
PKG_DBDIR=${PKG_DBDIR:-/var/db/pkg}
PKGREPOSITORY=${PKGREPOSITORY:-/tmp}
PKG_SUFX=${PKG_SUFX:-tgz}
@@ -20,7 +56,7 @@ then
fi
PKG=$rPKG
-echo "Taring up $PKG"
+echo "Creating binary package: $PKG"
check_and_add() {
@@ -81,9 +117,9 @@ pkg_create \
-v \
-f ${PLIST} \
-l \
- -p "`pkg_info -qp ${PKG} | head -1 | awk '{ print $2 }'`" \
- -P "`pkg_info -qf ${PKG} | grep '^@pkgdep' | awk '{ print $2 }'`" \
- -C "`pkg_info -qf ${PKG} | grep '^@pkgcfl' | awk '{ print $2 }'`" \
+ -p "`pkg_info -qp ${PKG} | ${awkprog} 'NR == 1 { print $2; exit }'`" \
+ -P "`pkg_info -qf ${PKG} | ${awkprog} '/^@pkgdep/ { print $2 }'`" \
+ -C "`pkg_info -qf ${PKG} | ${awkprog} '/^@pkgcfl/ { print $2 }'`" \
${PKGREPOSITORY}/${PKG}.${PKG_SUFX}
rm -f ${PLIST}