import-to-tftpboot.sh file
The "import-to-tftpboot.sh" script imports a bootnet.img floppy into the /tftpboot directory and
automatically renames the files based on the given name.
#!/bin/sh
TFTPBOOTDIR=/tftpboot
PXELINUXDIR=$TFTPBOOTDIR/pxelinux.cfg
TMPDIR=/tmp
if [ -z "$2" ]; then echo This code will unpack a floppy image from location SOURCE
into /tftpboot and will rename using the specified name; echo Usage: $0 SOURCE
NAME; exit; fi
SOURCE=$1
NAME=$2
# Create pxelinux.cfg directory if it does not exist.
if [ ! -d $PXELINUXDIR ]; then mkdir -p $PXELINUXDIR; fi
copyfiles()
{
# This section copies and renames all files except syslinux.cfg.
FILES=`ls | grep -v syslinux.cfg`
for X in $FILES; do cp -a $X $TFTPBOOTDIR/$NAME-$X; done
# This section copies/renames syslinux.cfg and modifies it to point
# correctly to the other copied/renamed files.
for X in `ls | grep syslinux.cfg`; do
sh <<-EOF > $PXELINUXDIR/$NAME-$X
`echo -ne "cat $X | sed"
for Y in $FILES; do
echo -ne " -e \"s,${Y}$\|${Y}[^=],$NAME-&,g\""
done`
EOF
done
}
# This section attempts to locate the specified files for copying purposes.
if [ -d $SOURCE ]; then
if [ `ls $SOURCE | wc -l` -eq 0 ]; then
# If SOURCE dir is empty, then attempt to mount that dir.
mount | grep $SOURCE ||
{
mount $SOURCE >/dev/null 2>&1 && {
cd $SOURCE
copyfiles
cd /
umount $SOURCE
16
Need help?
Do you have a question about the BL10e - HP ProLiant - 512 MB RAM and is the answer not in the manual?
Questions and answers