Merge disconnected ops branch.
[bootcd.git] / prep.sh
diff --git a/prep.sh b/prep.sh
index 27bc7ba..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.1 2006/04/03 19:35:39 mlhuang Exp $
+# $Id$
 #
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -26,79 +26,46 @@ fi
 
 export PATH
 
-# Release and architecture to install
-releasever=2
-basearch=i386
-
-# Packages to install
-packagelist=(
-dev
-dhclient
-bash
-coreutils
-iputils
-kernel
-bzip2
-diffutils
-logrotate
-openssh-clients
-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=(
+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
 )
 
-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
+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
+)
 
 # Do not tolerate errors
 set -e
@@ -111,13 +78,30 @@ 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
 
-# Disable all services in reference image
-chroot $bootcd sh -c "/sbin/chkconfig --list | awk '{ print \$1 }' | xargs -i /sbin/chkconfig {} off"
+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
+
+# 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"
@@ -140,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
@@ -157,6 +141,9 @@ for kernel in $bootcd/boot/vmlinuz-* ; do
     fi
 done
 
+# Don't need /boot anymore
+rm -rf $bootcd/boot
+
 # initramfs requires that /init be present
 ln -sf /sbin/init $bootcd/init