#!/bin/sh
#
# Shell script to generate netboot distribution
#
# $Id: makedist,v 1.4 2002/10/03 15:21:01 gkminix Exp $
# We need the bash because of some shell variable substitutions
if [ -z $BASH_VERSION ]; then
echo "$0 requires the GNU bash"
exit 1
fi
# Check if we have to avoid recreating some files
NOCREATE=""
if [ "$1" = "--nocreate" ]; then
NOCREATE="yes"
fi
# Determine the netboot base directory
case "$0" in
*/misc/makedist) ROOTDIR="${0%/misc/makedist}"
;;
*/makedist) ROOTDIR="${0%/makedist}/.."
;;
*) ROOTDIR=".."
;;
esac
if [ ! -d $ROOTDIR -o ! -d $ROOTDIR/misc/config ]; then
echo "$0: unable to determine netboot base directory"
exit 1
fi
cd $ROOTDIR
ROOTDIR=`pwd`
# Check if we have to recreate the binary files
if [ "$NOCREATE" != "yes" ]; then
# Determine current configuration and cleanup
./configure --sysconfdir=/etc --enable-bootrom \
--cache-file=config.cache.tmp
trap "rm -f $ROOTDIR/config.cache.tmp" 0
make realclean
# Restore configuration information
cd $ROOTDIR/misc/config
make all
cd $ROOTDIR
# Make everything
./configure --sysconfdir=/etc --enable-bootrom \
--cache-file=config.cache.tmp
make distrib
# Cleanup at the end
make distclean
fi
# Create the distribution archive
. $ROOTDIR/version
if [ -n "$PATCHLEVEL" -a "$PATCHLEVEL" -gt 0 ]; then
VERSION="$VER_MAJOR.$VER_MINOR.$PATCHLEVEL"
else
VERSION="$VER_MAJOR.$VER_MINOR"
fi
cd $ROOTDIR/..
HOMEDIR=`pwd`
TARFILE="$HOMEDIR/netboot-$VERSION.tar.gz"
NBLINK="netboot-$VERSION"
ln -s netboot $NBLINK
tar --create --gzip --owner=0 --group=0 --numeric-owner --exclude="CVS" \
--dereference --file=$TARFILE $NBLINK
# Create the LSM file
DATE="`date +%m-%d-%Y`"
SIZE="`ls -l -h $TARFILE | cut -c 37-42`"
sed "s/%version%/$VERSION/g;s/%date%/$DATE/g;s/%size%/$SIZE/g" \
$ROOTDIR/misc/netboot.lsm.in >$HOMEDIR/netboot-$VERSION.lsm
syntax highlighted by Code2HTML, v. 0.9.1