2006-01-23 13:22:06 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2006-11-03 15:47:28 +01:00
|
|
|
PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
2006-02-16 16:43:37 +01:00
|
|
|
PI=.postinstall
|
2006-04-04 14:57:48 +02:00
|
|
|
INFO=.minixpackage
|
2006-02-16 16:43:37 +01:00
|
|
|
|
2006-01-23 13:22:06 +01:00
|
|
|
set -e
|
|
|
|
|
2006-02-02 18:12:16 +01:00
|
|
|
# No trailing slashes in the directory, because we want to base the
|
|
|
|
# package filename on it.
|
|
|
|
dir=`echo "$1" | sed 's/\/*$//'`
|
2006-01-23 13:22:06 +01:00
|
|
|
|
2006-02-02 18:12:16 +01:00
|
|
|
if [ $# -ne 2 ]
|
|
|
|
then echo "Usage: $0 sourcedir packagedir"
|
2006-01-27 14:57:18 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2006-01-23 13:22:06 +01:00
|
|
|
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
|
|
|
|
|
2006-01-23 13:22:06 +01:00
|
|
|
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
|
2006-01-23 13:22:06 +01:00
|
|
|
|
2006-02-02 18:12:16 +01:00
|
|
|
mkdir $pdir 2>/dev/null || true
|
2006-03-28 13:28:43 +02:00
|
|
|
binsizes=big
|
|
|
|
rc=$dir/.binpackage
|
|
|
|
if [ -f $rc ]
|
|
|
|
then . $rc
|
|
|
|
fi
|
|
|
|
binsizes $binsizes
|
2010-06-14 22:31:52 +02:00
|
|
|
|
|
|
|
prunedirs="$srcdir dev tmp usr/bigports usr/src usr/tmp usr/log usr/adm usr/run home etc/utmp var/run var/log /var/spool"
|
|
|
|
|
|
|
|
for d in $prunedirs
|
|
|
|
do pruneexpr="$pruneexpr $n -path /$d -prune"
|
|
|
|
n="-o "
|
|
|
|
done
|
|
|
|
|
2006-01-23 13:22:06 +01:00
|
|
|
touch $packagestart
|
|
|
|
sleep 1
|
|
|
|
cd $dir
|
2006-01-27 14:57:18 +01:00
|
|
|
|
2006-03-22 16:08:36 +01:00
|
|
|
if [ ! -f build -a ! -f build.minix ]
|
|
|
|
then echo "Error: No build or build.minix script in $dir."
|
2006-01-27 14:57:18 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2006-03-22 16:08:36 +01:00
|
|
|
if [ -f build.minix ]
|
|
|
|
then sh -e build.minix
|
|
|
|
else sh -e build
|
|
|
|
fi
|
|
|
|
|
2006-02-02 18:12:16 +01:00
|
|
|
echo " * Building package"
|
2006-04-04 14:57:48 +02:00
|
|
|
echo "Minix package $dir built `date`." >$INFO
|
2010-06-14 22:31:52 +02:00
|
|
|
(
|
|
|
|
echo $INFO
|
|
|
|
if [ -f $PI ]
|
|
|
|
then echo $PI
|
|
|
|
fi
|
|
|
|
find / \( $pruneexpr \) -o -cnewer $packagestart -print | fgrep -v /.svn
|
|
|
|
) | pax -w -d | bzip2 >$tarbz
|
2006-01-23 13:22:06 +01:00
|
|
|
rm -f $packagestart $findlist $tarcmd
|
|
|
|
binsizes normal
|
2006-03-17 13:27:20 +01:00
|
|
|
mv $tarbz $pdir
|
2006-01-23 13:22:06 +01:00
|
|
|
exit 0
|