minix/commands/scripts/binpackage.sh

65 lines
1.1 KiB
Bash
Raw Normal View History

#!/bin/sh
PI=.postinstall
set -e
# No trailing slashes in the directory, because we want to base the
# package filename on it.
dir=`echo "$1" | sed 's/\/*$//'`
if [ $# -ne 2 ]
then echo "Usage: $0 sourcedir packagedir"
exit 1
fi
if [ ! -d "$dir" ]
then echo "Error: $dir isn't a directory."
exit 1
fi
here=`pwd`
2006-03-17 13:27:20 +01:00
case "$dir" in
/*) srcdir="$dir" ;;
*) srcdir="$here/$dir" ;;
esac
case $2 in
/*) pdir="$2" ;;
*) pdir="$here/$2" ;;
esac
packagestart=$srcdir/now
findlist=$srcdir/findlist
2006-03-17 13:27:20 +01:00
tar=$srcdir/"`basename ${dir}`".tar
2006-03-22 17:44:45 +01:00
tarbz=$tar.bz2
mkdir $pdir 2>/dev/null || true
binsizes=big
rc=$dir/.binpackage
if [ -f $rc ]
then . $rc
fi
binsizes $binsizes
touch $packagestart
sleep 1
cd $dir
if [ ! -f build -a ! -f build.minix ]
then echo "Error: No build or build.minix script in $dir."
exit 1
fi
if [ -f build.minix ]
then sh -e build.minix
else sh -e build
fi
echo " * Building package"
2006-03-22 20:39:26 +01:00
( if [ -f $PI ]; then echo $PI; fi; find / -cnewer $packagestart | egrep -v "^($srcdir|/(dev|tmp)|/usr/(tmp|log|adm|run)|/etc/utmp|/var/run)" ) | pax -w -d | bzip2 >$tarbz
rm -f $packagestart $findlist $tarcmd
binsizes normal
2006-03-17 13:27:20 +01:00
mv $tarbz $pdir
exit 0