From ac71ad109e4fe7bf67cc7aa1bc0bdfe026b59a5b Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Thu, 2 Feb 2006 17:12:16 +0000 Subject: [PATCH] . rotate uses bzip2 instead of gzip . binpackages runs a binpackage batch . easypack does binsizes big first --- commands/scripts/Makefile | 4 ++++ commands/scripts/binpackage.sh | 22 ++++++++++++---------- commands/scripts/binpackages.sh | 13 +++++++++++++ commands/scripts/easypack.sh | 2 ++ commands/scripts/rotate.sh | 10 +++++++--- 5 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 commands/scripts/binpackages.sh diff --git a/commands/scripts/Makefile b/commands/scripts/Makefile index 2b128551b..22cd8f22c 100755 --- a/commands/scripts/Makefile +++ b/commands/scripts/Makefile @@ -17,6 +17,7 @@ usr: \ /usr/bin/bigmake \ /usr/bin/adduser \ /usr/bin/binpackage \ + /usr/bin/binpackages \ /usr/bin/cd \ /usr/bin/[ \ /usr/bin/command \ @@ -86,6 +87,9 @@ clean: /usr/bin/binpackage: binpackage.sh install -m 755 -c -o bin $? $@ +/usr/bin/binpackages: binpackages.sh + install -m 755 -c -o bin $? $@ + /usr/bin/adduser: adduser.sh install -m 755 -c -o bin $? $@ diff --git a/commands/scripts/binpackage.sh b/commands/scripts/binpackage.sh index 71eee8d55..b57fe5a0f 100644 --- a/commands/scripts/binpackage.sh +++ b/commands/scripts/binpackage.sh @@ -2,10 +2,12 @@ set -e -dir=$1 +# No trailing slashes in the directory, because we want to base the +# package filename on it. +dir=`echo "$1" | sed 's/\/*$//'` -if [ $# -lt 1 ] -then echo "Usage: $0 packagedir" +if [ $# -ne 2 ] +then echo "Usage: $0 sourcedir packagedir" exit 1 fi @@ -20,8 +22,10 @@ packagestart=$srcdir/now findlist=$srcdir/findlist tarfile=${dir}.tar tar=$srcdir/$tarfile -targz=$tarfile.gz +tarbz=$tar.bz +pdir="$2" +mkdir $pdir 2>/dev/null || true binsizes big touch $packagestart sleep 1 @@ -32,13 +36,11 @@ then echo "Error: No build script in $dir." exit 1 fi -sh build +sh -e build cd / -echo " * Making file index, writing $targz" -find / -cnewer $packagestart | grep -v "^$srcdir" | grep -v "^/dev" | grep -v "^/tmp" | grep -v "^/usr/tmp" | pax -w -d -z >$targz -echo " * Ok. Cleanup.." +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 rm -f $packagestart $findlist $tarcmd binsizes normal -mv $targz $here -ls -al $here/$targz +mv $tarbz $here/$pdir exit 0 diff --git a/commands/scripts/binpackages.sh b/commands/scripts/binpackages.sh new file mode 100644 index 000000000..a29345b24 --- /dev/null +++ b/commands/scripts/binpackages.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +pdir=Packages + +for d in */build +do + dir="`echo $d | sed 's/\/build$//'`" + if [ ! -f $pdir/$dir.tar.gz ] + then + echo " * $dir" + binpackage $dir $pdir + fi +done diff --git a/commands/scripts/easypack.sh b/commands/scripts/easypack.sh index d8f8ffdf9..8c3a9cf20 100644 --- a/commands/scripts/easypack.sh +++ b/commands/scripts/easypack.sh @@ -95,10 +95,12 @@ do # Check to see if it exists. Don't overwrite unless -o given # It is now unpacked. Build it cd $i + binsizes big if sh build >>$ORIG_DIR/Log 2>&1 then echo Package $i installed else echo Package $i failed to install, see Log fi + binsizes normal # Clean up cd .. diff --git a/commands/scripts/rotate.sh b/commands/scripts/rotate.sh index 2c466fd53..0c446e9eb 100755 --- a/commands/scripts/rotate.sh +++ b/commands/scripts/rotate.sh @@ -1,5 +1,5 @@ #!/bin/sh - +BZIP=/usr/local/bin/bzip2 RM="rm -f" MV="mv -f" @@ -12,6 +12,10 @@ if [ ! -f "$1" ] then exit 1 fi +if [ ! -x "$BZIP" ] +then exit 1 +fi + if [ "$2" -le 0 ] then echo "Keep at least 1 copy please." exit 1 @@ -21,7 +25,7 @@ k="$2" $RM "$1.$k" 2>/dev/null || exit 1 while [ "$k" -ge 2 ] do prev="`expr $k - 1`" - $MV $1.$prev.gz $1.$k.gz 2>/dev/null + $MV $1.$prev.bz $1.$k.bz 2>/dev/null k=$prev done -gzip -c $1 >$1.1.gz && : >$1 +$BZIP -c $1 >$1.1.bz && : >$1 -- 2.44.0