Convert to use UEC images
This commit is contained in:
parent
5cc7ebde67
commit
f2a343b00f
1 changed files with 32 additions and 21 deletions
|
@ -1,17 +1,11 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
# build_pxe_boot.sh - Create a PXE boot environment
|
# build_pxe_boot.sh - Create a PXE boot environment
|
||||||
#
|
#
|
||||||
# build_pxe_boot.sh [-k kernel-version] destdir
|
# build_pxe_boot.sh destdir
|
||||||
#
|
#
|
||||||
# Assumes syslinux is installed
|
# Assumes syslinux is installed
|
||||||
# Only needs to run as root if the destdir permissions require it
|
# Only needs to run as root if the destdir permissions require it
|
||||||
|
|
||||||
KVER=`uname -r`
|
|
||||||
if [ "$1" = "-k" ]; then
|
|
||||||
KVER=$2
|
|
||||||
shift;shift
|
|
||||||
fi
|
|
||||||
|
|
||||||
DEST_DIR=${1:-/tmp}/tftpboot
|
DEST_DIR=${1:-/tmp}/tftpboot
|
||||||
PXEDIR=${PXEDIR:-/var/cache/devstack/pxe}
|
PXEDIR=${PXEDIR:-/var/cache/devstack/pxe}
|
||||||
OPWD=`pwd`
|
OPWD=`pwd`
|
||||||
|
@ -20,7 +14,7 @@ PROGDIR=`dirname $0`
|
||||||
mkdir -p $DEST_DIR/pxelinux.cfg
|
mkdir -p $DEST_DIR/pxelinux.cfg
|
||||||
cd $DEST_DIR
|
cd $DEST_DIR
|
||||||
for i in memdisk menu.c32 pxelinux.0; do
|
for i in memdisk menu.c32 pxelinux.0; do
|
||||||
cp -p /usr/lib/syslinux/$i $DEST_DIR
|
cp -pu /usr/lib/syslinux/$i $DEST_DIR
|
||||||
done
|
done
|
||||||
|
|
||||||
CFG=$DEST_DIR/pxelinux.cfg/default
|
CFG=$DEST_DIR/pxelinux.cfg/default
|
||||||
|
@ -38,20 +32,37 @@ mkdir -p $DEST_DIR/ubuntu
|
||||||
if [ ! -d $PXEDIR ]; then
|
if [ ! -d $PXEDIR ]; then
|
||||||
mkdir -p $PXEDIR
|
mkdir -p $PXEDIR
|
||||||
fi
|
fi
|
||||||
if [ ! -r $PXEDIR/vmlinuz-${KVER} ]; then
|
|
||||||
sudo chmod 644 /boot/vmlinuz-${KVER}
|
# Get image into place
|
||||||
if [ ! -r /boot/vmlinuz-${KVER} ]; then
|
if [ ! -r $PXEDIR/stack-initrd.img ]; then
|
||||||
echo "No kernel found"
|
|
||||||
else
|
|
||||||
cp -p /boot/vmlinuz-${KVER} $PXEDIR
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
cp -p $PXEDIR/vmlinuz-${KVER} $DEST_DIR/ubuntu
|
|
||||||
if [ ! -r $PXEDIR/stack-initrd.gz ]; then
|
|
||||||
cd $OPWD
|
cd $OPWD
|
||||||
sudo $PROGDIR/build_ramdisk.sh $PXEDIR/stack-initrd.gz
|
$PROGDIR/build_ramdisk.sh $PXEDIR/stack-initrd.img
|
||||||
fi
|
fi
|
||||||
cp -p $PXEDIR/stack-initrd.gz $DEST_DIR/ubuntu
|
if [ ! -r $PXEDIR/stack-initrd.gz ]; then
|
||||||
|
gzip -1 -c $PXEDIR/stack-initrd.img >$PXEDIR/stack-initrd.gz
|
||||||
|
fi
|
||||||
|
cp -pu $PXEDIR/stack-initrd.gz $DEST_DIR/ubuntu
|
||||||
|
|
||||||
|
if [ ! -r $PXEDIR/vmlinuz-*-generic ]; then
|
||||||
|
MNTDIR=`mktemp -d --tmpdir mntXXXXXXXX`
|
||||||
|
mount -t ext4 -o loop $PXEDIR/stack-initrd.img $MNTDIR
|
||||||
|
|
||||||
|
if [ ! -r $MNTDIR/boot/vmlinuz-*-generic ]; then
|
||||||
|
echo "No kernel found"
|
||||||
|
umount $MNTDIR
|
||||||
|
rmdir $MNTDIR
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
cp -pu $MNTDIR/boot/vmlinuz-*-generic $PXEDIR
|
||||||
|
fi
|
||||||
|
umount $MNTDIR
|
||||||
|
rmdir $MNTDIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get generic kernel version
|
||||||
|
KNAME=`basename $PXEDIR/vmlinuz-*-generic`
|
||||||
|
KVER=${KNAME#vmlinuz-}
|
||||||
|
cp -pu $PXEDIR/vmlinuz-$KVER $DEST_DIR/ubuntu
|
||||||
cat >>$CFG <<EOF
|
cat >>$CFG <<EOF
|
||||||
|
|
||||||
LABEL devstack
|
LABEL devstack
|
||||||
|
@ -63,7 +74,7 @@ EOF
|
||||||
|
|
||||||
# Get Ubuntu
|
# Get Ubuntu
|
||||||
if [ -d $PXEDIR -a -r $PXEDIR/natty-base-initrd.gz ]; then
|
if [ -d $PXEDIR -a -r $PXEDIR/natty-base-initrd.gz ]; then
|
||||||
cp -p $PXEDIR/natty-base-initrd.gz $DEST_DIR/ubuntu
|
cp -pu $PXEDIR/natty-base-initrd.gz $DEST_DIR/ubuntu
|
||||||
cat >>$CFG <<EOF
|
cat >>$CFG <<EOF
|
||||||
|
|
||||||
LABEL ubuntu
|
LABEL ubuntu
|
||||||
|
|
Loading…
Reference in a new issue