'disconnectedops'.
--- /dev/null
+%define name bootcd
+%define version 3.3
+%define release 2%{?pldistro:.%{pldistro}}%{?date:.%{date}}
+
+Vendor: PlanetLab
+Packager: PlanetLab Central <support@planet-lab.org>
+Distribution: PlanetLab 3.3
+URL: http://cvs.planet-lab.org/cvs/bootcd
+
+Summary: Boot CD
+Name: bootcd
+Version: %{version}
+Release: %{release}
+License: BSD
+Group: System Environment/Base
+Source0: %{name}-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+Requires: dosfstools, mkisofs, gzip
+
+AutoReqProv: no
+%define debug_package %{nil}
+
+%description
+The Boot CD securely boots PlanetLab nodes into an immutable
+environment.
+
+%package planetlab
+Summary: PlanetLab Boot CD
+Group: System Environment/Base
+
+%description planetlab
+The default PlanetLab Boot CD, customized to boot from PlanetLab
+Central servers.
+
+%prep
+%setup -q
+
+%build
+pushd bootcd
+
+# Build the reference image
+./prep.sh -r $([ -f "/etc/fedora-release" ] && awk ' { print $4 } ' /etc/fedora-release || echo 4)
+
+# Build the default configuration (PlanetLab)
+./build.sh
+
+md5sum PlanetLab-BootCD-%{version}.{iso,usb} \
+ >PlanetLab-BootCD-%{version}.md5
+
+popd
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+pushd bootcd
+
+# Install the reference image and build scripts
+install -d -m 755 $RPM_BUILD_ROOT/%{_datadir}/%{name}
+install -m 755 build.sh $RPM_BUILD_ROOT/%{_datadir}/%{name}/
+tar cpf - \
+ build/isofs/bootcd.img \
+ build/isofs/isolinux.bin \
+ build/isofs/kernel \
+ build/passwd \
+ build/version.txt \
+ bootcustom.sh \
+ configurations \
+ syslinux/unix/syslinux | \
+ tar -C $RPM_BUILD_ROOT/%{_datadir}/%{name}/ -xpf -
+
+# Install the default images in the download/ directory
+install -d -m 755 $RPM_BUILD_ROOT/var/www/html/download
+install -m 644 PlanetLab-BootCD-%{version}.* \
+ $RPM_BUILD_ROOT/var/www/html/download/
+
+popd
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+# If run under sudo
+if [ -n "$SUDO_USER" ] ; then
+ # Allow user to delete the build directory
+ chown -h -R $SUDO_USER .
+ # Some temporary cdroot files like /var/empty/sshd and
+ # /usr/bin/sudo get created with non-readable permissions.
+ find . -not -perm +0600 -exec chmod u+rw {} \;
+ # Allow user to delete the built RPM(s)
+ chown -h -R $SUDO_USER %{_rpmdir}/%{_arch}
+fi
+
+%post planetlab
+cat <<EOF
+Remember to GPG sign
+/var/www/html/download/PlanetLab-BootCD-%{version}.{iso,usb} with
+the PlanetLab private key.
+EOF
+
+%files
+%defattr(-,root,root,-)
+%{_datadir}/%{name}
+
+%files planetlab
+%defattr(-,root,root,-)
+/var/www/html/download
+
+%changelog
+* Mon Jan 29 2006 Marc E. Fiuczynski <mef@cs.princeton.edu> -
+- added biginitrd usb image
+
+* Fri Sep 2 2005 Mark Huang <mlhuang@cotton.CS.Princeton.EDU> -
+- Initial build.
+
--- /dev/null
+#!/bin/bash
+
+# purpose : create a node-specific boot image
+
+# NOTE (see also bootcd/build.sh)
+# If you run your own myplc instance, and you dont need to
+# customize the bootcd, you might wish to use bootcd/build.sh
+# with the -f option
+# However cdcustom.sh might turn out useful if
+# (*) you only have an iso or usb image and nothing else
+# (*) or you want to generate several images in a single run
+# (*) or you run myplc rpm, but need to customize the bootcd image,
+# because the myplc rpm does not come with the required sources
+
+# See usage for full details
+
+######## Implementation notes
+# (*) as of may 2007, this script supports both iso and usb images
+# this becomes a bit tricky sometimes
+# in particular the startup is only partially lazy..
+# most names are kept from former version for easier merge
+# (*) in a former release (iso only) it was possible to perform faster by
+# loopback-mounting the generic iso image
+# Unfortunately mkisofs cannot graft a file that already exists on the
+# original tree (so overlay.img cannot be overridden)
+# to make things worse we cannot loopback-mount the cpio-gzipped
+# overlay image either, so all this stuff is way more complicated
+# than it used to be.
+#
+# (*) as of 2006 jun 28 we use a third image named custom.img for
+# overriding files in bootcd.img, which let us use bootcd.img intact
+# and thus notably speeds things up
+#
+######## Logic
+# here is how we do this for ISO
+# for efficiency, we do only once:
+# (*) mount the generic image
+# (*) copy it into a temp dir
+# (*) unzip/unarchive overlay image into another temp dir
+# (*) if required prepare a custom.img
+# then for each node, we
+# (*) insert plnode.txt at the right place if not a default iso
+# (*) rewrap a gzipped/cpio overlay.img, that we push onto the
+# copied iso tree
+# (*) rewrap this into an iso image
+
+# for USB
+# in principle it's simpler here, but for better code factorization we
+# do the same startup thing, but slightly different
+# only once:
+# (*) mount the generic image
+# (*) unzip/unarchive overlay image into another temp dir
+# then for each node, we
+# (*) copy the generic image into the node-dep image
+# (*) loopback mount it (write enabled)
+# (*) insert plnode.txt at the right place,
+# (*) rewrap a gzipped/cpio overlay.img, that we push onto the
+# mounted image
+# (*) unmount
+
+set -e
+COMMANDSH=$(basename $0)
+COMMAND=$(basename $0 .sh)
+REVISION="$Id$"
+
+function usage () {
+
+ echo "Usage: $COMMANDSH [-f] [ -c bootcd-dir] [generic-image|image-dir] node-config [.. node-configs]"
+ echo " Creates a node-specific boot (iso or usb) image"
+ echo "*Options"
+ echo -e " -f\r\t\tForces overwrite of output images"
+ echo -e " -c bootcd-dir\r\t\tis taken as the root of a set of custom bootcd files"
+ echo -e "\t\ti.e. the files under dir take precedence"
+ echo -e "\t\tover the ones in the generic bootcd"
+ echo -e "\t\tThis is available for ISO images only, and is experimental code"
+ echo -e "-C dir\r\t\tlike make -C, performs chdir prior to running anything"
+ echo -e "-O isoname\r\t\tWrite iso output image to isoname. Does not work with"
+ echo -e "\t\tmultiple node-config files."
+ echo "*Arguments"
+ echo -e " generic-image or image-dir\n\r\t\tThe generic image as downloaded from myplc"
+ echo -e "\t\ttypically from http://myplc.domain.org/download/"
+ echo -e "\t\tor, the already mounted or copied contents in a directory."
+ echo -e " node-config(s)\r\t\tnode config files (plnode.txt format)"
+ echo -e " default\r\t\tmentioned instead of a plnode.txt file, for generating"
+ echo -e "\t\ta node-independent iso image when -c is provided"
+ echo -e "\t\tThis is default behaviour when no node-config are provided"
+ echo "*Outputs"
+ echo " node-specific images are named after nodename[-bootcd-dir]"
+ echo " node-independant image is named after bootcd-dir"
+ echo " with extension .iso or .usb accordingly"
+ echo "*Examples"
+ echo "# $COMMANDSH /plc/data/var/www/html/download/Onelab-BootCD-4.0.usb node1.txt node2.txt"
+ echo " Creates node1.usb and node2.usb that are self-contained USB images for both nodes"
+ echo "# $COMMANDSH -c onelab-bootcd /plc/data/var/www/html/download/onelab-BootCD-4.0.iso"
+ echo " Creates onelab-bootcd.iso that has no plnode.txt embedded and that uses"
+ echo " the hw init scripts located under onelab-bootcd/etc/rc.d/init.d/"
+ echo "*Version $REVISION"
+ exit 1
+}
+
+### read config file in a subshell and echoes host_name
+function host_name () {
+ export CONFIG="$1"; shift
+ ( . "$CONFIG" ; echo "${HOST_NAME}.${DOMAIN_NAME}" )
+}
+
+### Globals
+# we set this to iso or usb according to the generic-image provided
+IMAGE_TYPE=
+PLNODE_PATH=/usr/boot
+PLNODE=plnode.txt
+DEFAULT_TARGET=default
+# defined on the command-line
+CUSTOM_DIR=
+## arg-provided generic iso
+ISO_GENERIC=
+# node-dep conf file
+NODE_CONFIG=
+# resulting iso image and log
+NODE_ISO=
+NODE_LOG=
+## mount points and temps
+ISO_MOUNT="/tmp/$COMMAND-$$-mount"
+ISO_ROOT="/tmp/$COMMAND-$$-iso"
+OVERLAY_ROOT="/tmp/$COMMAND-$$-overlay"
+# node-dep cpio/gzip image
+NODE_OVERLAY=
+
+CPIO_OARGS="-oc --quiet"
+CPIO_IARGS="-id --quiet"
+CPIO_PARGS="-pdu --quiet"
+
+# export DEBUG=true
+# for enabling debug messages (set -x)
+
+# export VERBOSE=true for enabling this
+function verbose () {
+ if [ -n "$VERBOSE" ] ; then
+ echo "$@"
+ fi
+ }
+
+function message () { echo -e "$COMMAND : $@" ; }
+function message-n () { echo -en "$COMMAND : $@" ; }
+function message-done () { echo Done ; }
+function error () { echo -e "$COMMAND : ERROR $@ - exiting" ; exit 1 ;}
+
+# lazy startup
+STARTED_UP=
+function startup () {
+
+ trap abort int hup quit err
+ set -e
+
+ [[ -n "$DEBUG" ]] && set -x
+
+ # lazy : run only once
+ if [ -z "$STARTED_UP" ] ; then
+ message "lazy start up"
+
+ ### checking
+ [ ! -f "$ISO_GENERIC" ] && [ ! -d "$ISO_GENERIC" ] && error "Could not find template ISO image"
+ [ -d "$ISO_MOUNT" ] && error "$ISO_MOUNT already exists"
+ [ -d "$ISO_ROOT" ] && [ ! -d "$ISO_GENERIC" ] && error "$ISO_ROOT already exists"
+ [ -d "$OVERLAY_ROOT" ] && error "$OVERLAY_ROOT already exists"
+
+ verbose "Creating temp dirs"
+ mkdir -p "$ISO_MOUNT" "$ISO_ROOT" "$OVERLAY_ROOT"
+
+ if [[ "$IMAGE_TYPE" = "usb" || "$IMAGE_TYPE" = "iso" ]] ; then
+ verbose "Mounting generic ISO $ISO_GENERIC under $ISO_MOUNT"
+ mount -o ro,loop "$ISO_GENERIC" "$ISO_MOUNT"
+ else
+ # the iso_generic name is the directory from which files are available
+ ISO_MOUNT=$ISO_GENERIC
+ fi
+
+ if [[ "$IMAGE_TYPE" = "iso" || "$IMAGE_TYPE" = "dir" ]] ; then
+ ### ISO
+ ### DONT!! use tar for duplication
+ message "Duplicating ISO image in $ISO_ROOT"
+ (cd "$ISO_MOUNT" ; find . | cpio $CPIO_PARGS "$ISO_ROOT" )
+
+ if [ -n "$CUSTOM_DIR" ] ; then
+ [ -d "$CUSTOM_DIR" ] || error "Directory $CUSTOM_DIR not found"
+ prepare_custom_image
+ fi
+ fi
+ ### USB specifics are done unconditionnally, see below
+
+ message "Extracting generic overlay image in $OVERLAY_ROOT"
+ gzip -d -c "$ISO_MOUNT/overlay.img" | ( cd "$OVERLAY_ROOT" ; cpio $CPIO_IARGS )
+
+ STARTED_UP=true
+ fi
+
+ # for USB: do this for every node
+ if [ "$IMAGE_TYPE" = "usb" ] ; then
+ message "Duplicating $ISO_GENERIC into $NODE_ISO"
+ cp "$ISO_GENERIC" "$NODE_ISO"
+ message "Mounting write-enabled"
+ mount -o loop "$NODE_ISO" "$ISO_ROOT"
+ fi
+
+}
+
+function prepare_custom_image () {
+
+ # Cleaning any sequel
+ rm -f custom.img
+ [ -f custom.img ] && error "Could not cleanup custom.img"
+
+ message "WARNING : You are creating *custom* boot CDs"
+
+ message-n "Creating $ISO_ROOT/custom.img"
+ (cd $"CUSTOM_DIR" ; find . | cpio $CPIO_OARGS) | gzip -9 > "$ISO_ROOT"/custom.img
+ message-done
+
+}
+
+function node_cleanup () {
+ verbose "Cleaning node-dependent cpio image"
+ rm -rf "$NODE_OVERLAY"
+
+}
+
+function cleanup () {
+
+ echo "$COMMAND : cleaning up"
+ [[ -n "$DEBUG" ]] && set -x
+
+ verbose "Cleaning overlay image"
+ rm -rf "$OVERLAY_ROOT"
+ verbose "Cleaning ISO image"
+ rm -rf "$ISO_ROOT"
+ verbose "Cleaning node-dep overlay image"
+ rm -f "$NODE_OVERLAY"
+ if [[ "$IMAGE_TYPE" = "iso" || "$IMAGE_TYPE" = "usb" ]]; then
+ verbose "Unmounting $ISO_MOUNT"
+ umount "$ISO_MOUNT" 2> /dev/null
+ rmdir "$ISO_MOUNT"
+ fi
+ exit
+}
+
+function abort () {
+ echo "$COMMAND : Aborting"
+ message "Cleaning $NODE_ISO"
+ rm -f "$NODE_ISO"
+ cleanup
+}
+
+function main () {
+
+ trap abort int hup quit err
+ set -e
+
+ [[ -n "$DEBUG" ]] && set -x
+
+ # accept -b as -c, I am used to it now
+ while getopts "c:b:O:C:fh" opt ; do
+ case "$opt" in
+ c|b)
+# not sure about the status of this, you are warned
+# echo "The custom option in $COMMAND is broken " ; exit 1
+ echo "WARNING : The custom option in $COMMAND is maybe broken "
+ echo -n "You will have been warned, proceed ? "
+ read answer
+ CUSTOM_DIR="$OPTARG" ;;
+ C)
+ cd "$OPTARG" ;;
+ O)
+ NODEOUTPUT="$OPTARG" ;;
+ f)
+ FORCE_OUTPUT=true ;;
+ h|*)
+ usage ;;
+ esac
+ done
+
+ shift $(($OPTIND-1))
+
+ [[ -z "$@" ]] && usage
+ ISO_GENERIC="$1"; shift
+
+ if [[ -z "$@" ]] ; then
+ nodes="$DEFAULT_TARGET"
+ else
+ nodes="$@"
+ fi
+
+ ### getting image type
+ iso="${ISO_GENERIC%.iso}"
+ usb="${ISO_GENERIC%.usb}"
+
+ if [ -d "$ISO_GENERIC" ] ; then
+ IMAGE_TYPE=dir
+ elif [ "$ISO_GENERIC" != "$iso" ] ; then
+ IMAGE_TYPE=iso
+ elif [ "$ISO_GENERIC" != "$usb" ] ; then
+ IMAGE_TYPE=usb
+ else
+ echo "Could not figure type of $ISO_GENERIC -- exiting"
+ exit 1
+ fi
+
+# perform that later (lazily)
+# so that (1st) node-dep checking are done before we bother to unpack
+# startup
+
+ for NODE_CONFIG in $nodes ; do
+
+ if [ "$NODE_CONFIG" = "$DEFAULT_TARGET" ] ; then
+ NODE_DEP=""
+ # default node without customization does not make sense
+ if [ -z "$CUSTOM_DIR" ] ; then
+ message "creating a non-custom node-indep. image refused\n(Would have no effect)"
+ continue
+ else
+ NODENAME="$DEFAULT_TARGET"
+ NODEOUTPUT=$(basename "$CUSTOM_DIR")
+ fi
+ else
+ NODE_DEP=true
+ NODENAME=$(host_name "$NODE_CONFIG")
+ case "$NODENAME" in
+ .*|*.)
+ message "HOST_NAME or DOMAIN_NAME not found in $NODE_CONFIG - skipped"
+ continue ;;
+ esac
+ if [ -z "$NODEOUTPUT" ] ; then
+ if [ -z "$CUSTOM_DIR" ] ; then
+ NODEOUTPUT="$NODENAME"
+ else
+ NODEOUTPUT="${NODENAME}"-$(basename "$CUSTOM_DIR")
+ fi
+ fi
+ fi
+
+ message "$COMMAND : dealing with node $NODENAME"
+
+ if [[ "$IMAGE_TYPE" = "iso" || "$IMAGE_TYPE" = "dir" ]] ; then
+ NODE_ISO="$NODEOUTPUT.iso"
+ NODE_LOG="$NODEOUTPUT-iso.log"
+ else
+ NODE_ISO="$NODEOUTPUT.usb"
+ NODE_LOG="$NODEOUTPUT-usb.log"
+ fi
+
+ ### checking
+ if [ -e "$NODE_ISO" ] ; then
+ if [ -n "$FORCE_OUTPUT" ] ; then
+ message "$NODE_ISO exists, will overwrite (-f)"
+ rm "$NODE_ISO"
+ else
+ message "$NODE_ISO exists, please remove first - skipped" ; continue
+ fi
+ fi
+ if [ -n "$NODE_DEP" -a ! -f "$NODE_CONFIG" ] ; then
+ message "Could not find node-specifig config - skipped" ; continue
+ fi
+
+ startup
+
+ if [ -n "$NODE_DEP" ] ; then
+ verbose "Pushing node config into overlay image"
+ mkdir -p "$OVERLAY_ROOT"/"$PLNODE_PATH"
+ cp "$NODE_CONFIG" "$OVERLAY_ROOT"/"$PLNODE_PATH"/"$PLNODE"
+ else
+ verbose "Cleaning node config for node-indep. image"
+ rm -f "$OVERLAY_ROOT"/"$PLNODE_PATH"/"$PLNODE"
+ fi
+
+ echo "$COMMAND : Creating overlay image for $NODENAME"
+ (cd "$OVERLAY_ROOT" ; find . | cpio $CPIO_OARGS) | gzip -9 > "$ISO_ROOT"/overlay.img
+
+ if [[ "$IMAGE_TYPE" = "iso" || "$IMAGE_TYPE" = "dir" ]] ; then
+ ### ISO
+ message "Refreshing isolinux.cfg"
+ # Calculate ramdisk size (total uncompressed size of both archives)
+
+ ##########
+ # N.B. Thierry Parmentelat - 2006-06-28
+ # the order in which these images need to be mentioned here for
+ # isolinux involved some - not so educated - guesses
+ # as per syslinux source code in syslinux/runkernel.inc, the
+ # config file is parsed left to right, and indeed it's in that
+ # order that the files are loaded right off the CD
+ # This does not tell however, in case a given file is present in
+ # two different images - and that's the very purpose here - which
+ # one will take precedence over the other
+ # I came up with this order on a trial-and-error basis, I would
+ # have preferred to find it described somewhere
+ # Might be worth checking with other versions of syslinux in case
+ # the custom files would turn out to not be taken into account
+ ##########
+
+ if [ -n "$CUSTOM_DIR" ] ; then
+ images="bootcd.img custom.img overlay.img"
+ else
+ images="bootcd.img overlay.img"
+ fi
+
+ ramdisk_size=$(cd "$ISO_ROOT" ; gzip -l $images | tail -1 | awk '{ print $2; }') # bytes
+ # keep safe, provision for cpio's block size
+ ramdisk_size=$(($ramdisk_size / 1024 + 1)) # kilobytes
+
+ initrd_images=$(echo "$images" | sed -e 's/ /,/g')
+ # Write isolinux configuration
+ cat > "$ISO_ROOT"/isolinux.cfg <<EOF
+DEFAULT kernel
+APPEND ramdisk_size=$ramdisk_size initrd=$initrd_images root=/dev/ram0 rw
+DISPLAY pl_version
+PROMPT 0
+TIMEOUT 40
+EOF
+
+ message-n "Writing custom image, log on $NODE_LOG .. "
+ mkisofs -o "$NODE_ISO" -R -allow-leading-dots -J -r -b isolinux.bin \
+ -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \
+ "$ISO_ROOT" > "$NODE_LOG" 2>&1
+ message-done
+
+ else
+ ### USB
+ umount "$NODE_ISO"
+ fi
+ node_cleanup
+
+ message "Image for $NODENAME in $NODE_ISO"
+ done
+
+ cleanup
+
+}
+
+####################
+main "$@"
--- /dev/null
+boot.planet-lab.org
+boot1.planet-lab.org
+boot2.planet-lab.org
+boot3.planet-lab.org
+boot4.planet-lab.org
+boot5.planet-lab.org
+boot6.planet-lab.org
+boot7.planet-lab.org
+boot8.planet-lab.org
+boot9.planet-lab.org
--- /dev/null
+128.232.8.3
--- /dev/null
+PlanetLab BootCD v2.0.3
--- /dev/null
+These are the public certificates for the PlanetLab boot
+servers.
--- /dev/null
+-----BEGIN CERTIFICATE-----
+MIIC7DCCAlWgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBoTELMAkGA1UEBhMCVVMx
+EzARBgNVBAgTCk5ldyBKZXJzZXkxEjAQBgNVBAcTCVByaW5jZXRvbjESMBAGA1UE
+ChMJUGxhbmV0TGFiMRIwEAYDVQQLEwlQbGFuZXRMYWIxGjAYBgNVBAMTEVBsYW5l
+dExhYiBSb290IENBMSUwIwYJKoZIhvcNAQkBFhZzdXBwb3J0QHBsYW5ldC1sYWIu
+b3JnMB4XDTA0MDIyMzE4MTMy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GjAYBgNVBAMTEVBsYW5l
+dExhYiBSb290IENBMSUwIwYJKoZIhvcNAQkBFhZzdXBwb3J0QHBsYW5ldC1sYWIu
+b3JnMB4XDTA0MDIyMzE4NDE0N1oXDTE0MDIyMDE4NDE0N1owgaExCzAJBgNVBAYT
+AlVTMRMwEQYDVQQIEwpOZXcgSmVyc2V5MRIwEAYDVQQHEwlQcmluY2V0b24xEjAQ
+BgNVBAoTCVBsYW5ldExhYjESMBAGA1UECxMJUGxhbmV0TGFiMRowGAYDVQQDExFQ
+bGFuZXRMYWIgUm9vdCBDQTElMCMGCSqGSIb3DQEJARYWc3VwcG9ydEBwbGFuZXQt
+bGFiLm9yZzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA13x0Cccrg8MYoqy9
+WU+x0e0SbJndo+NygIJLVlLz9ovUNZwAJ1ch3gKQrCwNwsAGWHb3oh3Djw99v+IO
+4pySWUCBjIERYpC1EVFSpHlBxpSOVe1bEiqC+maaN4Na0nw3eE9P+ntgDWI52JuV
+dG4PTfPkyg49xYYLUf/JVWzD+n8CAwEAAaMyMDAwDwYDVR0TAQH/BAUwAwEB/zAd
+BgNVHQ4EFgQUyHTdaaMClumg/xlCSL99lXKd9f4wDQYJKoZIhvcNAQEEBQADgYEA
+JXwRi59q0Hb+1P8DhxT+e3BLDqA6OVU5/0+z8AWmuSk18NT6cZqR1UDRnOAcvjNG
+FUs9/czEBKg64R5ppq/mUfIKDZjLofwlBJhFS2f6O0E+kDwbevLsf5WdwAEB2Sgn
++ohps/xW8qcx29GcrztDE/P3XygOpRy8VlKFC65ZP+E=
+-----END CERTIFICATE-----
--- /dev/null
+#!/bin/bash
+#
+# Builds custom BootCD ISO and USB images in the current
+# directory. For backward compatibility, if an old-style static
+# configuration is specified, that configuration file will be parsed
+# instead of the current PLC configuration in
+# /etc/planetlab/plc_config.
+#
+# Aaron Klingaman <alk@absarokasoft.com>
+# Mark Huang <mlhuang@cs.princeton.edu>
+# Copyright (C) 2004-2006 The Trustees of Princeton University
+#
+# $Id: build.sh,v 1.40 2006/07/25 23:51:39 mlhuang Exp $
+#
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+CONFIGURATION=default
+NODE_CONFIGURATION_FILE=
+ALL=0
+
+usage()
+{
+ echo "Usage: build.sh [OPTION]..."
+ echo " -c name (Deprecated) Static configuration to use (default: $CONFIGURATION)"
+ echo " -f planet.cnf Node to customize CD for (default: none)"
+ echo " -a Build all images (default: only base images)"
+ echo " -h This message"
+ exit 1
+}
+
+# Get options
+while getopts "c:f:ah" opt ; do
+ case $opt in
+ c)
+ CONFIGURATION=$OPTARG
+ ;;
+ f)
+ NODE_CONFIGURATION_FILE=$OPTARG
+ ;;
+ a)
+ ALL=1
+ ;;
+ h|*)
+ usage
+ ;;
+ esac
+done
+
+# Do not tolerate errors
+set -e
+
+# Change to our source directory
+srcdir=$(cd $(dirname $0) && pwd -P)
+pushd $srcdir
+
+# Root of the isofs
+isofs=$PWD/build/isofs
+
+# Build reference image if it does not exist. This should only need to
+# be executed once at build time, never at run time.
+if [ ! -f $isofs/bootcd.img ] ; then
+ ./prep.sh
+fi
+
+# build/version.txt written by prep.sh
+BOOTCD_VERSION=$(cat build/version.txt)
+
+if [ -f /etc/planetlab/plc_config ] ; then
+ # Source PLC configuration
+ . /etc/planetlab/plc_config
+fi
+
+### This support for backwards compatibility can be taken out in the
+### future. RC1 based MyPLCs set $PLC_BOOT_SSL_CRT in the plc_config
+### file, but >=RC2 based bootcd assumes that $PLC_BOOT_CA_SSL_CRT is
+### set.
+if [ -z "$PLC_BOOT_CA_SSL_CRT" -a ! -z "$PLC_BOOT_SSL_CRT" ] ; then
+ PLC_BOOT_CA_SSL_CRT=$PLC_BOOT_SSL_CRT
+fi
+
+# If PLC configuration is not valid, try a static configuration
+if [ -z "$PLC_BOOT_CA_SSL_CRT" -a -d configurations/$CONFIGURATION ] ; then
+ # (Deprecated) Source static configuration
+ . configurations/$CONFIGURATION/configuration
+ PLC_NAME="PlanetLab"
+ PLC_MAIL_SUPPORT_ADDRESS="support@planet-lab.org"
+ PLC_WWW_HOST="www.planet-lab.org"
+ PLC_WWW_PORT=80
+ if [ -n "$EXTRA_VERSION" ] ; then
+ BOOTCD_VERSION="$BOOTCD_VERSION $EXTRA_VERSION"
+ fi
+ PLC_BOOT_HOST=$PRIMARY_SERVER
+ PLC_BOOT_SSL_PORT=$PRIMARY_SERVER_PORT
+ PLC_BOOT_CA_SSL_CRT=configurations/$CONFIGURATION/$PRIMARY_SERVER_CERT
+ PLC_ROOT_GPG_KEY_PUB=configurations/$CONFIGURATION/$PRIMARY_SERVER_GPG
+fi
+
+FULL_VERSION_STRING="$PLC_NAME BootCD $BOOTCD_VERSION"
+
+echo "* Building images for $FULL_VERSION_STRING"
+
+# From within a myplc chroot /tmp is too small to build
+# all possible images, whereas /data is part of the host
+# filesystem and usually has sufficient space. What we
+# should do is check whether the expected amount of space
+# is available.
+[ -d /data ] && BUILDTMP=/data || BUILDTMP=/tmp
+
+# Root of the ISO and USB images
+echo "* Populating root filesystem..."
+overlay=$(mktemp -d ${BUILDTMP}/overlay.XXXXXX)
+install -d -m 755 $overlay
+trap "rm -rf $overlay" ERR INT
+
+# Create version files
+echo "* Creating version files"
+
+# Boot Manager compares pl_version in both places to make sure that
+# the right CD is mounted. We used to boot from an initrd and mount
+# the CD on /usr. Now we just run everything out of the initrd.
+for file in $overlay/pl_version $overlay/usr/isolinux/pl_version ; do
+ mkdir -p $(dirname $file)
+ echo "$FULL_VERSION_STRING" >$file
+done
+
+# Install boot server configuration files
+echo "* Installing boot server configuration files"
+
+# We always intended to bring up and support backup boot servers,
+# but never got around to it. Just install the same parameters for
+# both for now.
+for dir in $overlay/usr/boot $overlay/usr/boot/backup ; do
+ install -D -m 644 $PLC_BOOT_CA_SSL_CRT $dir/cacert.pem
+ install -D -m 644 $PLC_ROOT_GPG_KEY_PUB $dir/pubring.gpg
+ echo "$PLC_BOOT_HOST" >$dir/boot_server
+ echo "$PLC_BOOT_SSL_PORT" >$dir/boot_server_port
+ echo "/boot/" >$dir/boot_server_path
+done
+
+# (Deprecated) Install old-style boot server configuration files
+install -D -m 644 $PLC_BOOT_CA_SSL_CRT $overlay/usr/bootme/cacert/$PLC_BOOT_HOST/cacert.pem
+echo "$FULL_VERSION_STRING" >$overlay/usr/bootme/ID
+echo "$PLC_BOOT_HOST" >$overlay/usr/bootme/BOOTSERVER
+echo "$PLC_BOOT_HOST" >$overlay/usr/bootme/BOOTSERVER_IP
+echo "$PLC_BOOT_SSL_PORT" >$overlay/usr/bootme/BOOTPORT
+
+# Generate /etc/issue
+echo "* Generating /etc/issue"
+
+if [ "$PLC_WWW_PORT" = "443" ] ; then
+ PLC_WWW_URL="https://$PLC_WWW_HOST/"
+elif [ "$PLC_WWW_PORT" != "80" ] ; then
+ PLC_WWW_URL="http://$PLC_WWW_HOST:$PLC_WWW_PORT/"
+else
+ PLC_WWW_URL="http://$PLC_WWW_HOST/"
+fi
+
+mkdir -p $overlay/etc
+cat >$overlay/etc/issue <<EOF
+$FULL_VERSION_STRING
+$PLC_NAME Node: \n
+Kernel \r on an \m
+$PLC_WWW_URL
+
+This machine is a node in the $PLC_NAME distributed network. It has
+not fully booted yet. If you have cancelled the boot process at the
+request of $PLC_NAME Support, please follow the instructions provided
+to you. Otherwise, please contact $PLC_MAIL_SUPPORT_ADDRESS.
+
+Console login at this point is restricted to root. Provide the root
+password of the default $PLC_NAME Central administrator account at the
+time that this CD was created.
+
+EOF
+
+# Set root password
+echo "* Setting root password"
+
+if [ -z "$ROOT_PASSWORD" ] ; then
+ # Generate an encrypted password with crypt() if not defined
+ # in a static configuration.
+ ROOT_PASSWORD=$(python <<EOF
+import crypt, random, string
+salt = [random.choice(string.letters + string.digits + "./") for i in range(0,8)]
+print crypt.crypt('$PLC_ROOT_PASSWORD', '\$1\$' + "".join(salt) + '\$')
+EOF
+)
+fi
+
+# build/passwd copied out by prep.sh
+sed -e "s@^root:[^:]*:\(.*\)@root:$ROOT_PASSWORD:\1@" build/passwd \
+ >$overlay/etc/passwd
+
+# Install node configuration file (e.g., if node has no floppy disk or USB slot)
+if [ -f "$NODE_CONFIGURATION_FILE" ] ; then
+ echo "* Installing node configuration file"
+ install -D -m 644 $NODE_CONFIGURATION_FILE $overlay/usr/boot/plnode.txt
+fi
+
+# Pack overlay files into a compressed archive
+echo "* Compressing overlay image"
+(cd $overlay && find . | cpio --quiet -c -o) | gzip -9 >$isofs/overlay.img
+
+rm -rf $overlay
+trap - ERR INT
+
+# Calculate ramdisk size (total uncompressed size of both archives)
+ramdisk_size=$(gzip -l $isofs/bootcd.img $isofs/overlay.img | tail -1 | awk '{ print $2; }') # bytes
+ramdisk_size=$((($ramdisk_size + 1023) / 1024)) # kilobytes
+
+# Write isolinux configuration
+echo "$FULL_VERSION_STRING" >$isofs/pl_version
+cat >$isofs/isolinux.cfg <<EOF
+DEFAULT kernel
+APPEND ramdisk_size=$ramdisk_size initrd=bootcd.img,overlay.img root=/dev/ram0 rw
+DISPLAY pl_version
+PROMPT 0
+TIMEOUT 40
+EOF
+
+# Change back to output directory
+popd
+
+# Create ISO image
+echo "* Creating ISO image"
+iso="$PLC_NAME-BootCD-$BOOTCD_VERSION.iso"
+mkisofs -o "$iso" \
+ -R -allow-leading-dots -J -r \
+ -b isolinux.bin -c boot.cat \
+ -no-emul-boot -boot-load-size 4 -boot-info-table \
+ $isofs
+
+echo "* Creating ISO image with serial line support"
+iso="$PLC_NAME-BootCD-$BOOTCD_VERSION-serial.iso"
+cat >$isofs/isolinux.cfg <<EOF
+SERIAL 0 115200
+PROMPT 0
+TIMEOUT 120
+DISPLAY pl_version
+DEFAULT serial
+LABEL serial
+ KERNEL kernel
+ APPEND ramdisk_size=$ramdisk_size initrd=bootcd.img,overlay.img root=/dev/ram0 rw console=ttyS0,115200n8
+EOF
+mkisofs -o "$iso" \
+ -R -allow-leading-dots -J -r \
+ -b isolinux.bin -c boot.cat \
+ -no-emul-boot -boot-load-size 4 -boot-info-table \
+ $isofs
+
+# Create USB image
+echo -n "* Creating USB image... "
+usb="$PLC_NAME-BootCD-$BOOTCD_VERSION.usb"
+
+# Leave 1 MB of free space on the VFAT filesystem
+mkfs.vfat -C "$usb" $(($(du -sk $isofs | awk '{ print $1; }') + 1024))
+
+# Mount it
+tmp=$(mktemp -d ${BUILDTMP}/bootcd.XXXXXX)
+mount -o loop "$usb" $tmp
+trap "umount $tmp; rm -rf $tmp" ERR INT
+
+# Populate it
+echo -n " populating USB image... "
+(cd $isofs && find . | cpio -p -d -u $tmp/)
+
+# Use syslinux instead of isolinux to make the image bootable
+rm -f $tmp/isolinux.cfg
+cat >$tmp/syslinux.cfg <<EOF
+DEFAULT kernel
+APPEND ramdisk_size=$ramdisk_size initrd=bootcd.img,overlay.img root=/dev/ram0 rw
+DISPLAY pl_version
+PROMPT 0
+TIMEOUT 40
+EOF
+umount $tmp
+rmdir $tmp
+trap - ERR INT
+
+echo "making USB image bootable."
+$srcdir/syslinux/unix/syslinux "$usb"
+
+
+# Create USB image with serial line support
+echo -n "* Creating USB image... "
+usb="$PLC_NAME-BootCD-$BOOTCD_VERSION-serial.usb"
+
+# Leave 1 MB of free space on the VFAT filesystem
+mkfs.vfat -C "$usb" $(($(du -sk $isofs | awk '{ print $1; }') + 1024))
+
+# Mount it
+tmp=$(mktemp -d ${BUILDTMP}/bootcd.XXXXXX)
+mount -o loop "$usb" $tmp
+trap "umount $tmp; rm -rf $tmp" ERR INT
+
+# Populate it
+echo -n " populating USB image... "
+(cd $isofs && find . | cpio -p -d -u $tmp/)
+
+# Use syslinux instead of isolinux to make the image bootable
+rm -f $tmp/isolinux.cfg
+cat >$tmp/syslinux.cfg <<EOF
+SERIAL 0 115200
+PROMPT 0
+TIMEOUT 120
+DISPLAY pl_version
+DEFAULT serial
+LABEL serial
+ KERNEL kernel
+ APPEND ramdisk_size=$ramdisk_size initrd=bootcd.img,overlay.img root=/dev/ram0 rw console=ttyS0,115200n8
+EOF
+
+umount $tmp
+rmdir $tmp
+trap - ERR INT
+
+echo "making USB image with serial line support bootable."
+$srcdir/syslinux/unix/syslinux "$usb"
+
+[ $ALL -eq 0 ] && exit 0
+
+# Setup CRAMFS related support
+echo "* Setting up CRAMFS-based images"
+tmp=$(mktemp -d ${BUILDTMP}/bootcd.XXXXXX)
+cramfs=$(mktemp ${BUILDTMP}/cramfs.XXXXXX)
+trap "$tmp; rm -rf $tmp $cramfs" ERR INT
+pushd $tmp
+gzip -d -c $isofs/bootcd.img | cpio -diu
+gzip -d -c $isofs/overlay.img | cpio -diu
+
+# clean out unnecessary rpm lib
+echo "* clearing var/lib/rpm/*"
+rm -f var/lib/rpm/*
+
+# bootcd requires this directory
+mkdir -p mnt/confdevice
+
+# relocate various directory to /tmp
+rm -rf root
+ln -fs /tmp/root root
+ln -fs /sbin/init linuxrc
+ln -fs /tmp/resolv.conf etc/resolv.conf
+ln -fs /tmp/etc/mtab etc/mtab
+
+# have pl_rsysinit copy over appropriate etc & var directories into /tmp/etc/
+# make /tmp/etc
+echo "* renaming dirs in ./etc"
+pushd etc
+for dir in `find * -type d -prune | grep -v rc.d`; do mv ${dir} ${dir}_o; ln -fs /tmp/etc/${dir} ${dir} ; done
+popd
+
+echo "* renaming dirs in ./var"
+# rename all top-level directories and put in a symlink to /tmp/var
+pushd var
+for dir in `find * -type d -prune`; do mv ${dir} ${dir}_o; ln -fs /tmp/var/${dir} ${dir} ; done
+popd
+
+#overwrite fstab to mount / as cramfs and /tmp as tmpfs
+echo "* Overwriting etc/fstab to use cramfs and tmpfs"
+rm -f ./etc/fstab
+cat >./etc/fstab <<EOF
+/dev/ram0 / cramfs ro 0 0
+none /dev/pts devpts gid=5,mode=620 0 0
+none /proc proc defaults 0 0
+none /sys sysfs defaults 0 0
+EOF
+
+pushd dev
+rm -f console
+mknod console c 5 1
+#for i in 0 1 2 3 4 5 6 7 8; do rm -f ram${i} ; done
+#for i in 0 1 2 3 4 5 6 7 8; do mknod ram${i} b 1 ${i} ; done
+#ln -fs ram1 ram
+#ln -fs ram0 ramdisk
+popd
+
+# update etc/inittab to start with pl_rsysinit
+sed -i 's,pl_sysinit,pl_rsysinit,' etc/inittab
+
+# modify inittab to have a serial console
+echo "T0:23:respawn:/sbin/agetty -L ttyS0 9600 vt100" >> etc/inittab
+# and let root log in
+echo "ttyS0" >> etc/securetty
+
+#calculate the size of /tmp based on the size of /etc & /var + 8MB slack
+etcsize=$(du -s ./etc | awk '{ print $1 }')
+varsize=$(du -s ./etc | awk '{ print $1 }')
+let msize=($vsize+$esize+8192)/1024
+
+
+# generate pl_rsysinit
+cat > etc/rc.d/init.d/pl_rsysinit <<EOF
+#!/bin/sh
+# generated by build.sh
+echo -n "pl_rsysinit: preparing /etc and /var for pl_sysinit..."
+mount -t tmpfs -orw,size=${msize}M,mode=1777 tmpfs /tmp
+mkdir -p /tmp/root
+mkdir -p /tmp/etc
+touch /tmp/etc/resolv.conf
+touch /tmp/etc/mtab
+mkdir -p /tmp/var
+
+# make mtab happy
+echo "tmpfs /tmp tmpfs rw,size=${msize}M,mode=1777 1 1" > /tmp/etc/mtab
+
+# copy over directory contents of all _o directories from /etc and /var
+# /tmp/etc and /tmp/var
+pushd /etc
+for odir in \$(cd /etc && ls -d *_o); do dir=\$(echo \$odir | sed 's,\_o$,,'); (mkdir -p /tmp/etc/\$dir && cd \$odir && find . | cpio -p -d -u /tmp/etc/\$dir); done
+popd
+pushd /var
+for odir in \$(cd /var && ls -d *_o); do dir=\$(echo \$odir | sed 's,\_o$,,'); (mkdir -p /tmp/var/\$dir && cd \$odir && find . | cpio -p -d -u /tmp/var/\$dir); done
+popd
+
+echo "done"
+# hand over to pl_sysinit
+echo "pl_rsysinit: handing over to pl_sysinit"
+/etc/init.d/pl_sysinit
+EOF
+chmod +x etc/rc.d/init.d/pl_rsysinit
+
+popd
+
+chown -R 0.0 $cramfs
+
+#create the cramfs image
+echo "* Creating cramfs image"
+mkfs.cramfs $tmp/ $cramfs
+# Leave 1 MB of free space on the VFAT filesystem
+cramfs_size=$(($(du -sk $cramfs | awk '{ print $1; }')))
+mv $cramfs ${BUILDTMP}/cramfs.img
+rm -rf $tmp
+trap - ERR INT
+
+# Create ISO CRAMFS image
+echo "* Creating ISO CRAMFS-based image"
+iso="$PLC_NAME-BootCD-$BOOTCD_VERSION-cramfs.iso"
+
+tmp=$(mktemp -d ${BUILDTMP}/bootcd.XXXXXX)
+trap "$tmp; rm -rf $tmp" ERR INT
+(cd $isofs && find . | grep -v "\.img$" | cpio -p -d -u $tmp/)
+cat >$tmp/isolinux.cfg <<EOF
+DEFAULT kernel
+APPEND ramdisk_size=$cramfs_size initrd=cramfs.img root=/dev/ram0 ro
+DISPLAY pl_version
+PROMPT 0
+TIMEOUT 40
+EOF
+
+cp ${BUILDTMP}/cramfs.img $tmp
+mkisofs -o "$iso" \
+ -R -allow-leading-dots -J -r \
+ -b isolinux.bin -c boot.cat \
+ -no-emul-boot -boot-load-size 4 -boot-info-table \
+ $tmp
+
+# Create ISO CRAMFS image with serial line support
+echo "* Creating ISO image with cramfs and serial line support"
+cat >$tmp/isolinux.cfg <<EOF
+SERIAL 0 115200
+PROMPT 0
+TIMEOUT 120
+DISPLAY pl_version
+DEFAULT serial
+LABEL serial
+ KERNEL kernel
+ APPEND ramdisk_size=$cramfs_size initrd=cramfs.img root=/dev/ram0 ro console=ttyS0,115200n8
+EOF
+
+iso="$PLC_NAME-BootCD-$BOOTCD_VERSION-cramfs-serial.iso"
+mkisofs -o "$iso" \
+ -R -allow-leading-dots -J -r \
+ -b isolinux.bin -c boot.cat \
+ -no-emul-boot -boot-load-size 4 -boot-info-table \
+ $tmp
+
+rm -rf $tmp
+trap - ERR INT
+
+# Create USB CRAMFS based image
+echo "* Creating USB CRAMFS based image"
+usb="$PLC_NAME-BootCD-$BOOTCD_VERSION-cramfs.usb"
+
+# leave 1MB of space on the USB VFAT
+let vfat_size=${cramfs_size}+2048
+
+# Make VFAT filesystem for USB
+mkfs.vfat -C "$usb" $vfat_size
+
+# Mount it
+tmp=$(mktemp -d ${BUILDTMP}/bootcd.XXXXXX)
+mount -o loop "$usb" $tmp
+trap "umount $tmp; rm -rf $tmp ${BUILDTMP}/cramfs.img" ERR INT
+
+# Populate it
+echo "* Populating USB with overlay images and cramfs"
+(cd $isofs && find . | grep -v "\.img$" | cpio -p -d -u $tmp/)
+cp ${BUILDTMP}/cramfs.img $tmp/
+
+# Use syslinux instead of isolinux to make the image bootable
+cat >$tmp/syslinux.cfg <<EOF
+TIMEOUT 120
+DISPLAY pl_version
+DEFAULT vga
+LABEL vga
+ KERNEL kernel
+ APPEND ramdisk_size=$cramfs_size initrd=cramfs.img root=/dev/ram0 ro
+EOF
+umount $tmp
+rmdir $tmp
+trap - ERR INT
+
+echo "* Making USB CRAMFS based image bootable"
+$srcdir/syslinux/unix/syslinux "$usb"
+
+# Create USB CRAMFS based image w/ serial line support
+echo "* Creating USB CRAMFS based image w/ serial line support"
+usb="$PLC_NAME-BootCD-$BOOTCD_VERSION-cramfs-serial.usb"
+
+# leave 4MB of space on the USB VFAT
+let vfat_size=${cramfs_size}+2048
+
+# Make VFAT filesystem for USB
+mkfs.vfat -C "$usb" $vfat_size
+
+# Mount it
+tmp=$(mktemp -d ${BUILDTMP}/bootcd.XXXXXX)
+mount -o loop "$usb" $tmp
+trap "umount $tmp; rm -rf $tmp ${BUILDTMP}/cramfs.img" ERR INT
+
+# Populate it
+echo "* Populating USB with overlay images and cramfs"
+(cd $isofs && find . | grep -v "\.img$" | cpio -p -d -u $tmp/)
+cp ${BUILDTMP}/cramfs.img $tmp/
+
+# Use syslinux instead of isolinux to make the image bootable
+cat >$tmp/syslinux.cfg <<EOF
+SERIAL 0 9600
+PROMPT 0
+TIMEOUT 120
+DISPLAY pl_version
+DEFAULT serial
+LABEL serial
+ KERNEL kernel
+ APPEND ramdisk_size=$cramfs_size initrd=cramfs.img root=/dev/ram0 ro console=ttyS0,9600n8
+EOF
+umount $tmp
+rmdir $tmp
+trap - ERR INT
+
+echo "* Making USB CRAMFS based image /w serial line support bootable"
+$srcdir/syslinux/unix/syslinux "$usb"
+
+exit 0
--- /dev/null
+#!/bin/bash
+
+# purpose : create a node-specific CD ISO image
+
+# NOTE (see also bootcd/build.sh)
+# If you run your own myplc instance, and you dont need to
+# customize the bootcd, you might wish to use bootcd/build.sh
+# with the -f option
+# However cdcustom.sh might turn out useful if
+# (*) you only have an iso image and nothing else
+# (*) or you want to generate several iso images in a single run
+# (*) or you run myplc rpm, but need to customize the bootcd image,
+# because the myplc rpm does not come with the required sources
+
+# See usage for full details
+
+######## Implementation note
+# in a former release it was possible to perform faster by
+# loopback-mounting the generic iso image
+# Unfortunately mkisofs cannot graft a file that already exists on the
+# original tree (so overlay.img cannot be overridden)
+# to make things worse we cannot loopback-mount the cpio-gzipped
+# overlay image either, so all this stuff is way more complicated
+# than it used to be.
+#
+# as of 2006 jun 28 we use a third image named custom.img for
+# overriding files in bootcd.img, which let us use bootcd.img intact
+# and thus notably speeds things up
+#
+######## Logic
+# here is how we do this
+# for efficiency, we do only once:
+# (*) mount the generic iso
+# (*) copy it into a temp dir
+# (*) unzip/unarchive overlay image into another temp dir
+# (*) if required prepare a custom.img
+# then for each node, we
+# (*) insert plnode.txt at the right place if not a default iso
+# (*) rewrap a gzipped/cpio overlay.img, that we push onto the
+# copied iso tree
+# (*) rewrap this into an iso image
+# and cleanup/umount everything
+
+
+set -e
+COMMANDSH=$(basename $0)
+COMMAND=$(basename $0 .sh)
+REVISION="$Id: cdcustom.sh,v 1.8 2006/06/28 15:01:01 thierry Exp $"
+
+function usage () {
+
+ echo "Usage: $COMMANDSH [-f] [ -c bootcd-dir] generic-iso node-config [.. node-configs]"
+ echo " Creates a node-specific ISO image"
+ echo "*Options"
+ echo -e " -f\r\t\tForces overwrite of output iso images"
+ echo -e " -c bootcd-dir\r\t\tis taken as the root of a set of custom bootcd files"
+ echo -e "\t\ti.e. the files under dir take precedence"
+ echo -e "\t\tover the ones in the generic bootcd"
+ echo "*Arguments"
+ echo -e " generic-iso\r\t\tThe iso image as downloaded from myplc"
+ echo -e "\t\ttypically in /plc/data/var/www/html/download/"
+ echo -e " node-config(s)\r\t\tnode config files (plnode.txt format)"
+ echo -e " default\r\t\tmentioned instead of a plnode.txt file, for generating"
+ echo -e "\t\ta node-independent iso image"
+ echo -e "\t\tThis is defaultbehaviour when no node-config are provided"
+ echo "*Outputs"
+ echo " node-specific iso images are named after nodename[-bootcd-dir].iso"
+ echo " node-independant iso image is named after bootcd-dir.iso"
+ echo "*Examples"
+ echo "# $COMMANDSH -c onelab-bootcd /plc/data/var/www/html/download/onelab-BootCD-3.3.iso"
+ echo " Creates onelab-bootcd.iso that has no plnode.txt embedded and that uses"
+ echo " the hw init scripts located under onelab-bootcd/etc/rc.d/init.d/"
+ echo "# $COMMANDSH /plc/data/var/www/html/download/onelab-BootCD-3.3.iso node1.txt node2.txt"
+ echo " Creates node1.iso and node2.iso that have plnode.txt embedded for these two nodes"
+ echo " and the standard bootcd"
+ echo "*Version $REVISION"
+ exit 1
+}
+
+### read config file in a subshell and echoes host_name
+function host_name () {
+ export CONFIG=$1; shift
+ ( . "$CONFIG" ; echo $HOST_NAME )
+}
+
+### Globals
+PLNODE_PATH=/usr/boot
+PLNODE=plnode.txt
+DEFAULT_TARGET=default
+# defined on the command-line
+CUSTOM_DIR=
+## arg-provided generic iso
+ISO_GENERIC=
+# node-dep conf file
+NODE_CONFIG=
+# resulting iso image and log
+NODE_ISO=
+NODE_LOG=
+## mount points and temps
+ISO_MOUNT=/tmp/$COMMAND-$$-mount
+ISO_ROOT=/tmp/$COMMAND-$$-iso
+OVERLAY_ROOT=/tmp/$COMMAND-$$-overlay
+# node-dep cpio/gzip image
+NODE_OVERLAY=
+
+CPIO_OARGS="-oc --quiet"
+CPIO_IARGS="-id --quiet"
+CPIO_PARGS="-pdu --quiet"
+
+# export DEBUG=true
+# for enabling debug messages (set -x)
+
+# export VERBOSE=true for enabling this
+function verbose () {
+ if [ -n "$VERBOSE" ] ; then
+ echo "$@"
+ fi
+ }
+
+function message () { echo -e "$COMMAND : $@" ; }
+function message-n () { echo -en "$COMMAND : $@" ; }
+function message-done () { echo Done ; }
+function error () { echo -e "$COMMAND : ERROR $@ - exiting" ; exit 1 ;}
+
+# lazy startup
+STARTED_UP=
+function startup () {
+
+ [[ -n "$DEBUG" ]] && set -x
+
+ # lazy : run only once
+ [[ -n "$STARTED_UP" ]] && return
+ message "lazy start up"
+
+ ### checking
+ [ ! -f "$ISO_GENERIC" ] && error "Could not find template ISO image"
+ [ -d "$ISO_MOUNT" ] && error "$ISO_MOUNT already exists"
+ [ -d "$ISO_ROOT" ] && error "$ISO_ROOT already exists"
+ [ -d "$OVERLAY_ROOT" ] && error "$OVERLAY_ROOT already exists"
+
+ verbose "Creating temp dirs"
+ mkdir -p $ISO_MOUNT $ISO_ROOT $OVERLAY_ROOT
+ verbose "Mounting generic ISO $ISO_GENERIC under $ISO_MOUNT"
+ mount -o ro,loop $ISO_GENERIC $ISO_MOUNT
+
+ ### DONT!! use tar for duplication
+ message "Duplicating ISO image in $ISO_ROOT"
+ (cd $ISO_MOUNT ; find . | cpio $CPIO_PARGS $ISO_ROOT )
+
+ message "Extracting generic overlay image in $OVERLAY_ROOT"
+ gzip -d -c "$ISO_ROOT/overlay.img" | ( cd "$OVERLAY_ROOT" ; cpio $CPIO_IARGS )
+
+ if [ -n "$CUSTOM_DIR" ] ; then
+ [ -d "$CUSTOM_DIR" ] || error "Directory $CUSTOM_DIR not found"
+ prepare_custom_image
+ fi
+
+ STARTED_UP=true
+
+}
+
+function prepare_custom_image () {
+
+ # Cleaning any sequel
+ rm -f custom.img
+ [ -f custom.img ] && error "Could not cleanup custom.img"
+
+ message "WARNING : You are creating *custom* boot CDs"
+
+ message-n "Creating $ISO_ROOT/custom.img"
+ (cd $CUSTOM_DIR ; find . | cpio $CPIO_OARGS) | gzip -9 > $ISO_ROOT/custom.img
+ message-done
+
+}
+
+function node_cleanup () {
+ verbose "Cleaning node-dependent cpio image"
+ rm -rf "$NODE_OVERLAY"
+
+}
+
+function cleanup () {
+
+ echo "$COMMAND : cleaning up"
+ [[ -n "$DEBUG" ]] && set -x
+
+ verbose "Cleaning overlay image"
+ rm -rf "$OVERLAY_ROOT"
+ verbose "Cleaning ISO image"
+ rm -rf "$ISO_ROOT"
+ verbose "Cleaning node-dep overlay image"
+ rm -f "$NODE_OVERLAY"
+ verbose "Unmounting $ISO_MOUNT"
+ umount "$ISO_MOUNT" 2> /dev/null
+ rmdir "$ISO_MOUNT"
+ exit
+}
+
+function abort () {
+ echo "$COMMAND : Aborting"
+ message "Cleaning $NODE_ISO"
+ rm -f "$NODE_ISO"
+ cleanup
+}
+
+function main () {
+
+ trap abort int hup quit err
+ set -e
+
+ [[ -n "$DEBUG" ]] && set -x
+
+ # accept -b as -c, I am used to it now
+ while getopts "c:b:fh" opt ; do
+ case $opt in
+ c|b)
+ CUSTOM_DIR=$OPTARG ;;
+ f)
+ FORCE_OUTPUT=true ;;
+ h|*)
+ usage ;;
+ esac
+ done
+
+ shift $(($OPTIND-1))
+
+ [[ -z "$@" ]] && usage
+ ISO_GENERIC=$1; shift
+
+ if [[ -z "$@" ]] ; then
+ nodes="$DEFAULT_TARGET"
+ else
+ nodes="$@"
+ fi
+
+# perform that later (lazily)
+# so that (1st) node-dep checking are done before we bother to unpack
+# startup
+
+ for NODE_CONFIG in $nodes ; do
+
+ if [ "$NODE_CONFIG" = "$DEFAULT_TARGET" ] ; then
+ NODE_DEP=""
+ # default node without customization does not make sense
+ if [ -z "$CUSTOM_DIR" ] ; then
+ message "creating a non-custom node-indep. image refused\n(Would have no effect)"
+ continue
+ else
+ NODENAME=$DEFAULT_TARGET
+ NODEOUTPUT=$(basename $CUSTOM_DIR)
+ fi
+ else
+ NODE_DEP=true
+ NODENAME=$(host_name $NODE_CONFIG)
+ if [ -z "$NODENAME" ] ; then
+ message "HOST_NAME not found in $NODE_CONFIG - skipped"
+ continue
+ fi
+ if [ -z "$CUSTOM_DIR" ] ; then
+ NODEOUTPUT=$NODENAME
+ else
+ NODEOUTPUT=${NODENAME}-$(basename $CUSTOM_DIR)
+ fi
+ fi
+
+ message "$COMMAND : dealing with node $NODENAME"
+
+ NODE_ISO="$NODEOUTPUT.iso"
+ NODE_LOG="$NODEOUTPUT.log"
+
+ ### checking
+ if [ -e "$NODE_ISO" ] ; then
+ if [ -n "$FORCE_OUTPUT" ] ; then
+ message "$NODE_ISO exists, will overwrite (-f)"
+ rm $NODE_ISO
+ else
+ message "$NODE_ISO exists, please remove first - skipped" ; continue
+ fi
+ fi
+ if [ -n "$NODE_DEP" -a ! -f "$NODE_CONFIG" ] ; then
+ message "Could not find node-specifig config - skipped" ; continue
+ fi
+
+ startup
+
+ if [ -n "$NODE_DEP" ] ; then
+ verbose "Pushing node config into overlay image"
+ mkdir -p $OVERLAY_ROOT/$PLNODE_PATH
+ cp "$NODE_CONFIG" $OVERLAY_ROOT/$PLNODE_PATH/$PLNODE
+ else
+ verbose "Cleaning node config for node-indep. image"
+ rm -f $OVERLAY_ROOT/$PLNODE_PATH/$PLNODE
+ fi
+
+ echo "$COMMAND : Creating overlay image for $NODENAME"
+ (cd "$OVERLAY_ROOT" ; find . | cpio $CPIO_OARGS) | gzip -9 > $ISO_ROOT/overlay.img
+
+ message "Refreshing isolinux.cfg"
+ # Calculate ramdisk size (total uncompressed size of both archives)
+
+ ##########
+ # N.B. Thierry Parmentelat - 2006-06-28
+ # the order in which these images need to be mentioned here for
+ # isolinux involved some - not so educated - guesses
+ # as per syslinux source code in syslinux/runkernel.inc, the
+ # config file is parsed left to right, and indeed it's in that
+ # order that the files are loaded right off the CD
+ # This does not tell however, in case a given file is present in
+ # two different images - and that's the very purpose here - which
+ # one will take precedence over the other
+ # I came up with this order on a trial-and-error basis, I would
+ # have preferred to find it described somewhere
+ # Might be worth checking with other versions of syslinux in case
+ # the custom files would turn out to not be taken into account
+ ##########
+
+ if [ -n "$CUSTOM_DIR" ] ; then
+ images="bootcd.img custom.img overlay.img"
+ else
+ images="bootcd.img overlay.img"
+ fi
+
+ ramdisk_size=$(cd $ISO_ROOT ; gzip -l $images | tail -1 | awk '{ print $2; }') # bytes
+ # keep safe, provision for cpio's block size
+ ramdisk_size=$(($ramdisk_size / 1024 + 1)) # kilobytes
+
+ initrd_images=$(echo "$images" | sed -e 's/ /,/g')
+ # Write isolinux configuration
+ cat > $ISO_ROOT/isolinux.cfg <<EOF
+DEFAULT kernel
+APPEND ramdisk_size=$ramdisk_size initrd=$initrd_images root=/dev/ram0 rw
+DISPLAY pl_version
+PROMPT 0
+TIMEOUT 40
+EOF
+
+ message-n "Writing custom image, log on $NODE_LOG .. "
+ mkisofs -o "$NODE_ISO" -R -allow-leading-dots -J -r -b isolinux.bin \
+ -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \
+ "$ISO_ROOT" > "$NODE_LOG" 2>&1
+ message-done
+
+ node_cleanup
+
+ message "CD ISO image for $NODENAME in $NODE_ISO"
+ done
+
+ cleanup
+
+}
+
+####################
+main "$@"
--- /dev/null
+IP_METHOD="dhcp"
+HOST_NAME="planetlabnode"
+DOMAIN_NAME="localhost"
--- /dev/null
+/dev/ram0 / ext2 defaults 1 1
+none /dev/pts devpts gid=5,mode=620 0 0
+none /proc proc defaults 0 0
+none /sys sysfs defaults 0 0
--- /dev/null
+127.0.0.1 localhost.localdomain localhost
--- /dev/null
+id:2:initdefault:
+si:S:sysinit:/etc/init.d/pl_sysinit
+l2:2:bootwait:/etc/init.d/pl_boot
+
+ca::ctrlaltdel:/sbin/shutdown -t3 -r now
+
+u6:6:wait:/bin/umount -a -r
+r6:6:wait:/sbin/shutdown -r -n now
+u0:0:wait:/bin/umount -a -r
+h0:0:wait:/sbin/shutdown -h -n now
+
+1:2345:respawn:/sbin/mingetty --noclear tty1
+2:2345:respawn:/sbin/mingetty --noclear tty2
+3:2345:respawn:/sbin/mingetty --noclear tty3
+4:2345:respawn:/sbin/mingetty --noclear tty4
+5:2345:respawn:/sbin/mingetty --noclear tty5
+6:2345:respawn:/sbin/mingetty --noclear tty6
--- /dev/null
+DEFAULT kernel
+APPEND load_ramdisk=1 prompt_ramdisk=0 ramdisk_size=0 initrd=initrd.gz root=/dev/ram0 rw
+DISPLAY message.txt
+PROMPT 0
+TIMEOUT 40
--- /dev/null
+# This is an example configuration file for the LVM2 system.
+# It contains the default settings that would be used if there was no
+# /etc/lvm/lvm.conf file.
+#
+# Refer to 'man lvm.conf' for further information including the file layout.
+#
+# To put this file in a different directory and override /etc/lvm set
+# the environment variable LVM_SYSTEM_DIR before running the tools.
+
+
+# This section allows you to configure which block devices should
+# be used by the LVM system.
+devices {
+
+ # Where do you want your volume groups to appear ?
+ dir = "/dev"
+
+ # An array of directories that contain the device nodes you wish
+ # to use with LVM2.
+ scan = [ "/dev" ]
+
+ # A filter that tells LVM2 to only use a restricted set of devices.
+ # The filter consists of an array of regular expressions. These
+ # expressions can be delimited by a character of your choice, and
+ # prefixed with either an 'a' (for accept) or 'r' (for reject).
+ # The first expression found to match a device name determines if
+ # the device will be accepted or rejected (ignored). Devices that
+ # don't match any patterns are accepted.
+
+ # Remember to run vgscan after you change this parameter to ensure
+ # that the cache file gets regenerated (see below).
+
+ # By default we accept every block device:
+ filter = [ "a/.*/" ]
+
+ # Exclude the cdrom drive
+ # filter = [ "r|/dev/cdrom|" ]
+
+ # When testing I like to work with just loopback devices:
+ # filter = [ "a/loop/", "r/.*/" ]
+
+ # Or maybe all loops and ide drives except hdc:
+ # filter =[ "a|loop|", "r|/dev/hdc|", "a|/dev/ide|", "r|.*|" ]
+
+ # Use anchors if you want to be really specific
+ # filter = [ "a|^/dev/hda8$|", "r/.*/" ]
+
+ # The results of the filtering are cached on disk to avoid
+ # rescanning dud devices (which can take a very long time). By
+ # default this cache file is hidden in the /etc/lvm directory.
+ # It is safe to delete this file: the tools regenerate it.
+ cache = "/etc/lvm/.cache"
+
+ # You can turn off writing this cache file by setting this to 0.
+ write_cache_state = 1
+
+ # Advanced settings.
+
+ # List of pairs of additional acceptable block device types found
+ # in /proc/devices with maximum (non-zero) number of partitions.
+ # types = [ "fd", 16 ]
+
+ # If sysfs is mounted (2.6 kernels) restrict device scanning to
+ # the block devices it believes are valid.
+ # 1 enables; 0 disables.
+ sysfs_scan = 1
+
+ # By default, LVM2 will ignore devices used as components of
+ # software RAID (md) devices by looking for md superblocks.
+ # 1 enables; 0 disables.
+ md_component_detection = 1
+}
+
+# This section that allows you to configure the nature of the
+# information that LVM2 reports.
+log {
+
+ # Controls the messages sent to stdout or stderr.
+ # There are three levels of verbosity, 3 being the most verbose.
+ verbose = 0
+
+ # Should we send log messages through syslog?
+ # 1 is yes; 0 is no.
+ syslog = 1
+
+ # Should we log error and debug messages to a file?
+ # By default there is no log file.
+ #file = "/var/log/lvm2.log"
+
+ # Should we overwrite the log file each time the program is run?
+ # By default we append.
+ overwrite = 0
+
+ # What level of log messages should we send to the log file and/or syslog?
+ # There are 6 syslog-like log levels currently in use - 2 to 7 inclusive.
+ # 7 is the most verbose (LOG_DEBUG).
+ level = 0
+
+ # Format of output messages
+ # Whether or not (1 or 0) to indent messages according to their severity
+ indent = 1
+
+ # Whether or not (1 or 0) to display the command name on each line output
+ command_names = 0
+
+ # A prefix to use before the message text (but after the command name,
+ # if selected). Default is two spaces, so you can see/grep the severity
+ # of each message.
+ prefix = " "
+
+ # To make the messages look similar to the original LVM tools use:
+ # indent = 0
+ # command_names = 1
+ # prefix = " -- "
+
+ # Set this if you want log messages during activation.
+ # Don't use this in low memory situations (can deadlock).
+ # activation = 0
+}
+
+# Configuration of metadata backups and archiving. In LVM2 when we
+# talk about a 'backup' we mean making a copy of the metadata for the
+# *current* system. The 'archive' contains old metadata configurations.
+# Backups are stored in a human readeable text format.
+backup {
+
+ # Should we maintain a backup of the current metadata configuration ?
+ # Use 1 for Yes; 0 for No.
+ # Think very hard before turning this off!
+ backup = 1
+
+ # Where shall we keep it ?
+ # Remember to back up this directory regularly!
+ backup_dir = "/etc/lvm/backup"
+
+ # Should we maintain an archive of old metadata configurations.
+ # Use 1 for Yes; 0 for No.
+ # On by default. Think very hard before turning this off.
+ archive = 1
+
+ # Where should archived files go ?
+ # Remember to back up this directory regularly!
+ archive_dir = "/etc/lvm/archive"
+
+ # What is the minimum number of archive files you wish to keep ?
+ retain_min = 10
+
+ # What is the minimum time you wish to keep an archive file for ?
+ retain_days = 30
+}
+
+# Settings for the running LVM2 in shell (readline) mode.
+shell {
+
+ # Number of lines of history to store in ~/.lvm_history
+ history_size = 100
+}
+
+
+# Miscellaneous global LVM2 settings
+global {
+
+ # The file creation mask for any files and directories created.
+ # Interpreted as octal if the first digit is zero.
+ umask = 077
+
+ # Allow other users to read the files
+ #umask = 022
+
+ # Enabling test mode means that no changes to the on disk metadata
+ # will be made. Equivalent to having the -t option on every
+ # command. Defaults to off.
+ test = 0
+
+ # Whether or not to communicate with the kernel device-mapper.
+ # Set to 0 if you want to use the tools to manipulate LVM metadata
+ # without activating any logical volumes.
+ # If the device-mapper kernel driver is not present in your kernel
+ # setting this to 0 should suppress the error messages.
+ activation = 1
+
+ # If we can't communicate with device-mapper, should we try running
+ # the LVM1 tools?
+ # This option only applies to 2.4 kernels and is provided to help you
+ # switch between device-mapper kernels and LVM1 kernels.
+ # The LVM1 tools need to be installed with .lvm1 suffices
+ # e.g. vgscan.lvm1 and they will stop working after you start using
+ # the new lvm2 on-disk metadata format.
+ # The default value is set when the tools are built.
+ # fallback_to_lvm1 = 0
+
+ # The default metadata format that commands should use - "lvm1" or "lvm2".
+ # The command line override is -M1 or -M2.
+ # Defaults to "lvm1" if compiled in, else "lvm2".
+ format = "lvm1"
+
+ # Location of proc filesystem
+ proc = "/proc"
+
+ # Type of locking to use. Defaults to file-based locking (1).
+ # Turn locking off by setting to 0 (dangerous: risks metadata corruption
+ # if LVM2 commands get run concurrently).
+ locking_type = 1
+
+ # Local non-LV directory that holds file-based locks while commands are
+ # in progress. A directory like /tmp that may get wiped on reboot is OK.
+ locking_dir = "/var/lock/lvm"
+
+ # Other entries can go here to allow you to load shared libraries
+ # e.g. if support for LVM1 metadata was compiled as a shared library use
+ # format_libraries = "liblvm2format1.so"
+ # Full pathnames can be given.
+
+ # Search this directory first for shared libraries.
+ # library_dir = "/lib"
+}
+
+activation {
+ # Device used in place of missing stripes if activating incomplete volume.
+ # For now, you need to set this up yourself first (e.g. with 'dmsetup')
+ # For example, you could make it return I/O errors using the 'error'
+ # target or make it return zeros.
+ missing_stripe_filler = "/dev/ioerror"
+
+ # Size (in KB) of each copy operation when mirroring
+ mirror_region_size = 512
+
+ # How much stack (in KB) to reserve for use while devices suspended
+ reserved_stack = 256
+
+ # How much memory (in KB) to reserve for use while devices suspended
+ reserved_memory = 8192
+
+ # Nice value used while devices suspended
+ process_priority = -18
+
+ # If volume_list is defined, each LV is only activated if there is a
+ # match against the list.
+ # "vgname" and "vgname/lvname" are matched exactly.
+ # "@tag" matches any tag set in the LV or VG.
+ # "@*" matches if any tag defined on the host is also set in the LV or VG
+ #
+ # volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ]
+}
+
+
+####################
+# Advanced section #
+####################
+
+# Metadata settings
+#
+# metadata {
+ # Default number of copies of metadata to hold on each PV. 0, 1 or 2.
+ # It's best to leave this at 2.
+ # You might want to override it from the command line with 0 or 1
+ # when running pvcreate on new PVs which are to be added to large VGs.
+
+ # pvmetadatacopies = 2
+
+ # Approximate default size of on-disk metadata areas in sectors.
+ # You should increase this if you have large volume groups or
+ # you want to retain a large on-disk history of your metadata changes.
+
+ # pvmetadatasize = 255
+
+ # List of directories holding live copies of text format metadata.
+ # These directories must not be on logical volumes!
+ # It's possible to use LVM2 with a couple of directories here,
+ # preferably on different (non-LV) filesystems, and with no other
+ # on-disk metadata (pvmetadatacopies = 0). Or this can be in
+ # addition to on-disk metadata areas.
+ # The feature was originally added to simplify testing and is not
+ # supported under low memory situations - the machine could lock up.
+ #
+ # Never edit any files in these directories by hand unless you
+ # you are absolutely sure you know what you are doing! Use
+ # the supplied toolset to make changes (e.g. vgcfgrestore).
+
+ # dirs = [ "/etc/lvm/metadata", "/mnt/disk2/lvm/metadata2" ]
+#}
+
+
--- /dev/null
+%_install_langs en_US:en
+%_excludedocs 1
+%__file_context_path /dev/null
--- /dev/null
+include /etc/modprobe.conf.dist
--- /dev/null
+/dev/ram0 / ext2 defaults 1 1
--- /dev/null
+#!/bin/sh
+
+# Run gpg once to create default options
+GNUPGHOME=/root
+export GNUPGHOME
+/usr/bin/gpg --yes 2>/dev/null </dev/null
+
+# if this file is present, cancel the boot (exit this script)
+CANCEL_BOOT_FLAG=/tmp/CANCEL_BOOT
+
+# how many times to fail in attempting to contact primary server
+# before falling back to original. if the backup fails this many times
+# too, then the process is repeated started with the primary server
+ATTEMPTS_BEFORE_BACKUP=3
+
+# where all the configuration files for contacting
+# the boot server are stored
+BOOT_DIR=/usr/boot/
+
+# get the server we are going to be contacting
+BOOT_SERVER=`cat $BOOT_DIR/boot_server`
+BOOT_SERVER_PORT=`cat $BOOT_DIR/boot_server_port`
+
+# the file to request from the boot server
+BOOT_SERVER_PATH=`cat $BOOT_DIR/boot_server_path`
+
+# location of the cacert for this boot server
+BOOT_SERVER_CACERT=$BOOT_DIR/cacert.pem
+
+# location of the gpg key ring to verify scripts
+BOOT_SERVER_GPG_KEYRING=$BOOT_DIR/pubring.gpg
+
+# get the backup server we are going to be contacting
+BACKUP_BOOT_SERVER=`cat $BOOT_DIR/backup/boot_server`
+BACKUP_BOOT_SERVER_PORT=`cat $BOOT_DIR/backup/boot_server_port`
+
+# the file to request from the backup boot server
+BACKUP_BOOT_SERVER_PATH=`cat $BOOT_DIR/backup/boot_server_path`
+
+# location of the cacert for the backup boot server
+BACKUP_BOOT_SERVER_CACERT=$BOOT_DIR/backup/cacert.pem
+
+# location of the gpg key ring for backup server to verify scripts
+BACKUP_BOOT_SERVER_GPG_KEYRING=$BOOT_DIR/backup/pubring.gpg
+
+# location of a file containing this boot cd version
+BOOT_VERSION_FILE=/pl_version
+
+# the locations of the downloaded scripts
+UNVERIFIED_SCRIPT=/tmp/bootscript.gpg
+VERIFIED_SCRIPT=/tmp/bootscript
+
+
+# --------------------------
+
+
+# now, contact the boot server, run the script, and do it over again.
+contact_count=0
+
+# set to one when we are trying to contact backup server
+on_backup_server=0
+
+# start out contacting the primary servers
+CONNECT_BOOT_SERVER=$BOOT_SERVER
+CONNECT_BOOT_SERVER_PORT=$BOOT_SERVER_PORT
+CONNECT_BOOT_SERVER_PATH=$BOOT_SERVER_PATH
+CONNECT_BOOT_SERVER_GPG_KEYRING=$BOOT_SERVER_GPG_KEYRING
+CONNECT_BOOT_SERVER_CACERT=$BOOT_SERVER_CACERT
+
+while : ; do
+
+ if [[ -f $CANCEL_BOOT_FLAG ]]; then
+ echo "pl_boot: got request to cancel boot, exiting"
+ exit 0
+ fi
+
+ if [[ $contact_count -ge $ATTEMPTS_BEFORE_BACKUP ]]; then
+
+ contact_count=0
+
+ if [[ $on_backup_server == 1 ]]; then
+ echo "pl_boot: failed to contact backup server, trying primary."
+
+ on_backup_server=0
+
+ CONNECT_BOOT_SERVER=$BOOT_SERVER
+ CONNECT_BOOT_SERVER_PORT=$BOOT_SERVER_PORT
+ CONNECT_BOOT_SERVER_PATH=$BOOT_SERVER_PATH
+ CONNECT_BOOT_SERVER_GPG_KEYRING=$BOOT_SERVER_GPG_KEYRING
+ CONNECT_BOOT_SERVER_CACERT=$BOOT_SERVER_CACERT
+ else
+ echo "pl_boot: failed to contact primary server, trying backup."
+
+ on_backup_server=1
+
+ CONNECT_BOOT_SERVER=$BACKUP_BOOT_SERVER
+ CONNECT_BOOT_SERVER_PORT=$BACKUP_BOOT_SERVER_PORT
+ CONNECT_BOOT_SERVER_PATH=$BACKUP_BOOT_SERVER_PATH
+ CONNECT_BOOT_SERVER_GPG_KEYRING=$BACKUP_BOOT_SERVER_GPG_KEYRING
+ CONNECT_BOOT_SERVER_CACERT=$BACKUP_BOOT_SERVER_CACERT
+ fi
+ fi
+
+ if [[ $contact_count != 0 ]]; then
+
+ if [[ $on_backup_server == 1 ]]; then
+ echo "pl_boot: attempting to fetch script from backup server in 30s"
+ else
+ echo "pl_boot: attempting to fetch script from primary server in 30s"
+ fi
+ /bin/sleep 30
+ fi
+
+ # assemble the curl transaction
+ CURL_CMD="/usr/bin/curl \
+ --connect-timeout 60 \
+ --max-time 600 \
+ --form version=<$BOOT_VERSION_FILE \
+ --form cmdline=</proc/cmdline \
+ --form uptime=</proc/uptime \
+ --form ifconfig=</tmp/ifconfig \
+ --form nonce=</tmp/nonce \
+ --location \
+ --output $UNVERIFIED_SCRIPT \
+ --sslv3 \
+ --silent \
+ --show-error \
+ --fail \
+ --stderr /tmp/curl_errors \
+ --cacert $CONNECT_BOOT_SERVER_CACERT \
+ https://$CONNECT_BOOT_SERVER:$CONNECT_BOOT_SERVER_PORT/$CONNECT_BOOT_SERVER_PATH"
+
+ # assemble the gpg command line
+ GPG_CMD="/usr/bin/gpg \
+ --no-default-keyring \
+ --keyring $CONNECT_BOOT_SERVER_GPG_KEYRING \
+ --output $VERIFIED_SCRIPT \
+ --always-trust \
+ --decrypt $UNVERIFIED_SCRIPT"
+
+ echo "pl_boot: generating new nonce"
+ /usr/bin/head --bytes=32 /dev/urandom | \
+ /usr/bin/od -tx1 -An --width=32 | \
+ /bin/sed 's/ //g' > /tmp/nonce
+
+ echo "pl_boot: fetching script from boot server $CONNECT_BOOT_SERVER"
+ ((contact_count++))
+ rm -f $UNVERIFIED_SCRIPT
+ $CURL_CMD
+ curl_err=$?
+ if [ $curl_err -ne 0 ]; then
+ echo "pl_boot: curl request failed with error $curl_err:"
+ cat /tmp/curl_errors
+ echo
+ continue
+ fi
+
+ echo "pl_boot: verifying downloaded script"
+ rm -f $VERIFIED_SCRIPT
+ $GPG_CMD 2> /tmp/gpg_errors
+ if [ $? -ne 0 ]; then
+ echo "pl_boot: failed to verify file:"
+ cat /tmp/gpg_errors
+ echo
+ continue
+ fi
+ echo "pl_boot: decrypted and verified script succesfully"
+
+ echo "pl_boot: handing control to download script"
+ rm -f $UNVERIFIED_SCRIPT
+ chmod +x $VERIFIED_SCRIPT
+ $VERIFIED_SCRIPT
+
+ echo "pl_boot: downloaded script has returned"
+done
+
+echo "pl_boot: automatic boot process canceled by user"
--- /dev/null
+#!/bin/sh
+
+pci_table=/etc/pl_pcitable
+
+loaded_module_list=/tmp/loadedmodules
+
+echo "pl_hwinit: loading applicable modules"
+
+echo > $loaded_module_list
+
+# this will contain lines of device_id:vendor_id (no 0x)
+system_devices=$(lspci -n | cut -d " " -f4)
+
+for device in $system_devices; do
+
+ # now vendor_id and device_id are broken apart
+ vendor_id=$(echo $device | cut -d ":" -f1)
+ device_id=$(echo $device | cut -d ":" -f2)
+
+ # either exactly match vendor:device, or a vendor:ffff (let the module
+ # figure out if it can be used for this device), or ffff:device
+ # (not sure if this is legal, but shows up in the pci map)
+ mods=$(grep -i "\($vendor_id:ffff\|$vendor_id:$device_id\|ffff:$device_id\)" \
+ $pci_table | cut -d " " -f1)
+
+ for module in $mods; do
+ if [ -n "$module" ]; then
+ echo "pl_hwinit: found and loading module $module"
+ /sbin/modprobe $module
+ echo $module >> $loaded_module_list
+ fi
+ done
+done
+
+# just in case, look for any modules that are ffff:ffff and load them
+mods=$(grep -i "ffff:ffff" $pci_table | cut -d " " -f1)
+for module in $mods; do
+ if [ -n "$module" ]; then
+ echo "pl_hwinit: found and loading wild module $module"
+ /sbin/modprobe $module
+ fi
+done
+
+# sd_mod won't get loaded automatically
+echo "pl_hwinit: loading sd_mod"
+/sbin/modprobe sd_mod
+
+# load usb_storage to support node conf files on flash disks
+echo "pl_hwinit: loading usb_storage"
+/sbin/modprobe usb_storage
+
+echo "pl_hwinit: loading floppy device driver"
+/sbin/modprobe floppy
+
+# always wait a bit between loading the usb drivers, and checking /sys/
+# for usb devices (this isn't necessarily for waiting for mass storage files,
+# that is done below)
+echo "pl_hwinit: waiting for usb system to initialize."
+/bin/sleep 10s
+
+# sometimes, flash devices take a while to initialize. in fact, the kernel
+# intentionally waits 5 seconds for a device to 'settle'. some take even longer
+# to show up. if there are any mass storage devices on the system, try to
+# delay until they come online, up to a max delay of 30s.
+
+# the way this will be done is to look for files in /sys/devices that are named
+# 'bInterfaceClass', these will be a list of the usb devices on the system, and
+# their primary usb device interface class ids. The base directory these files
+# exist in will be the full path to the /sys/device entry for that device.
+# for each mass storage devices (they have an interface class value of 08),
+# we wait for a new symbolic link named 'driver' to exist in that directory,
+# indicating the kernel loaded a driver for that device.
+
+# usb interface class id for mass storage
+INTERFACE_CLASS_MASS_STORAGE="08"
+
+# how long to wait in seconds before continuing on if devices
+# aren't available
+MAX_USB_WAIT_TIME=30
+
+# low long in seconds to wait between checks
+PER_CHECK_USB_WAIT_TIME=5
+
+
+# find out if the device identified by the /sys dir has a module
+# loaded for it. check for a symlink in the dir named driver.
+function does_device_dir_have_driver()
+{
+ if [[ -h "$1/driver" ]]; then
+ return 1
+ else
+ return 0
+ fi
+}
+
+wait_dev_list=""
+for interface_class_file in `find /sys/devices -name 'bInterfaceClass'`; do
+ interface_class=`cat $interface_class_file`
+ if [[ "$interface_class" == $INTERFACE_CLASS_MASS_STORAGE ]]; then
+ wait_dev_list="$wait_dev_list "`dirname $interface_class_file`
+ fi
+done
+
+if [[ -n "$wait_dev_list" ]]; then
+ echo "pl_hwinit: found USB mass storage device(s). Attempting to wait"
+ echo "pl_hwinit: up to $MAX_USB_WAIT_TIME seconds for them to come online."
+
+ total_wait_time=0
+ success=0
+ while [[ $total_wait_time < $MAX_USB_WAIT_TIME ]]; do
+
+ total_wait_time=$(($total_wait_time+$PER_CHECK_USB_WAIT_TIME))
+
+ echo "pl_hwinit: waiting $PER_CHECK_USB_WAIT_TIME seconds."
+ /bin/sleep $PER_CHECK_USB_WAIT_TIME
+
+ all_devices_online=1
+ for device_dir in $wait_dev_list; do
+ does_device_dir_have_driver $device_dir
+ if [[ "$?" -eq 0 ]]; then
+ all_devices_online=0
+ fi
+ done
+
+ if [[ $all_devices_online -eq 1 ]]; then
+ success=1
+ echo "pl_hwinit: looks like the devices are now online."
+ break;
+ else
+ echo "pl_hwinit: not all devices online yet, waiting..."
+ fi
+ done
+
+ if [[ $success -eq 1 ]]; then
+ echo "pl_hwinit: Succesfully waited for USB mass storage devices"
+ echo "pl_hwinit: to come online."
+ else
+ echo "pl_hwinit: One or more USB mass storage devices did not"
+ echo "pl_hwinit: initialize in time. Continuing anyway."
+ fi
+fi
+
--- /dev/null
+#!/bin/sh
+
+# the name of the floppy based network configuration
+# files (checked first). the name planet.cnf is kept
+# for backward compatibility with old nodes, and only
+# the floppy disk is searched for files with this name.
+# new files are named plnode.txt and can be located on
+# a floppy or usb device or on the cdrom
+OLD_NODE_CONF_NAME=planet.cnf
+NEW_NODE_CONF_NAME=plnode.txt
+
+# one location of cd-based network configuration file
+# (checked if floppy conf file missing and usb
+# configuration file is missing)
+CD_NET_CONF_BOOT=/usr/boot/$NEW_NODE_CONF_NAME
+
+# the other location of cd-based network configuration file
+CD_NET_CONF_ROOT=/usr/$NEW_NODE_CONF_NAME
+
+# if all other network configuration file sources
+# don't exist, fall back to this one (always on the cd)
+FALLBACK_NET_CONF=/usr/boot/default-net.cnf
+
+# a temporary place to hold the old configuration file
+# off of the floppy disk if we find it (so we don't have
+# to remount the floppy later)
+TMP_OLD_FLOPPY_CONF_FILE=/tmp/oldfloppy_planet.cnf
+
+# once a configuration file is found, save it in /tmp
+# (may be used later by boot scripts)
+USED_NET_CONF=/tmp/planet.cnf
+
+# default device to use for contacting PLC if not specified
+# in the configuration file
+DEFAULT_NET_DEV=eth0
+
+# where to store the temporary dhclient conf file
+DHCLIENT_CONF_FILE=/tmp/dhclient.conf
+
+# which fs types we support finding node configuration files on
+# (will be based as a -t parameter to mount)
+NODE_CONF_DEVICE_FS_TYPES="msdos,ext2"
+
+# a temporary place to mount devices that might contain configuration
+# files on
+CONF_DEVICE_MOUNT_POINT=/mnt/confdevice
+/bin/mkdir -p $CONF_DEVICE_MOUNT_POINT
+
+# for some backwards compatibility, save the ifconfig <device>
+# output to this file after everything is online
+IFCONFIG_OUTPUT=/tmp/ifconfig
+
+# set to 1 if the default network configuration was loaded off the cd
+# (no other configuration file found)
+DEFAULT_NET_CONF=0
+
+
+net_init_failed()
+{
+ echo
+ echo "pl_netinit: network initialization failed,"
+ echo "pl_netinit: shutting down machine in two hours"
+ /bin/sleep 2h
+ /sbin/shutdown -h now
+ exit 1
+}
+
+# Function for checking the IP address to see if its sensible.
+check_ip()
+{
+ case "$*" in
+ "" | *[!0-9.]* | *[!0-9]) return 1 ;;
+ esac
+ local IFS=.
+ set -- $*
+ [ $# -eq 4 ] &&
+ [ ${1:-666} -le 255 ] && [ ${2:-666} -le 255 ] &&
+ [ ${3:-666} -le 255 ] && [ ${4:-666} -le 255 ]
+}
+
+# find and parse a node network configuration file. return 0 if not found,
+# return 1 if found and parsed. if this is the case, DEFAULT_NET_CONF will
+# be set to 1. For any found configuration file, $USED_NET_CONF will
+# contain the validated contents
+find_node_config()
+{
+ /bin/rm -f $TMP_OLD_FLOPPY_CONF_FILE 2>&1 > /dev/null
+
+ echo "pl_netinit: looking for node configuration file on floppy"
+
+ /bin/mount -o ro -t $NODE_CONF_DEVICE_FS_TYPES /dev/fd0 \
+ $CONF_DEVICE_MOUNT_POINT 2>&1 > /dev/null
+ if [[ $? -eq 0 ]]; then
+
+ # 1. check for new named file first on the floppy disk
+ if [ -r "$CONF_DEVICE_MOUNT_POINT/$NEW_NODE_CONF_NAME" ]; then
+ echo "pl_netinit: found node configuration file plnode.txt, using"
+
+ conf_file="$CONF_DEVICE_MOUNT_POINT/$NEW_NODE_CONF_NAME"
+ /etc/init.d/pl_validateconf < $conf_file > $USED_NET_CONF
+ /bin/umount $CONF_DEVICE_MOUNT_POINT
+ return 1
+
+ # since we have the floppy mounted already, see if an old file
+ # exists there so we don't have to remount the floppy when we need
+ # to check for an old file on it (later in the order). if it does
+ # just copy it off to a special location
+ elif [ -r "$CONF_DEVICE_MOUNT_POINT/$OLD_NODE_CONF_NAME" ]; then
+ conf_file="$CONF_DEVICE_MOUNT_POINT/$OLD_NODE_CONF_NAME"
+ /bin/cp -f $conf_file $TMP_OLD_FLOPPY_CONF_FILE
+ echo "pl_netinit: found old named configuration file, checking later."
+ else
+ echo "pl_netinit: floppy mounted, but no configuration file."
+ fi
+
+ /bin/umount $CONF_DEVICE_MOUNT_POINT
+ else
+ echo "pl_netinit: no floppy could be mounted, continuing search."
+ fi
+
+ # 2. check for a new named file on removable flash devices (those
+ # that start with sd*, because usb_storage emulates scsi devices).
+ # to prevent checking normal scsi disks, also make sure
+ # /sys/block/<dev>/removable is set to 1
+
+ echo "pl_netinit: looking for node configuration file on flash based devices"
+
+ # make the sd* hd* expansion fail to an empty string if there are no sd
+ # devices
+ shopt -s nullglob
+
+ for device in /sys/block/[hs]d*; do
+ removable=`cat $device/removable`
+ if [[ $removable -ne 1 ]]; then
+ continue
+ fi
+
+ partitions=$(/bin/awk "\$4 ~ /`basename $device`[0-9]*/ { print \$4 }" /proc/partitions)
+ for partition in $partitions ; do
+ check_dev=/dev/$partition
+
+ echo "pl_netinit: looking for node configuration file on device $check_dev"
+ /bin/mount -o ro -t $NODE_CONF_DEVICE_FS_TYPES $check_dev \
+ $CONF_DEVICE_MOUNT_POINT 2>&1 > /dev/null
+ if [[ $? -eq 0 ]]; then
+ if [ -r "$CONF_DEVICE_MOUNT_POINT/$NEW_NODE_CONF_NAME" ]; then
+ echo "pl_netinit: found node configuration file plnode.txt, using"
+
+ conf_file="$CONF_DEVICE_MOUNT_POINT/$NEW_NODE_CONF_NAME"
+ /etc/init.d/pl_validateconf < $conf_file > $USED_NET_CONF
+ echo "pl_netinit: found configuration"
+ /bin/umount $CONF_DEVICE_MOUNT_POINT
+ return 1
+ fi
+
+ echo "pl_netinit: not found"
+
+ /bin/umount $CONF_DEVICE_MOUNT_POINT
+ fi
+ done
+ done
+
+ # normal filename expansion setting
+ shopt -u nullglob
+
+ # 3. see if there is an old file on the floppy disk. if there was,
+ # the file $TMP_OLD_FLOPPY_CONF_FILE will be readable.
+ if [ -r "$TMP_OLD_FLOPPY_CONF_FILE" ]; then
+ echo "pl_netinit: found node configuration file planet.cnf, using"
+
+ conf_file=$TMP_OLD_FLOPPY_CONF_FILE
+ /etc/init.d/pl_validateconf < $conf_file > $USED_NET_CONF
+ return 1
+ fi
+
+
+ # 4. check for plnode.txt on the cd at /usr/boot
+ echo "pl_netinit: looking for network configuration on cd in /usr/boot"
+ if [ -r "$CD_NET_CONF_BOOT" ]; then
+
+ echo "pl_netinit: found cd configuration file, using"
+ /etc/init.d/pl_validateconf < $CD_NET_CONF_BOOT > $USED_NET_CONF
+ return 1
+ fi
+
+
+ # 5. check for plnode.txt on the cd at /usr
+ echo "pl_netinit: looking for network configuration on cd in /usr"
+ if [ -r "$CD_NET_CONF_ROOT" ]; then
+
+ echo "pl_netinit: found cd configuration file, using"
+ /etc/init.d/pl_validateconf < $CD_NET_CONF_ROOT > $USED_NET_CONF
+ return 1
+ fi
+
+
+ # 6. no node configuration file could be found, fall back to
+ # builtin default. this can't be used to install a machine, but
+ # will at least let it download and run the boot manager, which
+ # can inform the users appropriately.
+ echo "pl_netinit: using default network configuration"
+ if [ -r "$FALLBACK_NET_CONF" ]; then
+ echo "pl_netinit: found cd default configuration file, using"
+ /etc/init.d/pl_validateconf < $FALLBACK_NET_CONF > $USED_NET_CONF
+ DEFAULT_NET_CONF=1
+ return 1
+ fi
+
+ return 0
+}
+
+
+echo "pl_netinit: bringing loopback network device up"
+/sbin/ifconfig lo 127.0.0.1 up
+
+find_node_config
+if [ $? -eq 0 ]; then
+ # no network configuration file found. this should not happen as the
+ # default cd image has a backup one. halt.
+ echo "pl_netinit: unable to find even a default network configuration"
+ echo "pl_netinit: file, this cd may be corrupt."
+ net_init_failed
+fi
+
+# load the configuration file. if it was a default one (not user specified),
+# then remove the saved copy from /tmp, but continue on. since a network
+# configuration file is required and boot scripts only know about this location
+# they will fail (as they should) - but the network will be up if dhcp is
+# available
+
+echo "pl_netinit: loading network configuration"
+. $USED_NET_CONF
+
+if [[ $DEFAULT_NET_CONF -eq 1 ]]; then
+ /bin/rm -f $USED_NET_CONF
+fi
+
+# initialize IPMI device
+if [[ -n "$IPMI_ADDRESS" ]] ; then
+ echo -n "pl_netinit: initializing IPMI: "
+ cmd="ipnmac -i $IPMI_ADDRESS"
+ if [[ -n "$IPMI_MAC" ]] ; then
+ cmd="$cmd -m $IPMI_MAC"
+ fi
+ echo $cmd
+ $cmd
+fi
+
+# now, we need to find which device to use (ie, eth0 or eth1). start out
+# by defaulting to eth0, then see if the network configuration file specified
+# either a mac address (in which case we will need to find the device), or
+# the device itself
+
+if [[ -n "$NET_DEVICE" ]]; then
+ # the user specified a mac address we should use. find the network
+ # device for it.
+ NET_DEVICE=$(tr A-Z a-z <<<$NET_DEVICE)
+
+ pushd /sys/class/net
+ for device in *; do
+ dev_address=`cat $device/address | tr A-Z a-z`
+ if [ "$device" == "$NET_DEVICE" -o "$dev_address" == "$NET_DEVICE" ]; then
+ ETH_DEVICE=$device
+ echo "pl_netinit: found device $ETH_DEVICE with mac address $dev_address"
+ break
+ fi
+ done
+ popd
+else
+ ETH_DEVICE=$DEFAULT_NET_DEV
+ echo "pl_netinit: using default device $ETH_DEVICE"
+
+fi
+
+
+# if we couldn't find a device (would happen if NET_DEVICE was specified
+# but we couldn't find a device for that addresS), then abort the rest
+# of the startup
+
+if [[ -z "$ETH_DEVICE" ]]; then
+ echo "pl_netinit: unable to find a usable device, check to make sure"
+ echo "pl_netinit: the NET_DEVICE field in the configuration file"
+ echo "pl_netinit: cooresponds with a network adapter on this system"
+ net_init_failed
+fi
+
+
+# actually check to make sure ifconfig <device> succeeds
+/sbin/ifconfig $ETH_DEVICE up 2>&1 > /dev/null
+if [[ $? -ne 0 ]]; then
+ echo "pl_netinit: device $ETH_DEVICE does not exist, most likely"
+ echo "pl_netinit: this cd does not have hardware support for your"
+ echo "pl_netinit: network adapter. please send the following lines"
+ echo "pl_netinit: to PlanetLab Support: support@planet-lab.org"
+ echo "pl_netinit: for further assistance"
+ echo
+ /sbin/lspci -n | /bin/grep "Class 0200"
+ echo
+
+ net_init_failed
+fi
+
+if [[ "$IP_METHOD" == "dhcp" ]]; then
+ echo "pl_netinit: attempting to bring up device with dhcp"
+
+ # setup a dhclient conf file for this device (used to send
+ # our hostname to the dhcp server)
+ echo "interface \"$ETH_DEVICE\" {" > $DHCLIENT_CONF_FILE
+ echo "send host-name \"$HOST_NAME.$DOMAIN_NAME\";" >> $DHCLIENT_CONF_FILE
+ echo "}" >> $DHCLIENT_CONF_FILE
+
+ # touch the redhat net device configuration file so
+ # dhclient doesn't complain
+ /bin/touch /etc/sysconfig/network-scripts/ifcfg-$ETH_DEVICE
+
+ configured=0
+ while [[ $configured -eq 0 ]]; do
+ /sbin/dhclient -1 -cf $DHCLIENT_CONF_FILE $ETH_DEVICE
+ if [[ $? -ne 0 ]]; then
+ echo "pl_netinit: dhcp failed, retrying in 2 minutes"
+ /bin/sleep 120
+ else
+ echo "pl_netinit: dhcp succeeded"
+ configured=1
+ break
+ fi
+ done
+else
+ echo "pl_netinit: configuring device statically"
+
+ /sbin/ifconfig $ETH_DEVICE $IP_ADDRESS broadcast $IP_BROADCASTADDR \
+ netmask $IP_NETMASK
+ /sbin/route add default gw $IP_GATEWAY dev $ETH_DEVICE
+ /bin/hostname "$HOST_NAME.$DOMAIN_NAME"
+
+ if [[ -z "$IP_DNS1" ]]; then
+ echo "pl_netinit: no dns server specified, cannot continue."
+ net_init_failed
+ fi
+
+ echo "nameserver $IP_DNS1" > /etc/resolv.conf
+ if [[ -n "$IP_DNS2" ]]; then
+ echo "nameserver $IP_DNS2" >> /etc/resolv.conf
+ fi
+fi
+
+# for backwards compatibility
+/sbin/ifconfig $ETH_DEVICE > $IFCONFIG_OUTPUT
+
+echo "pl_netinit: network online"
+
--- /dev/null
+#!/bin/sh
+
+echo "pl_sysinit: bringing system online"
+
+echo "pl_sysinit: mounting file systems"
+/bin/mount -v -a
+
+echo "pl_sysinit: starting udevd"
+[ -x /sbin/start_udev ] && /sbin/start_udev
+
+echo "pl_sysinit: invoking hardware initialization script"
+/etc/init.d/pl_hwinit
+
+check_initrd()
+{
+ _mounted=0
+ if [ -f /usr/isolinux/pl_version ] ; then
+ # it mounted, but we should probably make sure its our boot cd
+ # this can be done by making sure the /pl_version file (on initrd)
+ # matches /usr/isolinux/pl_version
+ initrd_version=$(/bin/cat /pl_version)
+ cd_version=$(/bin/cat /usr/isolinux/pl_version)
+ if [ "$initrd_version" == "$cd_version" ]; then
+ _mounted=1
+ fi
+ fi
+ return $_mounted
+}
+
+check_block_devices()
+{
+ _mounted=0
+ # so that * expands to empty string if there are no block devices
+ shopt -s nullglob
+
+ for device in /sys/block/*; do
+ device=$(/bin/basename $device)
+
+ # skipping any devices that start with md or ra (ram) or lo
+ # (loop) or fd (floppy)
+
+ start_device=${device:0:2}
+ if [ "$start_device" == "ra" ] || [ "$start_device" == "md" ] ||
+ [ "$start_device" == "lo" ] || [ "$start_device" == "fd" ]; then
+ continue
+ fi
+
+ # If this is a removable (e.g., USB flash) device, then try to
+ # look for an ISO image on each of its partitions.
+ if [ "$(cat /sys/block/$device/removable)" = "1" ] ; then
+ partitions=$(/bin/awk "\$4 ~ /${device}[0-9]*/ { print \$4 }" /proc/partitions)
+ for partition in $partitions ; do
+ echo "pl_sysinit: checking $partition for iso image"
+ mkdir -p /tmp/$partition
+ if /bin/mount -o ro -t msdos,ext2 /dev/$partition /tmp/$partition 2>&1 > /dev/null ; then
+ # Look for the first ISO image
+ for iso in /tmp/$partition/*.iso ; do
+ if /sbin/losetup /dev/loop0 $iso ; then
+ echo "pl_sysinit: using $(basename $iso) on $partition"
+ device="loop0"
+ break
+ fi
+ done
+ if [ "$device" != "loop0" ] ; then
+ /bin/umount /tmp/$partition 2>&1 > /dev/null
+ fi
+ fi
+ done
+ fi
+
+ echo "pl_sysinit: checking $device for /usr contents"
+ /bin/mount -o ro -t iso9660 /dev/$device /usr 2>&1 > /dev/null
+ if [ $? -eq 0 ]; then
+ # it mounted, but we should probably make sure its our boot cd
+ # this can be done by making sure the /pl_version file (on initrd)
+ # matches /usr/isolinux/pl_version
+ initrd_version=$(/bin/cat /pl_version)
+ cd_version=$(/bin/cat /usr/isolinux/pl_version)
+
+ if [ "$initrd_version" != "$cd_version" ]; then
+ # eh, wrong cd, keep trying
+ /bin/umount /usr 2>&1 /dev/null
+ else
+ echo "pl_sysinit: found cd and mounted on /usr"
+ _mounted=1
+ break
+ fi
+ fi
+ done
+ return $_mounted
+}
+
+echo "pl_sysinit: finding cd to mount on /usr"
+mounted=0
+check_initrd
+if [ $? -eq 1 ]; then
+ mounted=1
+else
+ [ ! -d /usr ] && mkdir /usr
+ check_block_devices
+ [ $? -eq 1 ] && mounted=1
+fi
+
+if [ $mounted -eq 0 ]; then
+ echo "pl_sysinit: unable to find boot cdrom, cannot continue."
+ # todo: maybe we can put a staticly linked sshd here
+ /sbin/shutdown -h now
+fi
+
+
+# parts of this were copied from devmap_mknod.sh from the device-mapper
+# source. Since fedora decided not to include it in the rpm, it is
+# being copied here
+echo "pl_sysinit: creating device mapper control node"
+
+DM_DIR="mapper"
+DM_NAME="device-mapper"
+DIR="/dev/$DM_DIR"
+CONTROL="$DIR/control"
+
+MAJOR=$(sed -n 's/^ *\([0-9]\+\) \+misc$/\1/p' /proc/devices)
+MINOR=$(sed -n "s/^ *\([0-9]\+\) \+$DM_NAME\$/\1/p" /proc/misc)
+
+if [ -n "$MAJOR" ] && [ -n "$MINOR" ]; then
+ /bin/mkdir -p --mode=755 $DIR
+ /bin/rm -f $CONTROL
+ /bin/mknod --mode=600 $CONTROL c $MAJOR $MINOR
+else
+ echo "pl_sysinit: unable to create device mapper control node, continuing"
+fi
+
+echo "pl_sysinit: configuring kernel parameters"
+/sbin/sysctl -e -p /etc/sysctl.conf
+
+echo "pl_sysinit: bringing network online"
+/etc/init.d/pl_netinit
+
--- /dev/null
+#!/bin/sh
+
+# Valid environment variables to appear in a planetlab config file
+TAGS='IP_METHOD HOST_NAME DOMAIN_NAME PROXY_SERVER
+ IP_ADDRESS IP_GATEWAY IP_NETMASK IP_NETADDR IP_BROADCASTADDR
+ IP_DNS1 IP_DNS2 NET_DEVICE NODE_KEY NODE_ID
+ IPMI_ADDRESS IPMI_MAC'
+
+# Valid characters that variable can be set to
+CHARS='[:alnum:]\.: _-'
+
+REGEX=''
+
+for t in $TAGS
+do
+ if [ "$REGEX" == "" ]
+ then
+ REGEX="^$t"
+ else
+ REGEX="$REGEX|^$t"
+ fi
+done
+/usr/bin/dos2unix | /bin/egrep "($REGEX)\=\\\"[$CHARS]*\\\"\s*$"
--- /dev/null
+# Kernel sysctl configuration file for Red Hat Linux
+#
+# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
+# sysctl.conf(5) for more details.
+
+# Controls IP packet forwarding
+net.ipv4.ip_forward = 0
+
+# Controls source route verification
+net.ipv4.conf.default.rp_filter = 1
+
+# Controls the System Request debugging functionality of the kernel
+kernel.sysrq = 0
+
+# Controls whether core dumps will append the PID to the core filename.
+# Useful for debugging multi-threaded applications.
+kernel.core_uses_pid = 1
+
+# TCP window scaling and broken routers
+net.ipv4.tcp_moderate_rcvbuf=0
+net.ipv4.tcp_window_scaling=0
--- /dev/null
+#
+# configuration for standard bootcd, contact primary boot server,
+# no backup server.
+#
+
+# extra version, if set, is added to end of version.
+EXTRA_VERSION=
+
+# a one line description of this cd
+DESCRIPTION='PLC PlanetLab BootCD'
+
+# the password for the root account on the cd
+ROOT_PASSWORD='$1$IdEn2srw$/TfrjZSPUC1xP244YCuIi0'
+
+# which server to contact
+PRIMARY_SERVER=boot.planet-lab.org
+PRIMARY_SERVER_PORT=443
+PRIMARY_SERVER_PATH=/boot/
+PRIMARY_SERVER_CERT=plc-boot-cacert.pem
+PRIMARY_SERVER_GPG=plc-pubring.gpg
+
+# and the backup server
+BACKUP_SERVER=boot1.planet-lab.org
+BACKUP_SERVER_PORT=443
+BACKUP_SERVER_PATH=/boot/
+BACKUP_SERVER_CERT=plc-boot1-cacert.pem
+BACKUP_SERVER_GPG=plc-pubring.gpg
+
+# this is a generic cd, so no configuration file for a node
+NODE_CONFIGURATION_FILE=
--- /dev/null
+-----BEGIN CERTIFICATE-----
+MIIC7DCCAlWgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBoTELMAkGA1UEBhMCVVMx
+EzARBgNVBAgTCk5ldyBKZXJzZXkxEjAQBgNVBAcTCVByaW5jZXRvbjESMBAGA1UE
+ChMJUGxhbmV0TGFiMRIwEAYDVQQLEwlQbGFuZXRMYWIxGjAYBgNVBAMTEVBsYW5l
+dExhYiBSb290IENBMSUwIwYJKoZIhvcNAQkBFhZzdXBwb3J0QHBsYW5ldC1sYWIu
+b3JnMB4XDTA0MDIyMzE4MTMyMloXDTE0MDIyMDE4MTMyMlowgaExCzAJBgNVBAYT
+AlVTMRMwEQYDVQQIEwpOZXcgSmVyc2V5MRIwEAYDVQQHEwlQcmluY2V0b24xEjAQ
+BgNVBAoTCVBsYW5ldExhYjESMBAGA1UECxMJUGxhbmV0TGFiMRowGAYDVQQDExFQ
+bGFuZXRMYWIgUm9vdCBDQTElMCMGCSqGSIb3DQEJARYWc3VwcG9ydEBwbGFuZXQt
+bGFiLm9yZzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwtpNRNvNmIEX0zDu
+JcMc3zLHZz9LuXjH+UqiktPIfiMhh1sUqZE2wDfppcGRLAdC7mrmZys5GjZTO0nf
+bU/rV73hplTD8UPZojpbcvKLm5t0kocDG4aoUL+vDF7T8UlXl/T5UF0GWqFey9UY
+luCI5UeKMYdyoxhaMGiL8IBK8DUCAwEAAaMyMDAwDwYDVR0TAQH/BAUwAwEB/zAd
+BgNVHQ4EFgQU+DhxfTWp4xeIF2lUWngDOhC1lY8wDQYJKoZIhvcNAQEEBQADgYEA
+qYakXhLdtk64ppM1KmjeD0M0bGU+ZFu421MH0whxv5RROgNEwCxXicbD/9FZ2uzo
+ik7AdBAiZiyvoEkTxYkzpXHkdM6x0j6iDMjomtihUgkjtM+xaiQ6lqy9h583zhjg
+2Te0b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htQ
+TgQrffnF6NfjYTEFVmrklG32JBOElUtP/nOGFcKjSw0=
+-----END CERTIFICATE-----
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
+<article>
+ <articleinfo>
+ <title>BootCD v3.x Technical Documentation</title>
+
+ <author>
+ <firstname>Aaron</firstname>
+
+ <surname>Klingaman</surname>
+
+ <email>alk@absarokasoft.com</email>
+ </author>
+
+ <affiliation>
+ <orgname>Princeton University</orgname>
+ </affiliation>
+
+ <revhistory>
+ <revision>
+ <revnumber>1.0</revnumber>
+
+ <date>November 17, 2005</date>
+
+ <authorinitials>AK</authorinitials>
+
+ <revdescription>
+ <para>Initial draft.</para>
+ </revdescription>
+ </revision>
+ </revhistory>
+ </articleinfo>
+
+ <section>
+ <title>Overview</title>
+
+ <para>This document describes in detail how the PlanetLab boot CD is built
+ and operates when running on a node. Older boot CDs, including 2.x cds,
+ are not the focus of this document, and are no longer being deployed on
+ production systems.</para>
+ </section>
+
+ <section>
+ <title>Background</title>
+
+ <para>Since the early days of PlanetLab, all production nodes are
+ configured during setup to only start up off of the cdrom, with a
+ PlanetLab boot cd always left in the drive. The intention is to allow a
+ machine to be able to restart into a known environment, for debugging
+ system problems, or as a way to still access the machine but not have any
+ potentially compromised code to run if the system is believed to be
+ compromised.</para>
+ </section>
+
+ <section>
+ <title>Soure Code</title>
+
+ <para>All 3.x boot cd source code is located in the repository 'bootcd_v3'
+ on the PlanetLab CVS system. For information on how to access CVS, consult
+ the PlanetLab website. Unless otherwise noted, all file references refer
+ to this repository.</para>
+ </section>
+
+ <section>
+ <title>Basic Operation</title>
+
+ <para>The operation of the boot cd, when a machine is started off of one,
+ is fairly straightforward. Essentially, it loads a Linux kernel,
+ configures the hardware and network, and fetches a signed script to
+ execute. This generic operation allows for the boot cds to be used for any
+ number of operations, whether they are installing machines or debug
+ problems.</para>
+
+ <para>The full operation of a boot cd, from the moment it is booted, is
+ described in the following diagram.</para>
+
+ <figure>
+ <title>BootCD Operation Flowchart</title>
+
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="bootcd-flowchart.png" />
+ </imageobject>
+ </mediaobject>
+ </figure>
+ </section>
+
+ <section>
+ <title>Security</title>
+
+ <para>Ensuring that the boot cd provided a secure node boot mechanism was
+ a primary concern during its development. The following requirements we
+ used:</para>
+
+ <orderedlist>
+ <listitem>
+ <para>The boot cd should be immutable. At any point, a PlanetLab
+ administrator should be able to reboot a machine into a known safe
+ environment to inspect or debug the node.</para>
+ </listitem>
+
+ <listitem>
+ <para>The cd should verify that the servers it contacts for executable
+ scripts should be PlanetLab Central servers, and not someone posing as
+ one.</para>
+ </listitem>
+
+ <listitem>
+ <para>The scripts executed are to be signed by PlanetLab
+ Central.</para>
+ </listitem>
+ </orderedlist>
+
+ <para>Accomplishing 1. is fairly easy: simply require the cds to be burned
+ onto a write once media. Once that is accomplished, it is up to local site
+ administrators to ensure physical security of the node so the cd is not
+ switched out. Further work may be done by executed scripts to validate a
+ boot cd, if necessary (though not currently implemented).</para>
+
+ <para>Number two is accomplished through the use of SSL certificates. The
+ PlanetLab Central boot server, running Apache at the time of this writing,
+ uses a self signed SSL certificate. The boot cd, for each server it is to
+ contact (a primary server, and a backup server), contains the CA
+ certificates for those servers. Using the URL downloading tool curl, the
+ scripts on the cd can ensure they are contacting a PlanetLab boot server,
+ and not someone attempting to spoof one.</para>
+
+ <para>Number is accomplished through the use of GPG public and private
+ keys. There exists at PlanetLab Central a GPG private key that is used to
+ sign the scripts downloaded and executed by the cd. The public key is
+ located on the cd, and used to validate the signatures of the packages
+ before execution.</para>
+ </section>
+
+ <section>
+ <title>Hardware Detection</title>
+
+ <para>After the Linux kernel is loaded, the first operation is to load the
+ applicable hardware modules for devices on the system, including network
+ drivers, disk drivers, and any others. This process is nearly identical to
+ the process the BootManager uses. During the initial boot cd build
+ process, the script sources/merge_hw_table.py from the bootmanager
+ repository is invoked to create a lookup table to map PCI ids onto kernel
+ modules. For more information about how this script operates, consult the
+ BootManager technical documentation.</para>
+ </section>
+
+ <section>
+ <title>Building A BootCD</title>
+
+ <para>Previous PlanetLab boot cds were essentially boot cds from other
+ projects, modified for use with PlanetLab. With the introduction of
+ version 3.0 of the boot cd, they are now built from scratch. By doing
+ this, we can ensure that the packages contain on the cd are fully up to
+ date, only the packages we need for booting operations are installed (thus
+ reducing the cd size), and the hardware detection mechanisms match that of
+ the node installer (BootManager).</para>
+
+ <para>Though the cds are built from scratch, the process to build a cd is
+ relatively simple, and are as follows:</para>
+
+ <orderedlist>
+ <listitem>
+ <para>The build process is currently only tested with and known to
+ work with Fedora Core 2. You'll need root access on a FC2
+ machine.</para>
+ </listitem>
+
+ <listitem>
+ <para>Check out the boot cd repository from PlanetLab CVS:</para>
+
+ <para><programlisting>cvs -d :pserver:anon@cvs.planet-lab.org:/cvs co bootcd_v3</programlisting></para>
+ </listitem>
+
+ <listitem>
+ <para>Initiate the build by running, from the bootcd_v3
+ directory:</para>
+
+ <para><programlisting>./build.sh build default</programlisting></para>
+ </listitem>
+
+ <listitem>
+ <para>When complete, the resultant iso image will be located in
+ configurations/default/</para>
+ </listitem>
+ </orderedlist>
+
+ <para>The default configuration built above produces a boot cd that is
+ configured to contact the primary PlanetLab boot servers. To build a
+ custom boot cd that contacts a different server, with a different SSL
+ certificate and GPG key, you will need to create a custom
+ configuration:</para>
+
+ <orderedlist>
+ <listitem>
+ <para>Change into the bootcd_v3/configurations directory:</para>
+
+ <para><programlisting>cd bootcd_v3/configurations</programlisting></para>
+ </listitem>
+
+ <listitem>
+ <para>Copy the entire default directory, creating a new one with a
+ short name for the custom configuration. The name is only used during
+ the build process, and is not part of the actual cd.</para>
+
+ <para><programlisting>cp -r default mycustomcd</programlisting></para>
+ </listitem>
+
+ <listitem>
+ <para>Edit the configuration file in the new directory. That file
+ contains various fields that allow for the cd operation to be
+ customized, see the section, Build Configuration Options for more
+ information.</para>
+ </listitem>
+
+ <listitem>
+ <para>Once complete, the custom cd can be built with:</para>
+
+ <para><programlisting>./build.sh build mycustomcd</programlisting></para>
+ </listitem>
+ </orderedlist>
+
+ <section>
+ <title>Build Configuration Options</title>
+
+ <para>The configuration file for builds (the default being located at
+ configurations/default/configuration, contains the following values that
+ can be modified to result in a custom build boot cd:</para>
+
+ <para><itemizedlist>
+ <listitem>
+ <para>EXTRA_VERSION</para>
+
+ <para>Set this to add extra version information to this cd. This
+ will be added to the result ISO name, and on the cd. By doing so,
+ you will be able to differentiate the cds from PlanetLab Boot cds
+ (which have no extra version.</para>
+ </listitem>
+
+ <listitem>
+ <para>DESCRIPTION</para>
+
+ <para>A simple text description, one line, of the boot cd.</para>
+ </listitem>
+
+ <listitem>
+ <para>ROOT_PASSWORD</para>
+
+ <para>The encrypted password to use for the root account on the
+ boot cd. Only applies to the boot cd, not the root account on an
+ installed and fully running node.</para>
+ </listitem>
+
+ <listitem>
+ <para>PRIMARY_SERVER / BACKUP_SERVER</para>
+
+ <para>The hostname of the server to attempt to contact first, and
+ a backup server if that one fails.</para>
+ </listitem>
+
+ <listitem>
+ <para>PRIMARY_SERVER_PORT / BACKUP_SERVER_PORT</para>
+
+ <para>Which SSL port on the server we should contact (default SSL
+ port is 443). This rarely will need to be changed.</para>
+ </listitem>
+
+ <listitem>
+ <para>PRIMARY_SERVER_PATH / BACKUP_SERVER_PATH</para>
+
+ <para>The path containing the script this cd should download and
+ execute. Can either be a path to an exact file, like
+ /boot/bootscript, or, can be a directory or dynamically executed
+ file, like /boot/index.php or just /boot. In this case, the
+ resultant output of that file/directory should be a signed and
+ executable script.</para>
+ </listitem>
+
+ <listitem>
+ <para>PRIMARY_SERVER_CERT / BACKUP_SERVER_CERT</para>
+
+ <para>The SSL CA certificate(s) for the above server(s). This is
+ used to validate that the server we are contacting has not been
+ spoofed.</para>
+ </listitem>
+
+ <listitem>
+ <para>PRIMARY_SERVER_GPG / BACKUP_SERVER_GPG</para>
+
+ <para>The GPG public key(s) of the private key(s) that was used to
+ sign the script that will be returned by PRIMARY_SERVER_PATH or
+ BACKUP_SERVER_PATH</para>
+ </listitem>
+
+ <listitem>
+ <para>NODE_CONFIGURATION_FILE</para>
+
+ <para>If this cd is to be used exclusively by a single node, that
+ node's network configuration file can be placed on the cd. This is
+ the path on the local system to that configuration file, which
+ will be copied to a known location on the cd and used during boot
+ up.</para>
+ </listitem>
+ </itemizedlist></para>
+
+ <para>With regard to file paths: for the locations of the keys,
+ certificates, and optionally node configuration files, it is easiest to
+ place these files inside the directory with the bootcd configuration
+ file, and simply use the name of the file for the value. See the default
+ configuration file for an example.</para>
+ </section>
+
+ <section>
+ <title>Build Package Sources</title>
+
+ <para>The packages installed during the build process are
+ downloaded from the boot server specified by the
+ <parameter>PRIMARY_SERVER</parameter> variable, described
+ above. The build script installs the packages defined by the
+ <parameter>BootCD</parameter> yum group. This group should be
+ defined in a <filename>yumgroups.xml</filename> file located at
+ <filename>install-rpms/planetlab/yumgroups.xml</filename> in the
+ document root of the boot server.</para>
+ </section>
+ </section>
+</article>
--- /dev/null
+***************************************************************************
+IPMI BMC IP & MAC Changer
+Copyright(c) 2004 by Super Micro Computer, Inc. http://supermicro.com/
+***************************************************************************
+
+2.1 (050928)
+ - Support both Linux x86 and x86_64
+
+2.0 (2004101101)
+ - Use smipmi-lib Version 1.0 (2004/10/11)
+
--- /dev/null
+#!/bin/bash
+#
+# Builds custom BootCD ISO and USB images in the current
+# directory.
+#
+# Mark Huang <mlhuang@cs.princeton.edu>
+# Copyright (C) 2004-2006 The Trustees of Princeton University
+#
+# $Id: newbuild.sh,v 1.2 2006/12/04 20:07:18 mlhuang Exp $
+#
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+BOOTCD_VERSION=4.0
+
+if [ -f /etc/planetlab/plc_config ] ; then
+ # Source PLC configuration
+ . /etc/planetlab/plc_config
+else
+ echo "Could not find /etc/planetlab/plc_config."
+ echo "This file defines the configuration of your PlanetLab installation."
+ exit 1
+fi
+
+# This support for backwards compatibility can be taken out in the
+# future. RC1 based MyPLCs set $PLC_BOOT_SSL_CRT in the plc_config
+# file, but >=RC2 based bootcd assumes that $PLC_BOOT_CA_SSL_CRT is
+# set.
+if [ -z "$PLC_BOOT_CA_SSL_CRT" -a ! -z "$PLC_BOOT_SSL_CRT" ] ; then
+ PLC_BOOT_CA_SSL_CRT=$PLC_BOOT_SSL_CRT
+ PLC_API_CA_SSL_CRT=$PLC_API_SSL_CRT
+fi
+
+output="$PLC_NAME-BootCD-$BOOTCD_VERSION.iso"
+
+usage()
+{
+ echo "Usage: build.sh [OPTION]..."
+ eceho " -o file Output file (default: $output)"
+ echo " -h This message"
+ exit 1
+}
+
+# Get options
+while getopts "o:h" opt ; do
+ case $opt in
+ o)
+ output=$OPTARG
+ ;;
+ h|*)
+ usage
+ ;;
+ esac
+done
+
+FULL_VERSION_STRING="$PLC_NAME BootCD $BOOTCD_VERSION"
+echo "* Building image for $FULL_VERSION_STRING"
+
+# Do not tolerate errors
+set -e
+
+# Change to our source directory
+srcdir=$(cd $(dirname $0) && pwd -P)
+pushd $srcdir >/dev/null
+
+# Root of the isofs
+isofs=$PWD/isofs
+
+# Miscellaneous files
+misc=$(mktemp -d /tmp/misc.XXXXXX)
+trap "rm -rf $misc" ERR INT
+
+# initramfs requires that /init be present
+ln -sf /sbin/init $misc/init
+
+# Create version file
+echo "$FULL_VERSION_STRING" >$misc/.bootcd
+
+# Install GPG, boot, and API server public keys and certificates
+install -D -m 644 $PLC_ROOT_GPG_KEY_PUB $misc/$PLC_ROOT_GPG_KEY_PUB
+install -D -m 644 $PLC_BOOT_CA_SSL_CRT $misc/$PLC_BOOT_CA_SSL_CRT
+install -D -m 644 $PLC_API_CA_SSL_CRT $misc/$PLC_API_CA_SSL_CRT
+
+cat > $misc/etc/planetlab/plc_config <<EOF
+PLC_ROOT_GPG_KEY_PUB='$PLC_ROOT_GPG_KEY_PUB'
+
+PLC_BOOT_HOST='$PLC_BOOT_HOST'
+PLC_BOOT_IP='$PLC_BOOT_IP'
+PLC_BOOT_PORT=$PLC_BOOT_PORT
+PLC_BOOT_SSL_PORT=$PLC_BOOT_SSL_PORT
+PLC_BOOT_CA_SSL_CRT='$PLC_BOOT_CA_SSL_CRT'
+
+PLC_API_HOST='$PLC_API_HOST'
+PLC_API_IP='$PLC_API_IP'
+PLC_API_PORT=$PLC_API_PORT
+PLC_API_PATH='$PLC_API_PATH'
+PLC_API_CA_SSL_CRT='$PLC_API_CA_SSL_CRT'
+EOF
+
+# Generate /etc/issue
+if [ "$PLC_WWW_PORT" = "443" ] ; then
+ PLC_WWW_URL="https://$PLC_WWW_HOST/"
+elif [ "$PLC_WWW_PORT" != "80" ] ; then
+ PLC_WWW_URL="http://$PLC_WWW_HOST:$PLC_WWW_PORT/"
+else
+ PLC_WWW_URL="http://$PLC_WWW_HOST/"
+fi
+
+mkdir -p $misc/etc
+cat >$misc/etc/issue <<EOF
+$FULL_VERSION_STRING
+$PLC_NAME Node: \n
+Kernel \r on an \m
+$PLC_WWW_URL
+
+This machine is a node in the $PLC_NAME distributed network. It has
+not fully booted yet. If you have cancelled the boot process at the
+request of $PLC_NAME Support, please follow the instructions provided
+to you. Otherwise, please contact $PLC_MAIL_SUPPORT_ADDRESS.
+
+Console login at this point is restricted to root. Provide the root
+password of the default $PLC_NAME Central administrator account at the
+time that this CD was created.
+
+EOF
+
+# Pack miscellaneous files into a compressed archive
+echo "* Compressing miscellaneous files image"
+(cd $misc && find . | cpio --quiet -H newc -o) | \
+ python ../filesystem/cpiochown.py --owner root:root - | \
+ gzip -9 >$isofs/misc.img
+
+rm -rf $misc
+trap - ERR INT
+
+# Calculate ramdisk size (total uncompressed size of all initrds)
+ramdisk_size=$(gzip -l $isofs/*.img | tail -1 | awk '{ print $2; }') # bytes
+ramdisk_size=$((($ramdisk_size + 1023) / 1024)) # kilobytes
+
+# Write isolinux configuration
+echo "$FULL_VERSION_STRING" >$isofs/version
+cat >$isofs/isolinux.cfg <<EOF
+DEFAULT kernel
+APPEND ramdisk_size=$ramdisk_size initrd=base.img,bootcd.img,misc.img root=/dev/ram0 rw console=tty0
+DISPLAY version
+PROMPT 0
+TIMEOUT 40
+EOF
+
+popd >/dev/null
+
+# Create ISO image
+echo "* Creating ISO image"
+mkisofs -o "$output" \
+ -R -allow-leading-dots -J -r \
+ -b isolinux.bin -c boot.cat \
+ -no-emul-boot -boot-load-size 4 -boot-info-table \
+ $isofs
+
+# XXX Create USB image
+
+exit 0
--- /dev/null
+#!/bin/bash
+#
+# Builds the BootCD reference image, the first of two
+# initramfs cpio archives that are concatenated together by
+# isolinux/syslinux to form a custom BootCD.
+#
+# Aaron Klingaman <alk@absarokasoft.com>
+# Mark Huang <mlhuang@cs.princeton.edu>
+# Copyright (C) 2004-2006 The Trustees of Princeton University
+#
+# $Id: prep.sh,v 1.12 2006/08/21 20:24:09 mlhuang Exp $
+#
+
+PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+# In both a normal CVS environment and a PlanetLab RPM
+# build environment, all of our dependencies are checked out into
+# directories at the same level as us.
+if [ -d ../build ] ; then
+ PATH=$PATH:../build
+ srcdir=..
+else
+ echo "Error: Could not find sources in either . or .."
+ exit 1
+fi
+
+export PATH
+
+# Release and architecture to install
+releasever=4
+basearch=i386
+
+# Packages to install
+packagelist=(
+udev
+dhclient
+bash
+coreutils
+iputils
+kernel
+bzip2
+diffutils
+logrotate
+passwd
+rsh
+rsync
+sudo
+tcpdump
+telnet
+traceroute
+time
+wget
+yum
+curl
+gzip
+python
+tar
+pciutils
+kbd
+authconfig
+hdparm
+lvm
+lvm2
+kexec-tools
+gnupg
+nano
+parted
+pyparted
+openssh-server
+openssh-clients
+ncftp
+dosfstools
+dos2unix
+bind-utils
+sharutils
+vconfig
+)
+
+# Unnecessary junk
+junk=(
+lib/obsolete
+lib/tls
+usr/share/cracklib
+usr/share/emacs
+usr/share/gnupg
+usr/share/i18n
+usr/share/locale
+usr/share/terminfo
+usr/share/zoneinfo
+usr/sbin/build-locale-archive
+usr/sbin/dbconverter-2
+usr/sbin/sasl*
+usr/sbin/tcpslice
+usr/lib/perl*
+usr/lib/locale
+usr/lib/sasl*
+usr/lib/gconv
+usr/lib/tls
+)
+
+precious=(
+usr/share/i18n/locales/en_US
+usr/share/i18n/charmaps/UTF-8.gz
+usr/share/locale/en
+usr/share/terminfo/l/linux
+usr/share/terminfo/v/vt100
+usr/share/terminfo/x/xterm
+usr/share/zoneinfo/UTC
+usr/lib/locale/en_US.utf8
+)
+
+usage()
+{
+ echo "Usage: prep.sh [OPTION]..."
+ echo " -r release Fedora release number (default: $releasever)"
+ echo " -a arch Fedora architecture (default: $basearch)"
+ echo " -h This message"
+ exit 1
+}
+
+# Get options
+while getopts "r:a:h" opt ; do
+ case $opt in
+ r)
+ releasever=$OPTARG
+ ;;
+ a)
+ basearch=$OPTARG
+ ;;
+ h|*)
+ usage
+ ;;
+ esac
+done
+
+# Do not tolerate errors
+set -e
+
+# Root of the initramfs reference image
+bootcd=$PWD/build/bootcd
+install -d -m 755 $bootcd
+
+# Write version number
+rpmquery --specfile bootcd.spec --queryformat '%{VERSION}\n' | head -1 >build/version.txt
+
+# Install base system
+for package in "${packagelist[@]}" ; do
+ packages="$packages -p $package"
+done
+mkfedora -v -r $releasever -a $basearch -k $packages $bootcd
+
+pushd $bootcd
+
+echo "* Removing unnecessary junk"
+
+# Save precious files
+tar --ignore-failed-read -cpf precious.tar ${precious[*]}
+
+# Remove unnecessary junk
+rm -rf ${junk[*]}
+
+# Restore precious files
+tar -xpf precious.tar
+rm -f precious.tar
+
+popd
+
+# Disable all services in reference image
+chroot $bootcd sh -c "/sbin/chkconfig --list | awk '{ print \$1 }' | xargs -i /sbin/chkconfig {} off"
+
+# Install ipnmac (for SuperMicro machines with IPMI)
+echo "* Installing IPMI utilities"
+install -D -m 755 ipnmac/ipnmac.x86 $bootcd/usr/sbin/ipnmac
+
+# Install configuration files
+echo "* Installing configuration files"
+for file in fstab mtab modprobe.conf inittab hosts sysctl.conf ; do
+ install -D -m 644 conf_files/$file $bootcd/etc/$file
+done
+
+# Install initscripts
+echo "* Installing initscripts"
+for file in pl_sysinit pl_hwinit pl_netinit pl_validateconf pl_boot ; do
+ install -D -m 755 conf_files/$file $bootcd/etc/init.d/$file
+done
+
+# Install fallback node configuration file
+echo "* Installing fallback node configuration file"
+install -D -m 644 conf_files/default-net.cnf $bootcd/usr/boot/default-net.cnf
+
+# Build pcitable for hardware detection
+echo "* Building pcitable for hardware detection"
+pci_map_file=$(find $bootcd/lib/modules/ -name modules.pcimap | head -1)
+module_dep_file=$(find $bootcd/lib/modules/ -name modules.dep | head -1)
+pci_table=$bootcd/usr/share/hwdata/pcitable
+$srcdir/bootmanager/source/merge_hw_tables.py \
+ $module_dep_file $pci_map_file $pci_table $bootcd/etc/pl_pcitable
+
+# Copy /etc/passwd out
+install -D -m 644 $bootcd/etc/passwd build/passwd
+
+# Root of the isofs
+isofs=$PWD/build/isofs
+install -d -m 755 $isofs
+
+# Copy the kernel out
+for kernel in $bootcd/boot/vmlinuz-* ; do
+ if [ -f $kernel ] ; then
+ install -D -m 644 $kernel $isofs/kernel
+ fi
+done
+
+# Don't need /boot anymore
+rm -rf $bootcd/boot
+
+# initramfs requires that /init be present
+ln -sf /sbin/init $bootcd/init
+
+# Pack the rest into a compressed archive
+echo "* Compressing reference image"
+(cd $bootcd && find . | cpio --quiet -c -o) | gzip -9 >$isofs/bootcd.img
+
+# Build syslinux
+echo "* Building syslinux"
+CFLAGS="-Werror -Wno-unused -finline-limit=2000" make -C syslinux
+
+# Install isolinux
+echo "* Installing isolinux"
+install -D -m 644 syslinux/isolinux.bin $isofs/isolinux.bin
+
+exit 0
--- /dev/null
+http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-2.11.tar.bz2
-## $Id: Makefile,v 1.120 2005/04/02 21:48:47 hpa Exp $
+## $Id: Makefile,v 1.1.1.1 2006/04/03 19:33:23 mlhuang Exp $
## -----------------------------------------------------------------------
##
## Copyright 1998-2005 H. Peter Anvin - All Rights Reserved
BSUBDIRS = memdisk dos win32
ITARGET = copybs.com gethostip mkdiskimage
IOBJECTS = $(ITARGET) mtools/syslinux unix/syslinux extlinux/extlinux
-ISUBDIRS = mtools unix extlinux sample com32
+ISUBDIRS = mtools unix extlinux sample # com32
DOCS = COPYING NEWS README TODO BUGS *.doc sample menu com32
OTHER = Makefile bin2c.pl now.pl genhash.pl keywords findpatch.pl \
keytab-lilo.pl version version.pl sys2ansi.pl \