if [ -z "$SLACKWARE" -o ! -d "$SLACKWARE" ] ; then
echo "Point this script at your toplevel slackware-\$VERSION directory."
echo
echo "IE: \"$(basename $0) /pub/mirrors/slackware/slackware-12.1/\""
exit 1
fi
# clean up old template
rm -rf $TMP/tftpboot/
mkdir -p $TMP/tftpboot/pxelinux.cfg/
cd $SLACKWARE/
# we'll do the following in stages in case the user points this script
# at a non-slackware directory.
if [ ! -z "$(ls kernels/*/bzImage 2> /dev/null)" ] ; then
for FILE in kernels/*/bzImage ; do
mkdir -p $TMP/tftpboot/$(dirname $FILE)/
ln -s $SLACKWARE/$FILE $TMP/tftpboot/$FILE
done
else
echo "Kernels ($SLACKWARE/kernels/*/bzImage) not found, aborting."
exit 1
fi
if [ ! -z "$(ls isolinux/*.txt 2> /dev/null)" ] ; then
for FILE in isolinux/*.txt ; do
ln -s $SLACKWARE/$FILE $TMP/tftpboot/
done
else
echo "Installer messages ($SLACKWARE/isolinux/*.txt) not found, aborting."
exit 1
fi
if [ -e usb-and-pxe-installers/initrd.img ] ; then
ln -s $SLACKWARE/usb-and-pxe-installers/initrd.img $TMP/tftpboot/
elif [ -e isolinux/initrd.img ] ; then
ln -s $SLACKWARE/isolinux/initrd.img $TMP/tftpboot/
else
echo "Initial ramdisk image ($SLACKWARE/*/initrd.img) not found, aborting."
exit 1
fi
if [ -e usb-and-pxe-installers/pxelinux.cfg_default ] ; then
ln -s $SLACKWARE/usb-and-pxe-installers/pxelinux.cfg_default $TMP/tftpboot/pxelinux.cfg/default
else
echo "Installer config ($SLACKWARE/usb-and-pxe-installers/pxelinux.cfg_default) not found, aborting."
exit 1
fi
if [ ! -z "$(ls */a/syslinux-*.t?z 2> /dev/null)" ] ; then
# ugly hack for older versions of tar that don't have magic for xz
case "$(echo */a/syslinux-*.t?z)" in
*"tbz") COMPRESSOR="bzip2" ;;
*"tgz") COMPRESSOR="gzip" ;;
*"tlz") COMPRESSOR="lzma" ;;
*"txz") COMPRESSOR="xz" ;;
esac
mkdir $TMP/$$/
$COMPRESSOR -dc */a/syslinux-*.t?z | tar xf - -C $TMP/$$/
cp -p $(find $TMP/$$/ -name 'pxelinux.0') $TMP/tftpboot/
rm -rf $TMP/$$/
else
echo "Syslinux package ($SLACKWARE/*/a/syslinux-*.tgz) not found, aborting."
exit 1
fi
echo "$TMP/tftpboot/ was successfully created & populated."
echo
echo "You may wish to \"chown -R root:root $TMP/tftpboot/\" before"
echo "moving it to your preferred location (typically /tftpboot/)."