Merge pull request #65 from dtroyer/5-clean-pxe-boot

Clean build_pxe_boot
This commit is contained in:
Jesse Andrews 2011-10-13 11:36:34 -07:00
commit 71b9e4b9a0
5 changed files with 8 additions and 41 deletions

View file

@ -4,15 +4,8 @@
# build_pxe_boot.sh [-k kernel-version] destdir # build_pxe_boot.sh [-k kernel-version] destdir
# #
# Assumes syslinux is installed # Assumes syslinux is installed
# Assumes devstack files are in `pwd`/pxe
# Only needs to run as root if the destdir permissions require it # Only needs to run as root if the destdir permissions require it
UBUNTU_MIRROR=http://archive.ubuntu.com/ubuntu/dists/natty/main/installer-amd64/current/images/netboot/ubuntu-installer/amd64
MEMTEST_VER=4.10
MEMTEST_BIN=memtest86+-${MEMTEST_VER}.bin
MEMTEST_URL=http://www.memtest.org/download/${MEMTEST_VER}/
KVER=`uname -r` KVER=`uname -r`
if [ "$1" = "-k" ]; then if [ "$1" = "-k" ]; then
KVER=$2 KVER=$2
@ -30,8 +23,8 @@ for i in memdisk menu.c32 pxelinux.0; do
cp -p /usr/lib/syslinux/$i $DEST_DIR cp -p /usr/lib/syslinux/$i $DEST_DIR
done done
DEFAULT=$DEST_DIR/pxelinux.cfg/default CFG=$DEST_DIR/pxelinux.cfg/default
cat >$DEFAULT <<EOF cat >$CFG <<EOF
default menu.c32 default menu.c32
prompt 0 prompt 0
timeout 0 timeout 0
@ -56,10 +49,10 @@ fi
cp -p $PXEDIR/vmlinuz-${KVER} $DEST_DIR/ubuntu cp -p $PXEDIR/vmlinuz-${KVER} $DEST_DIR/ubuntu
if [ ! -r $PXEDIR/stack-initrd.gz ]; then if [ ! -r $PXEDIR/stack-initrd.gz ]; then
cd $OPWD cd $OPWD
sudo $PROGDIR/build_pxe_ramdisk.sh $PXEDIR/stack-initrd.gz sudo $PROGDIR/build_ramdisk.sh $PXEDIR/stack-initrd.gz
fi fi
cp -p $PXEDIR/stack-initrd.gz $DEST_DIR/ubuntu cp -p $PXEDIR/stack-initrd.gz $DEST_DIR/ubuntu
cat >>$DEFAULT <<EOF cat >>$CFG <<EOF
LABEL devstack LABEL devstack
MENU LABEL ^devstack MENU LABEL ^devstack
@ -69,48 +62,21 @@ LABEL devstack
EOF EOF
# Get Ubuntu # Get Ubuntu
if [ -d $PXEDIR ]; then if [ -d $PXEDIR -a -r $PXEDIR/natty-base-initrd.gz ]; then
cp -p $PXEDIR/natty-base-initrd.gz $DEST_DIR/ubuntu cp -p $PXEDIR/natty-base-initrd.gz $DEST_DIR/ubuntu
fi cat >>$CFG <<EOF
cat >>$DEFAULT <<EOF
LABEL ubuntu LABEL ubuntu
MENU LABEL ^Ubuntu Natty MENU LABEL ^Ubuntu Natty
KERNEL ubuntu/vmlinuz-$KVER KERNEL ubuntu/vmlinuz-$KVER
APPEND initrd=ubuntu/natty-base-initrd.gz ramdisk_size=419600 root=/dev/ram0 APPEND initrd=ubuntu/natty-base-initrd.gz ramdisk_size=419600 root=/dev/ram0
EOF EOF
# Get Memtest
cd $DEST_DIR
if [ ! -r $MEMTEST_BIN ]; then
wget -N --quiet ${MEMTEST_URL}/${MEMTEST_BIN}.gz
gunzip $MEMTEST_BIN
fi fi
cat >>$DEFAULT <<EOF
LABEL memtest
MENU LABEL ^Memtest86+
KERNEL $MEMTEST_BIN
EOF
# Get FreeDOS
mkdir -p $DEST_DIR/freedos
cd $DEST_DIR/freedos
wget -N --quiet http://www.fdos.org/bootdisks/autogen/FDSTD.288.gz
gunzip -f FDSTD.288.gz
cat >>$DEFAULT <<EOF
LABEL freedos
MENU LABEL ^FreeDOS bootdisk
KERNEL memdisk
APPEND initrd=freedos/FDSTD.288
EOF
# Local disk boot # Local disk boot
cat >>$DEFAULT <<EOF cat >>$CFG <<EOF
LABEL local LABEL local
MENU LABEL ^Local disk MENU LABEL ^Local disk
MENU DEFAULT
LOCALBOOT 0 LOCALBOOT 0
EOF EOF

View file

@ -1,4 +1,5 @@
#!/bin/bash #!/bin/bash
# build_ramdisk.sh - Build RAM disk images
if [ ! "$#" -eq "1" ]; then if [ ! "$#" -eq "1" ]; then
echo "$0 builds a gziped natty openstack install" echo "$0 builds a gziped natty openstack install"