From 274ec1022ec5bdff6bf96503fab6d17ad9d1005a Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Tue, 11 Oct 2011 20:32:07 -0500 Subject: [PATCH 1/2] Add build_usb_boot.sh --- tools/build_usb_boot.sh | 105 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100755 tools/build_usb_boot.sh diff --git a/tools/build_usb_boot.sh b/tools/build_usb_boot.sh new file mode 100755 index 0000000..b4205b7 --- /dev/null +++ b/tools/build_usb_boot.sh @@ -0,0 +1,105 @@ +#!/bin/bash -e +# build_usb_boot.sh - Create a syslinux boot environment +# +# build_usb_boot.sh [-k kernel-version] destdev +# +# Assumes syslinux is installed +# Assumes devstack files are in `pwd`/pxe +# Needs to run as root + +KVER=`uname -r` +if [ "$1" = "-k" ]; then + KVER=$2 + shift;shift +fi + +DEST_DIR=${1:-/tmp/syslinux-boot} +PXEDIR=${PXEDIR:-/var/cache/devstack/pxe} +OPWD=`pwd` +PROGDIR=`dirname $0` + +if [ -b $DEST_DIR ]; then + # We have a block device, install syslinux and mount it + DEST_DEV=$DEST_DIR + DEST_DIR=`mktemp -d mntXXXXXX` + + # Install syslinux on the device + syslinux --install --directory syslinux $DEST_DEV + + mount $DEST_DEV $DEST_DIR +else + # We have a directory (for sanity checking output) + DEST_DEV="" + if [ ! -d $DEST_DIR/syslinux ]; then + mkdir -p $DEST_DIR/syslinux + fi +fi + +# Get some more stuff from syslinux +for i in memdisk menu.c32; do + cp -p /usr/lib/syslinux/$i $DEST_DIR/syslinux +done + +CFG=$DEST_DIR/syslinux/syslinux.cfg +cat >$CFG <>$CFG <>$CFG <>$CFG < Date: Tue, 11 Oct 2011 20:34:07 -0500 Subject: [PATCH 2/2] Cleanups --- tools/build_usb_boot.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/build_usb_boot.sh b/tools/build_usb_boot.sh index b4205b7..ac49848 100755 --- a/tools/build_usb_boot.sh +++ b/tools/build_usb_boot.sh @@ -4,7 +4,6 @@ # build_usb_boot.sh [-k kernel-version] destdev # # Assumes syslinux is installed -# Assumes devstack files are in `pwd`/pxe # Needs to run as root KVER=`uname -r` @@ -95,7 +94,6 @@ cat >>$CFG <