summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_tarup
diff options
context:
space:
mode:
authorhubertf <hubertf>2000-02-14 02:07:08 +0000
committerhubertf <hubertf>2000-02-14 02:07:08 +0000
commit71c0e71dcada9c58bdd929eea1bf18632ee40ad3 (patch)
tree5821b2704988718cb4f74b697c77c2c776a3c108 /pkgtools/pkg_tarup
parent3ca3c1475e50f585105d0e10fa822120f3200e5b (diff)
downloadpkgsrc-71c0e71dcada9c58bdd929eea1bf18632ee40ad3.tar.gz
Script to tar up an already instaled package.
Diffstat (limited to 'pkgtools/pkg_tarup')
-rw-r--r--pkgtools/pkg_tarup/Makefile21
-rw-r--r--pkgtools/pkg_tarup/files/pkg_tarup104
-rw-r--r--pkgtools/pkg_tarup/pkg/COMMENT1
-rw-r--r--pkgtools/pkg_tarup/pkg/DESCR14
-rw-r--r--pkgtools/pkg_tarup/pkg/PLIST2
5 files changed, 142 insertions, 0 deletions
diff --git a/pkgtools/pkg_tarup/Makefile b/pkgtools/pkg_tarup/Makefile
new file mode 100644
index 00000000000..9252227dab1
--- /dev/null
+++ b/pkgtools/pkg_tarup/Makefile
@@ -0,0 +1,21 @@
+# $NetBSD: Makefile,v 1.1.1.1 2000/02/14 02:07:08 hubertf Exp $
+#
+
+DISTNAME= pkg_tarup-1.0
+CATEGORIES= pkgtools
+MASTER_SITES= # empty
+DISTFILES= # empty
+
+MAINTAINER= hubertf@netbsd.org
+
+WRKSRC= ${WRKDIR}
+NO_CHECKSUM= yes
+NO_PATCH= yes
+NO_CONFIGURE= yes
+NO_BUILD= yes
+NO_MTREE= yes
+
+do-install:
+ ${INSTALL_SCRIPT} ${FILESDIR}/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
new file mode 100644
index 00000000000..0522d5ead55
--- /dev/null
+++ b/pkgtools/pkg_tarup/files/pkg_tarup
@@ -0,0 +1,104 @@
+#!/bin/sh
+# $Id: pkg_tarup,v 1.1.1.1 2000/02/14 02:07:13 hubertf Exp $
+#
+# Tar up installed package
+#
+# (c) Copyright 2000 Hubert Feyrer <hubert@feyrer.de>
+#
+
+PKG_DBDIR=${PKG_DBDIR:-/var/db/pkg}
+PKGREPOSITORY=${PKGREPOSITORY:-/tmp}
+PKG_SUFX=${PKG_SUFX:-tgz}
+
+PKG="$1"
+rPKG="`pkg_info -e \"$PKG\"`"
+
+if [ "$PKG" = "" -o "$rPKG" = "" -o -f "${PKG_DBDIR}/${rPKG}" ]
+then
+ echo Usage: $0 installed_pkg
+ exit 1
+fi
+
+PKG=$rPKG
+echo "Taring up $PKG"
+
+
+check_and_add() {
+ opt="$1"
+ file="$2"
+
+ if [ x"$opt" = x"" -o x"$file" = x"" ]; then
+ echo Usage: check_and_add -opt +FILE
+ exit 1
+ fi
+
+ if [ -f "$file" ]
+ then
+ PKG_ARGS="${PKG_ARGS} ${opt} ${file}"
+ 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 #NOTYET#
+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' \
+ <${PKG_DBDIR}/${PKG}/+CONTENTS >$PLIST
+
+# Duplicate first @cwd (work around pkg_create "feature" ...)
+grep '^@cwd' $PLIST | head -1 >$PLIST.1
+if [ -s ${PLIST}.1 ]
+then
+ sed \
+ -e "/`cat ${PLIST}.1 | sed 's,/,\\\\/,g'`/r${PLIST}.1" \
+ <${PLIST} >${PLIST}.2
+ mv ${PLIST}.2 ${PLIST}
+fi
+rm ${PLIST}.1
+
+# echo -----
+# cat $PLIST
+# echo -----
+# exit 0
+
+# Just for kicks ...
+# pkg_admin check "${PKG}"
+
+pkg_create \
+ ${PKG_ARGS} \
+ -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 }'`" \
+ ${PKGREPOSITORY}/${PKG}.${PKG_SUFX}
+
+rm -f ${PLIST}
+exit 0
+
+
+
+mtree file considerations:
+ - keeping uncompressed mtree file adds ~10% too 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?
+
diff --git a/pkgtools/pkg_tarup/pkg/COMMENT b/pkgtools/pkg_tarup/pkg/COMMENT
new file mode 100644
index 00000000000..75e10537fa5
--- /dev/null
+++ b/pkgtools/pkg_tarup/pkg/COMMENT
@@ -0,0 +1 @@
+Generates binary package from installed pkg
diff --git a/pkgtools/pkg_tarup/pkg/DESCR b/pkgtools/pkg_tarup/pkg/DESCR
new file mode 100644
index 00000000000..5338c058499
--- /dev/null
+++ b/pkgtools/pkg_tarup/pkg/DESCR
@@ -0,0 +1,14 @@
+Script to tar up an already instaled package.
+
+Now my question is, how can we include this? I'd prefer to have it
+available from pkg_admin, but that is C, and the other is a script -
+rewrite in C?
+
+The Script has still two problems, as the INSTALL and MTREE files are
+removed after a pkg_add/make install. The INSTALL file isn't a problem to
+keep, but the MTREE file will lead to a ~10% increase in space needed for
+/var/db/pkg which I'm not sure we should do, esp. as the files are almost
+always the same again. (On my notebook with ~250 installed pkgs, the size
+increasement would be from 8.8MB to 10MB).
+
+Send your thoughts to me <hubertf@netbsd.org> !
diff --git a/pkgtools/pkg_tarup/pkg/PLIST b/pkgtools/pkg_tarup/pkg/PLIST
new file mode 100644
index 00000000000..5585207048f
--- /dev/null
+++ b/pkgtools/pkg_tarup/pkg/PLIST
@@ -0,0 +1,2 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2000/02/14 02:07:11 hubertf Exp $
+bin/pkg_tarup