summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_tarup
diff options
context:
space:
mode:
Diffstat (limited to 'pkgtools/pkg_tarup')
-rw-r--r--pkgtools/pkg_tarup/Makefile27
-rw-r--r--pkgtools/pkg_tarup/files/pkg_tarup58
2 files changed, 51 insertions, 34 deletions
diff --git a/pkgtools/pkg_tarup/Makefile b/pkgtools/pkg_tarup/Makefile
index 7f12c5f4783..d25993983b7 100644
--- a/pkgtools/pkg_tarup/Makefile
+++ b/pkgtools/pkg_tarup/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.7 2002/10/14 15:28:43 hubertf Exp $
+# $NetBSD: Makefile,v 1.8 2002/11/23 22:47:02 wiz Exp $
DISTNAME= pkg_tarup-1.2
CATEGORIES= pkgtools
@@ -15,19 +15,18 @@ NO_PATCH= yes
NO_BUILD= yes
NO_MTREE= yes
-# Set SCRIPT_SUBST to substitute "${variable}" to "value" in MESSAGE
-SCRIPT_SUBST+= AWK=${AWK} \
- ECHO=${ECHO} \
- ID=${ID} \
- PKG_DBDIR=${PKG_DBDIR} \
- PKG_SUFX=${PKG_SUFX} \
- PREFIX=${PREFIX} \
- PKG_TOOLS_BIN=${PKG_TOOLS_BIN} \
- SH=${SH} \
- SU=${SU}
-
-# XXX this should probably use the @VAR@ form instead of ${VAR}...
-SCRIPT_SUBST_SED= ${SCRIPT_SUBST:S/=/}!/:S/$/!g/:S/^/ -e s!\\\${/}
+# Set SCRIPT_SUBST to substitute "@VARIABLE@" with "value"
+SCRIPT_SUBST+= AWK=${AWK:Q} \
+ ECHO=${ECHO:Q} \
+ ID=${ID:Q} \
+ PKG_DBDIR=${PKG_DBDIR:Q} \
+ PKG_SUFX=${PKG_SUFX:Q} \
+ PREFIX=${PREFIX:Q} \
+ PKG_TOOLS_BIN=${PKG_TOOLS_BIN:Q} \
+ SH=${SH:Q} \
+ SU=${SU:Q}
+
+SCRIPT_SUBST_SED= ${SCRIPT_SUBST:S/=/@!/:S/$/!g/:S/^/ -e s!@/}
do-configure:
${SED} ${SCRIPT_SUBST_SED} \
diff --git a/pkgtools/pkg_tarup/files/pkg_tarup b/pkgtools/pkg_tarup/files/pkg_tarup
index 6a257c9eb19..a3089b427dc 100644
--- a/pkgtools/pkg_tarup/files/pkg_tarup
+++ b/pkgtools/pkg_tarup/files/pkg_tarup
@@ -1,13 +1,23 @@
-#! ${SH}
+#! @SH@
#
-# $Id: pkg_tarup,v 1.7 2002/10/14 15:28:43 hubertf Exp $
+# $Id: pkg_tarup,v 1.8 2002/11/23 22:47:03 wiz Exp $
#
# Tar up installed package
#
# (c) Copyright 2000-2002 Hubert Feyrer <hubert@feyrer.de>
#
-PATH=/sbin:/usr/sbin:/bin:/usr/bin:${PREFIX}/sbin:${PREFIX}/bin:${PKG_TOOLS_BIN}
+PREFIX=${PREFIX:-@PREFIX@}
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin:${PREFIX}/sbin:${PREFIX}/bin:@PKG_TOOLS_BIN@
+export PATH
+
+OS=`uname -s`
+
+AWK=${AWK:-@AWK@}
+ECHO=${ECHO:-@ECHO@}
+ID=${ID:-@ID@}
+SU=${SU:-@SU@}
if [ `${ID} -u` != 0 ]; then
${ECHO} "Becoming root@`/bin/hostname` to create a binary package"
@@ -15,15 +25,15 @@ if [ `${ID} -u` != 0 ]; then
exec ${SU} root -c "$0 $@"
fi
-pkgdbdir=${PKG_DBDIR:-${PKG_DBDIR}}
-pkgsufx=${PKG_SUFX:-${PKG_SUFX}}
+PKG_DBDIR=${PKG_DBDIR:-@PKG_DBDIR@}
+PKG_SUFX=${PKG_SUFX:-@PKG_SUFX@}
PKGREPOSITORY=${PKGREPOSITORY:-/tmp}
PKG="$1"
rPKG="`pkg_info -e \"$PKG\"`"
-if [ "$PKG" = "" -o "$rPKG" = "" -o -f "${pkgdbdir}/${rPKG}" ]
+if [ "$PKG" = "" -o "$rPKG" = "" -o -f "${PKG_DBDIR}/${rPKG}" ]
then
${ECHO} Usage: $0 installed_pkg
exit 1
@@ -48,24 +58,24 @@ check_and_add() {
fi
}
-check_and_add -c ${pkgdbdir}/${PKG}/+COMMENT
-check_and_add -d ${pkgdbdir}/${PKG}/+DESC
-check_and_add -b ${pkgdbdir}/${PKG}/+BUILD_VERSION
-check_and_add -B ${pkgdbdir}/${PKG}/+BUILD_INFO
-check_and_add -s ${pkgdbdir}/${PKG}/+SIZE_PKG
-check_and_add -S ${pkgdbdir}/${PKG}/+SIZE_ALL
-check_and_add -i ${pkgdbdir}/${PKG}/+INSTALL
-check_and_add -k ${pkgdbdir}/${PKG}/+DEINSTALL
-check_and_add -r ${pkgdbdir}/${PKG}/+REQUIRE
-check_and_add -D ${pkgdbdir}/${PKG}/+DISPLAY
-check_and_add -m ${pkgdbdir}/${PKG}/+MTREE #NOTYET#
+check_and_add -c ${PKG_DBDIR}/${PKG}/+COMMENT
+check_and_add -d ${PKG_DBDIR}/${PKG}/+DESC
+check_and_add -b ${PKG_DBDIR}/${PKG}/+BUILD_VERSION
+check_and_add -B ${PKG_DBDIR}/${PKG}/+BUILD_INFO
+check_and_add -s ${PKG_DBDIR}/${PKG}/+SIZE_PKG
+check_and_add -S ${PKG_DBDIR}/${PKG}/+SIZE_ALL
+check_and_add -i ${PKG_DBDIR}/${PKG}/+INSTALL
+check_and_add -k ${PKG_DBDIR}/${PKG}/+DEINSTALL
+check_and_add -r ${PKG_DBDIR}/${PKG}/+REQUIRE
+check_and_add -D ${PKG_DBDIR}/${PKG}/+DISPLAY
+check_and_add -m ${PKG_DBDIR}/${PKG}/+MTREE #NOTYET#
PLIST=/tmp/+CONTENTS.$$
sed -n \
-e '/^@comment MD5:/d' \
-e '/^@cwd \.$/,$d' \
-e '/\$NetBSD/,$p' \
- <${pkgdbdir}/${PKG}/+CONTENTS >$PLIST
+ <${PKG_DBDIR}/${PKG}/+CONTENTS >$PLIST
# Duplicate first @cwd (work around pkg_create "feature" ...)
grep '^@cwd' $PLIST | head -1 >$PLIST.1
@@ -94,21 +104,29 @@ pkg_create \
-p "`pkg_info -qp ${PKG} | ${AWK} 'NR == 1 { print $2; exit }'`" \
-P "`pkg_info -qf ${PKG} | ${AWK} '/^@pkgdep/ { print $2 }'`" \
-C "`pkg_info -qf ${PKG} | ${AWK} '/^@pkgcfl/ { print $2 }'`" \
- ${PKGREPOSITORY}/${PKG}${pkgsufx}
+ ${PKGREPOSITORY}/${PKG}${PKG_SUFX}
rm -f ${PLIST}
exit 0
++REQUIRED_BY:
+
+ - maybe the squirelling away of +REQUIRED_BY should be done here
+ instead of in the bsd.pkg.mk framework that normally calls this.
mtree file considerations:
+
- keeping uncompressed mtree file adds ~10% to the size of /var/db/pkg
+
- could gzip file, space saving: 5kb->850b (plus some intelligence to
uncompress them when needed)
+
- not keeping mtree file results in pkgs w/o mtree file (but should work)
integration:
+
- how/where? I'd prefer not to have yet another pkg_* utility flying
around, integration into pkg_admin would be nice. But how merge a
- shell script into a C executable?
+ shell script into a C executable? REWRITE in C of course! ;-)