- move most of the old api-config functionality here
[myplc.git] / build.sh
index a6e5130..bb89f26 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -28,7 +28,7 @@ export PATH
 config=plc_config.xml
 
 # Release and architecture to install
-releasever=2
+releasever=4
 basearch=i386
 
 # Initial size of the image
@@ -93,7 +93,7 @@ while read package ; do
 done < <(./plc-config --packages $config)
 
 # Install base system
-mkfedora -v -r $releasever -a $basearch $packages $root
+mkfedora -v -r $releasever -a $basearch -k $packages $root
 
 # Disable all services in reference image
 chroot $root sh -c "/sbin/chkconfig --list | awk '{ print \$1 }' | xargs -i /sbin/chkconfig {} off"
@@ -116,9 +116,11 @@ install -D -m 755 plc_config.py $root/tmp/plc_config.py
 chroot $root sh -c 'cd /tmp; python plc_config.py build; python plc_config.py install'
 install -D -m 755 plc-config $root/usr/bin/plc-config
 install -D -m 755 api-config $root/usr/bin/api-config
+install -D -m 755 dns-config $root/usr/bin/dns-config
 
-# Install init script
-echo "* Installing initscript"
+# Install initscripts
+echo "* Installing initscripts"
+find plc.d | cpio -p -d -u $root/etc/
 install -D -m 755 guest.init $root/etc/init.d/plc
 chroot $root sh -c 'chkconfig --add plc; chkconfig plc on'
 
@@ -145,11 +147,10 @@ rsync -a \
     --exclude=geni --exclude=PDN --exclude=Talks \
     $srcdir/plc_www/ $root/var/www/html/
 
-# XXX Build imprintable BootCD and BootManager images.
-
 # Install configuration file
 echo "* Installing configuration file"
-install -D -m 644 $config $data/etc/planetlab/plc_config.xml
+install -D -m 444 $config $data/etc/planetlab/default_config.xml
+install -D -m 444 plc_config.dtd $data/etc/planetlab/plc_config.dtd
 
 # Move "data" directories out of the installation
 datadirs=(
@@ -255,7 +256,7 @@ fi
 # bootstrap the database, then shut it back down again immediately.
 echo "* Bootstrapping installation"
 
-./plc-config --save $data/etc/planetlab/plc_config.xml bootstrap.xml
+install -D -m 644 bootstrap.xml $data/etc/planetlab/configs/bootstrap.xml
 
 # Otherwise, host.init will try to read /etc/sysconfig/plc
 export PLC_ROOT=$PWD/$root
@@ -265,10 +266,15 @@ export PLC_DATA=$PWD/$data
 ./host.init start
 RETVAL=$?
 
-# Restore default configuration before shutting down
-install -D -m 644 $config $data/etc/planetlab/plc_config.xml
+# Remove ISO and USB images, which take up >100MB but only take a
+# couple of seconds to generate at first boot.
+rm -f $data/var/www/html/download/*.{iso,usb}
 
 ./host.init stop
 RETVAL=$(($RETVAL+$?))
 
+# Restore default configuration
+rm -f $data/etc/planetlab/configs/bootstrap.xml
+install -D -m 444 $config $data/etc/planetlab/plc_config.xml
+
 exit $RETVAL