update the version file in the old location (used for backward compatibility)
[bootcd.git] / build.sh
index 826bdef..f4498be 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -2,9 +2,18 @@
 
 set -e
 
-BOOTCD_VERSION="3.0"
+BOOTCD_VERSION="3.0-beta0.4"
 FULL_VERSION_STRING="PlanetLab BootCD $BOOTCD_VERSION"
 
+# which boot server to contact
+BOOTSERVER='boot.planet-lab.org'
+
+# and on which port (protocol will be https)
+BOOTSERVER_PORT='443'
+
+# finally, what path to request from the server
+BOOTSERVER_PATH='boot/'
+
 SYSLINUX_SRC=sources/syslinux-2.11.tar.bz2
 
 ISO=cd.iso
@@ -14,7 +23,7 @@ ROOT_PASSWD='$1$IdEn2srw$/TfrjZSPUC1xP244YCuIi0'
 
 BOOTCD_YUM_GROUP=BootCD
 
-CDRECORD_FLAGS="-v -dao -blank=fast"
+CDRECORD_FLAGS="-v -dao"
 
 CONF_FILES_DIR=conf_files/
 
@@ -25,7 +34,7 @@ INITRD=$CD_ROOT/usr/isolinux/initrd
 INITRD_MOUNT=`pwd`/rd
 
 # size of the ram disk in MB
-RAMDISK_SIZE=48
+RAMDISK_SIZE=64
 
 # the bytes per inode ratio (the -i value in mkfs.ext2) for the ramdisk
 INITRD_BYTES_PER_INODE=1024
@@ -59,6 +68,20 @@ function build_cdroot()
     echo "install boot cd base rpms"
     yum -c yum.conf --installroot=$CD_ROOT -y groupinstall $BOOTCD_YUM_GROUP
 
+    echo "checking to make sure rpms were installed"
+    packages=`cat yumgroups.xml | grep packagereq | sed 's#<[^<]*>##g'`
+    set +e
+    for package in $packages; do
+       echo "checking for package $package"
+       chroot $CD_ROOT /bin/rpm -qi $package > /dev/null
+       if [[ "$?" -ne 0 ]]; then
+           echo "package $package was not installed in the cd root."
+           echo "make sure it exists in the yum repository."
+           exit 1
+       fi
+    done
+    set -e
+    
     echo "removing unneccessary build files"
     (cd $CD_ROOT/lib/modules && \
        find ./ -type d -name build -maxdepth 2 -exec rm -rf {} \;)
@@ -124,9 +147,26 @@ function build_initrd()
     echo "setup basic networking files"
     cp -f $CONF_FILES_DIR/hosts $CD_ROOT/etc/
 
+    echo "copying sysctl.conf (fix tcp window scaling and broken routers)"
+    cp -f $CONF_FILES_DIR/sysctl.conf $CD_ROOT/etc/
+
     echo "setup default network conf file"
     mkdir -p $CD_ROOT/usr/boot
-    cp -f $CONF_FILES_DIR/default-net.cnf $CD_ROOT/usr/boot
+    cp -f $CONF_FILES_DIR/default-net.cnf $CD_ROOT/usr/boot/
+
+    echo "setup boot server configuration"
+    cp -f $CONF_FILES_DIR/cacert.pem $CD_ROOT/usr/boot/
+    cp -f $CONF_FILES_DIR/pubring.gpg $CD_ROOT/usr/boot/
+    echo "$BOOTSERVER" > $CD_ROOT/usr/boot/boot_server
+    echo "$BOOTSERVER_PORT" > $CD_ROOT/usr/boot/boot_server_port
+    echo "$BOOTSERVER_PATH" > $CD_ROOT/usr/boot/boot_server_path
+
+    echo "copying old boot cd directory bootme (TEMPORARY)"
+    cp -r bootme_old $CD_ROOT/usr/bootme
+    echo "$FULL_VERSION_STRING" > $CD_ROOT/usr/bootme/ID
+
+    echo "forcing lvm to make lvm1 partitions (TEMPORARY)"
+    cp -f $CONF_FILES_DIR/lvm.conf $CD_ROOT/etc/lvm/
 
     echo "copying isolinux configuration files"
     cp -f $CONF_FILES_DIR/isolinux.cfg $CD_ROOT/usr/isolinux/
@@ -134,7 +174,9 @@ function build_initrd()
 
     echo "writing /etc/issue"
     echo "$FULL_VERSION_STRING" > $CD_ROOT/etc/issue
-    echo "Kernel \r on an \m\n" >> $CD_ROOT/etc/issue
+    echo "Kernel \r on an \m" >> $CD_ROOT/etc/issue
+    echo "" >> $CD_ROOT/etc/issue
+    echo "" >> $CD_ROOT/etc/issue
 
     echo "making the isolinux initrd kernel command line match rd size"
     let INITRD_SIZE_KB=$(($RAMDISK_SIZE * 1024))
@@ -143,7 +185,10 @@ function build_initrd()
 
     echo "building pcitable for hardware detection"
     pci_map_file=`find $CD_ROOT/lib/modules/ -name modules.pcimap | head -1`
-    ./scripts/rewrite-pcitable.py $pci_map_file $CD_ROOT/etc/pl_pcitable
+    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
 
     dd if=/dev/zero of=$INITRD bs=1M count=$RAMDISK_SIZE
     mkfs.ext2 -F -m 0 -i $INITRD_BYTES_PER_INODE $INITRD
@@ -151,8 +196,10 @@ function build_initrd()
     mount -o loop,rw $INITRD $INITRD_MOUNT
 
     echo "copy all files except usr to ramdisk"
-    (cd $CD_ROOT && find . -path ./usr -prune -o -print | \
-       cpio -p -d -u $INITRD_MOUNT)
+    pushd .
+    cd $CD_ROOT
+    find . -path ./usr -prune -o -print | cpio -p -d -u $INITRD_MOUNT
+    popd
 
     umount $INITRD_MOUNT
     rmdir $INITRD_MOUNT