All pastes #940576 Raw Edit

Anonymous

public text v1 · immutable
·published 2008-03-13 01:59 UTC
rendered paste body
#!/bin/bash -e

cwd=$(pwd)
if [ "$1" != "" ] ; then
    cd $1
fi

if [ -e *disc1* ] ; then
    name="*disc1*"
elif [ -e *DVD* ] ; then
    name="*DVD*"
elif [ -e *dvd* ] ; then
    name="*dvd*"
else
    echo 'missing disc1'
    exit 1
fi

if [ "$(dirname $(pwd -P))" != "/export/linux" ] ; then
    echo you must be in /export/linux/something for this script to work
    exit 1
fi

THISVERSION=$(basename $(pwd))
tftpdir="/tftpboot/$THISVERSION"
tmpdir=$(mktemp -d /tmp/disc.XXXXXX)

mount -oloop,ro $name $tmpdir
[ -d /tftpboot/$THISVERSION ] || mkdir -p $tftpdir
cp -f $tmpdir/images/pxeboot/{vmlinuz,initrd.img} $tftpdir
umount -d $tmpdir
rmdir $tmpdir

if [ ! -z $SUDO_UID ] ; then
    chown -R $SUDO_UID:ken $tftpdir
fi

cd $cwd

echo "Add the following to /tftpboot/pxelinux.cfg/default."
echo "label $THISVERSION"
echo "    kernel $THISVERSION/vmlinuz"
echo "    append initrd=$THISVERSION/initrd.img"