Merge disconnected ops branch.
[bootcd.git] / prep.sh
diff --git a/prep.sh b/prep.sh
index d2ef266..0a10e9f 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.9 2006/07/20 19:59:51 mlhuang Exp $
+# $Id$
 #
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -26,54 +26,13 @@ fi
 
 export PATH
 
-# Release and architecture to install
-releasever=4
-basearch=i386
-
-# Packages to install
-packagelist=(
-dev
-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
-)
+. build.common
+
+# pldistro expected as $1 - defaults to planetlab
+pldistro=planetlab
+[ -n "$@" ] && pldistro=$1
+
+# Packages to install : see <pldistro>-<fcdistro>-bootcd.lst
 
 # Unnecessary junk
 junk=(
@@ -108,30 +67,6 @@ 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
 
@@ -143,10 +78,10 @@ install -d -m 755 $bootcd
 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
+lst=${pldistro}-${pl_DISTRO_NAME}-bootcd.lst
+options=$(pl_getPackagesOptions $lst)
+
+pl_setup_chroot $bootcd $options -k
 
 pushd $bootcd
 
@@ -164,8 +99,9 @@ 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"
@@ -188,7 +124,7 @@ 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 \
+$srcdir/BootManager/source/merge_hw_tables.py \
     $module_dep_file $pci_map_file $pci_table $bootcd/etc/pl_pcitable
 
 # Copy /etc/passwd out