add default usb system wait period
[bootcd.git] / build.sh
index 03aaa18..7f2a1bf 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -8,9 +8,10 @@ CONFIGURATIONS_DIR=configurations/
 # where built files are stored
 BUILD_DIR=build/
 
-BOOTCD_VERSION="3.0-beta0.4"
-FULL_VERSION_STRING="PlanetLab BootCD $BOOTCD_VERSION"
-
+BOOTCD_VERSION="3.0-beta0.5"
+FULL_VERSION_STRING="PlanetLab BootCD"
+OUTPUT_IMAGE_NAME='PlanetLab-BootCD'
+    
 SYSLINUX_SRC=sources/syslinux-2.11.tar.bz2
 
 BOOTCD_YUM_GROUP=BootCD
@@ -26,6 +27,17 @@ RAMDISK_SIZE=64
 INITRD_BYTES_PER_INODE=1024
 
 
+# make sure the boot manager source is checked out in the same directory
+# as the bootcd_v3 repository
+BOOTMANAGER_DIR=../bootmanager/
+
+if [ ! -d $BOOTMANAGER_DIR ]; then
+    echo "the bootmanager repository needs to be checked out at the same"
+    echo "level as this directory, for the merge_hw_tables.py script"
+    exit
+fi
+
+
 function usage()
 {
     echo "Usage: build.sh <action> [<configuration>]"
@@ -113,6 +125,10 @@ function build_cdroot()
     KERNEL=$CD_ROOT/boot/vmlinuz-*
     mv -f $KERNEL $CD_ROOT/usr/isolinux/kernel
 
+    echo "moving /usr/bin/find and /usr/bin/dirname to /bin"
+    mv $CD_ROOT/usr/bin/find $CD_ROOT/bin/
+    mv $CD_ROOT/usr/bin/dirname $CD_ROOT/bin/
+
     echo "creating version files"
     echo "$FULL_VERSION_STRING" > $CD_ROOT/usr/isolinux/pl_version
     echo "$FULL_VERSION_STRING" > $CD_ROOT/pl_version
@@ -175,6 +191,11 @@ function build_initrd()
     echo "$PRIMARY_SERVER" > $CD_ROOT/usr/bootme/BOOTSERVER_IP
     echo "$PRIMARY_SERVER_PORT" > $CD_ROOT/usr/bootme/BOOTPORT
 
+    echo "copying cacert to old boot cd directory bootme (TEMPORARY)"
+    mkdir -p $CD_ROOT/usr/bootme/cacert/$PRIMARY_SERVER/
+    cp -f $CURRENT_CONFIG_DIR/$PRIMARY_SERVER_CERT \
+       $CD_ROOT/usr/bootme/cacert/$PRIMARY_SERVER/cacert.pem
+
     echo "forcing lvm to make lvm1 partitions (TEMPORARY)"
     cp -f $CONF_FILES_DIR/lvm.conf $CD_ROOT/etc/lvm/
 
@@ -203,8 +224,8 @@ function build_initrd()
     pci_map_file=`find $CD_ROOT/lib/modules/ -name modules.pcimap | head -1`
     module_dep_file=`find $CD_ROOT/lib/modules/ -name modules.dep | head -1`
     pci_table=$CD_ROOT/usr/share/hwdata/pcitable
-    ./scripts/rewrite-pcitable.py $module_dep_file $pci_map_file $pci_table \
-       $CD_ROOT/etc/pl_pcitable
+    $BOOTMANAGER_DIR/source/merge_hw_tables.py \
+       $module_dep_file $pci_map_file $pci_table $CD_ROOT/etc/pl_pcitable
 
     dd if=/dev/zero of=$INITRD bs=1M count=$RAMDISK_SIZE
     mkfs.ext2 -F -m 0 -i $INITRD_BYTES_PER_INODE $INITRD
@@ -266,16 +287,24 @@ if [[ "$1" == "clean" || "$1" == "burn" || "$1" == "build" ]]; then
     . $CURRENT_CONFIG_DIR/configuration
 
     # setup vars for this configuration
+
+    # version string for this build
     if [[ ! -z "$EXTRA_VERSION" ]]; then
-       FULL_VERSION_STRING="$FULL_VERSION_STRING-$EXTRA_VERSION"
+       FULL_VERSION_STRING="$FULL_VERSION_STRING $EXTRA_VERSION"
     fi
+    FULL_VERSION_STRING="$FULL_VERSION_STRING $BOOTCD_VERSION"
 
     # destination image
+    if [[ ! -z "$EXTRA_VERSION" ]]; then
+       OUTPUT_IMAGE_NAME="$OUTPUT_IMAGE_NAME-$EXTRA_VERSION"
+    fi
+    OUTPUT_IMAGE_NAME="$OUTPUT_IMAGE_NAME-$BOOTCD_VERSION"
+
+    # setup build directories
     BUILD_DIR=build/$configuration
     mkdir -p $BUILD_DIR
     ISO=$BUILD_DIR/`echo $OUTPUT_IMAGE_NAME | sed -e "s/%version/$BOOTCD_VERSION/"`.iso
 
-    # built cd root
     CD_ROOT=`pwd`/$BUILD_DIR/cdroot
     mkdir -p $CD_ROOT