- get rid of /boot after copying kernel out
[bootcd.git] / prep.sh
diff --git a/prep.sh b/prep.sh
index 94a17ba..d2ef266 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.2 2006/05/15 19:19:55 mlhuang Exp $
+# $Id: prep.sh,v 1.9 2006/07/20 19:59:51 mlhuang Exp $
 #
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -41,7 +41,6 @@ kernel
 bzip2
 diffutils
 logrotate
-openssh-clients
 passwd
 rsh
 rsync
@@ -76,6 +75,39 @@ bind-utils
 sharutils
 )
 
+# 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]..."
@@ -116,6 +148,22 @@ for package in "${packagelist[@]}" ; do
 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"
 
@@ -157,6 +205,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