diff options
author | hubertf <hubertf@pkgsrc.org> | 2002-10-07 14:43:08 +0000 |
---|---|---|
committer | hubertf <hubertf@pkgsrc.org> | 2002-10-07 14:43:08 +0000 |
commit | 0d44ca0a05b0cc03a14ae979c2765cfbc3d0baaf (patch) | |
tree | 556584f015758f4bd95ffb6ee9ab988db5761fe9 | |
parent | 04ef07cefbada6abae4ac9973cc5c4afdbe0bb4b (diff) | |
download | pkgsrc-0d44ca0a05b0cc03a14ae979c2765cfbc3d0baaf.tar.gz |
Update to 1.1. Mostly cosmetic changes, among others incudes patch from
PR 18546 by woods@weird.com (Greg A. Woods).
-rw-r--r-- | pkgtools/pkg_tarup/Makefile | 26 | ||||
-rw-r--r-- | pkgtools/pkg_tarup/files/pkg_tarup | 104 |
2 files changed, 61 insertions, 69 deletions
diff --git a/pkgtools/pkg_tarup/Makefile b/pkgtools/pkg_tarup/Makefile index d8c0cad4498..5be7ca18bda 100644 --- a/pkgtools/pkg_tarup/Makefile +++ b/pkgtools/pkg_tarup/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.5 2001/09/20 17:06:01 agc Exp $ +# $NetBSD: Makefile,v 1.6 2002/10/07 14:43:08 hubertf Exp $ -DISTNAME= pkg_tarup-1.0.3 +DISTNAME= pkg_tarup-1.1 CATEGORIES= pkgtools MASTER_SITES= # empty DISTFILES= # empty @@ -8,14 +8,32 @@ DISTFILES= # empty MAINTAINER= hubertf@netbsd.org COMMENT= Generates binary package from installed pkg +EXTRACT_ONLY= # empty WRKSRC= ${WRKDIR} NO_CHECKSUM= yes NO_PATCH= yes -NO_CONFIGURE= 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} \ + 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!\\\${/} + +do-configure: + ${SED} ${SCRIPT_SUBST_SED} \ + < ${FILESDIR}/pkg_tarup \ + > ${WRKSRC}/pkg_tarup \ + do-install: - ${INSTALL_SCRIPT} ${FILESDIR}/pkg_tarup ${PREFIX}/bin + ${INSTALL_SCRIPT} ${WRKSRC}/pkg_tarup ${PREFIX}/bin .include "../../mk/bsd.pkg.mk" diff --git a/pkgtools/pkg_tarup/files/pkg_tarup b/pkgtools/pkg_tarup/files/pkg_tarup index b3bf0cd758a..55cb3e828ca 100644 --- a/pkgtools/pkg_tarup/files/pkg_tarup +++ b/pkgtools/pkg_tarup/files/pkg_tarup @@ -1,62 +1,36 @@ -#!/bin/sh -# $Id: pkg_tarup,v 1.5 2001/09/20 17:06:01 agc Exp $ +#! ${SH} +# +# $Id: pkg_tarup,v 1.6 2002/10/07 14:43:08 hubertf Exp $ # # Tar up installed package # -# (c) Copyright 2000 Hubert Feyrer <hubert@feyrer.de> +# (c) Copyright 2000-2002 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 $@" +PATH=/sbin:/usr/sbin:/bin:/usr/bin:${PREFIX}/sbin:${PREFIX}/bin + +if [ `${ID} -u` != 0 ]; then + ${ECHO} "Becoming root@`/bin/hostname` to create a binary package" + ${ECHO} -n "`${ECHO} ${SU} | ${AWK} '{ print $$1 }'` ";\ + exec ${SU} root -c "$0 $@" fi -PKG_DBDIR=${PKG_DBDIR:-/var/db/pkg} +pkgdbdir=${PKG_DBDIR:-${PKG_DBDIR}} +pkgsufx=${PKG_SUFX:-${PKG_SUFX}} + PKGREPOSITORY=${PKGREPOSITORY:-/tmp} -PKG_SUFX=${PKG_SUFX:-tgz} PKG="$1" rPKG="`pkg_info -e \"$PKG\"`" -if [ "$PKG" = "" -o "$rPKG" = "" -o -f "${PKG_DBDIR}/${rPKG}" ] +if [ "$PKG" = "" -o "$rPKG" = "" -o -f "${pkgdbdir}/${rPKG}" ] then - echo Usage: $0 installed_pkg + ${ECHO} Usage: $0 installed_pkg exit 1 fi PKG=$rPKG -echo "Creating binary package: $PKG" +${ECHO} "Creating binary package: $PKG" check_and_add() { @@ -64,7 +38,7 @@ check_and_add() { file="$2" if [ x"$opt" = x"" -o x"$file" = x"" ]; then - echo Usage: check_and_add -opt +FILE + ${ECHO} Usage: check_and_add -opt +FILE exit 1 fi @@ -74,24 +48,24 @@ check_and_add() { fi } -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# +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# PLIST=/tmp/+CONTENTS.$$ sed -n \ -e '/^@comment MD5:/d' \ -e '/^@cwd \.$/,$d' \ -e '/\$NetBSD/,$p' \ - <${PKG_DBDIR}/${PKG}/+CONTENTS >$PLIST + <${pkgdbdir}/${PKG}/+CONTENTS >$PLIST # Duplicate first @cwd (work around pkg_create "feature" ...) grep '^@cwd' $PLIST | head -1 >$PLIST.1 @@ -104,9 +78,9 @@ then fi rm ${PLIST}.1 -# echo ----- +# ${ECHO} ----- # cat $PLIST -# echo ----- +# ${ECHO} ----- # exit 0 # Just for kicks ... @@ -117,16 +91,17 @@ pkg_create \ -v \ -f ${PLIST} \ -l \ - -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} + -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} rm -f ${PLIST} exit 0 + 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 @@ -134,7 +109,6 @@ mtree file considerations: - 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? - + - 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? |