From f7132f1b1a1400a752e3699c0ad88d302070201c Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Thu, 16 Feb 2006 15:43:37 +0000 Subject: [PATCH] Fixes for packaging system that will read .postinstall script and run it if exists. packit installs a package. --- commands/scripts/Makefile | 4 ++++ commands/scripts/binpackage.sh | 5 +++-- commands/scripts/packit.sh | 38 ++++++++++++++++++++++++++++++++++ commands/scripts/packme.sh | 2 +- 4 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 commands/scripts/packit.sh diff --git a/commands/scripts/Makefile b/commands/scripts/Makefile index e7dbaa113..28a5efb77 100755 --- a/commands/scripts/Makefile +++ b/commands/scripts/Makefile @@ -42,6 +42,7 @@ usr: \ /usr/bin/binsizes \ /usr/bin/rotate \ /usr/bin/floppysetup \ + /usr/bin/packit \ /usr/bin/packme \ /usr/bin/spell \ /usr/bin/srccrc \ @@ -138,6 +139,9 @@ clean: /usr/bin/binsizes: binsizes.sh install -m 755 -c -o bin $? $@ +/usr/bin/packit: packit.sh + install -m 755 -c -o bin $? $@ + /usr/bin/packme: packme.sh install -m 755 -c -o bin $? $@ diff --git a/commands/scripts/binpackage.sh b/commands/scripts/binpackage.sh index b57fe5a0f..915e86cca 100644 --- a/commands/scripts/binpackage.sh +++ b/commands/scripts/binpackage.sh @@ -1,5 +1,7 @@ #!/bin/sh +PI=.postinstall + set -e # No trailing slashes in the directory, because we want to base the @@ -37,9 +39,8 @@ then echo "Error: No build script in $dir." fi sh -e build -cd / echo " * Building package" -find / -cnewer $packagestart | grep -v "^$srcdir" | grep -v "^/dev" | grep -v "^/tmp" | grep -v "^/usr/tmp" | grep -v "^/usr/log" | grep -v "^/usr/adm" | grep -v "^/etc/utmp" | grep -v "^/usr/src" | pax -w -d | bzip2 >$tarbz +( if [ -f $PI ]; then echo $PI; fi; find / -cnewer $packagestart | grep -v "^$srcdir" | grep -v "^/dev" | grep -v "^/tmp" | grep -v "^/usr/tmp" | grep -v "^/usr/log" | grep -v "^/usr/adm" | grep -v "^/etc/utmp" | grep -v "^/usr/src" ) | pax -w -d | bzip2 >$tarbz rm -f $packagestart $findlist $tarcmd binsizes normal mv $tarbz $here/$pdir diff --git a/commands/scripts/packit.sh b/commands/scripts/packit.sh new file mode 100644 index 000000000..26acfb743 --- /dev/null +++ b/commands/scripts/packit.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +PI=.postinstall +TMP=/usr/tmp + +if [ "$#" -ne 1 ] +then + echo "Usage: $0 " + exit 1 +fi + +dir=`pwd` +if [ "$1" = "-" ] +then f="" +else f=$dir/$1 +fi + +set -e +cd $TMP +rm -f $PI + +if [ -f $PI ] +then echo "$PI is in $TMP, please remove it first." + exit 1 +fi + +if [ ! -f $f ] +then echo "Couldn't find package $f." + exit 1 +fi + +cat $f | smallbunzip2 | pax -r -p e +if [ -f $PI ] +then + sh -e $PI + rm -f $PI +fi + diff --git a/commands/scripts/packme.sh b/commands/scripts/packme.sh index c84b6d6a1..68f74f95b 100644 --- a/commands/scripts/packme.sh +++ b/commands/scripts/packme.sh @@ -17,7 +17,7 @@ then for package in `isodir "$cddrive" $CDDIR | grep -i '\.tbz'` read y if [ "$y" = y ] then echo "Extracting $CDDIR/$package .." - isoread "$cddrive" $CDDIR/$package | smallbunzip2 | pax -r -p e || echo "Extract failed." + isoread "$cddrive" $CDDIR/$package | packit - fi done fi -- 2.44.0