merge to HEAD as of 2006-08-21 myplc-0_4-branch myplc-0_4-branch
authorMark Huang <mlhuang@cs.princeton.edu>
Mon, 21 Aug 2006 21:27:43 +0000 (21:27 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Mon, 21 Aug 2006 21:27:43 +0000 (21:27 +0000)
bootcd.spec
build.sh
conf_files/pl_netinit
conf_files/pl_validateconf
prep.sh

index d3ca071..391fec7 100644 (file)
@@ -58,7 +58,7 @@ 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}/
-find \
+tar cpf - \
     build/isofs/bootcd.img \
     build/isofs/isolinux.bin \
     build/isofs/kernel \
@@ -66,7 +66,7 @@ find \
     build/version.txt \
     configurations \
     syslinux/unix/syslinux | \
-    cpio -p -d -u $RPM_BUILD_ROOT/%{_datadir}/%{name}/
+    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
index dded060..2549425 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -10,7 +10,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2004-2006 The Trustees of Princeton University
 #
-# $Id: build.sh,v 1.39 2006/07/13 17:51:49 mlhuang Exp $
+# $Id: build.sh,v 1.40 2006/07/25 23:51:39 mlhuang Exp $
 #
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -88,7 +88,7 @@ FULL_VERSION_STRING="$PLC_NAME BootCD $BOOTCD_VERSION"
 # Root of the ISO and USB images
 overlay=$(mktemp -d /tmp/overlay.XXXXXX)
 install -d -m 755 $overlay
-trap "rm -rf $overlay" ERR
+trap "rm -rf $overlay" ERR INT
 
 # Create version files
 echo "* Creating version files"
@@ -180,11 +180,11 @@ echo "* Compressing overlay image"
 (cd $overlay && find . | cpio --quiet -c -o) | gzip -9 >$isofs/overlay.img
 
 rm -rf $overlay
-trap - ERR
+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 / 1024)) # kilobytes
+ramdisk_size=$((($ramdisk_size + 1023) / 1024)) # kilobytes
 
 # Write isolinux configuration
 echo "$FULL_VERSION_STRING" >$isofs/pl_version
@@ -218,7 +218,7 @@ mkfs.vfat -C "$usb" $(($(du -sk $isofs | awk '{ print $1; }') + 1024))
 # Mount it
 tmp=$(mktemp -d /tmp/bootcd.XXXXXX)
 mount -o loop "$usb" $tmp
-trap "umount $tmp; rm -rf $tmp" ERR
+trap "umount $tmp; rm -rf $tmp" ERR INT
 
 # Populate it
 echo "* Populating USB image"
@@ -228,7 +228,7 @@ echo "* Populating USB image"
 mv $tmp/isolinux.cfg $tmp/syslinux.cfg
 umount $tmp
 rmdir $tmp
-trap - ERR
+trap - ERR INT
 
 echo "* Making USB image bootable"
 $srcdir/syslinux/unix/syslinux "$usb"
index bf662d2..cd48730 100644 (file)
@@ -235,6 +235,17 @@ 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
@@ -243,14 +254,14 @@ fi
 if [[ -n "$NET_DEVICE" ]]; then
     # the user specified a mac address we should use. find the network
     # device for it.
-    echo "pl_netinit: looking for a device with mac address $NET_DEVICE"
+    NET_DEVICE=$(tr A-Z a-z <<<$NET_DEVICE)
 
     pushd /sys/class/net
     for device in *; do
-       dev_address=`cat $device/address`
-       if [[ "$dev_address" == "$NET_DEVICE" ]]; then
+       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"
+           echo "pl_netinit: found device $ETH_DEVICE with mac address $dev_address"
            break
        fi
     done
index b3a56ec..48e3d5b 100644 (file)
@@ -3,7 +3,8 @@
 # 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'
+      IP_DNS1 IP_DNS2 NET_DEVICE NODE_KEY NODE_ID
+      IPMI_ADDRESS IPMI_MAC'
 
 # Valid characters that variable can be set to
 CHARS='[:alnum:]\.: _-'
diff --git a/prep.sh b/prep.sh
index 2688d4d..e1164aa 100755 (executable)
--- a/prep.sh
+++ b/prep.sh
@@ -8,7 +8,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2004-2006 The Trustees of Princeton University
 #
-# $Id: prep.sh,v 1.10 2006/07/24 15:33:07 mlhuang Exp $
+# $Id: prep.sh,v 1.13 2006/08/21 20:45:23 mlhuang Exp $
 #
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -32,7 +32,7 @@ basearch=i386
 
 # Packages to install
 packagelist=(
-dev
+udev
 dhclient
 bash
 coreutils
@@ -73,6 +73,7 @@ dosfstools
 dos2unix
 bind-utils
 sharutils
+vconfig
 )
 
 # Unnecessary junk
@@ -167,6 +168,10 @@ 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