X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=build.sh;h=914101e14e7d6b0bf89acb3c314755b04eeacbc9;hb=629366505c7022d019a714c66affc9e1f10e9b55;hp=2a1f6df353f29b7b4b7f44b6a4dae646580dc2e7;hpb=1e544936aa51a644091868ba4d61c72d733c5c12;p=myplc.git diff --git a/build.sh b/build.sh index 2a1f6df..914101e 100755 --- a/build.sh +++ b/build.sh @@ -10,6 +10,7 @@ # root/ (mount point) # data/ (various data files) # data/etc/planetlab/ (configuration files) +# data/root (root's homedir) # # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University @@ -74,14 +75,37 @@ fi # PLC_DEVEL_BOOTSTRAP is false. # +# These directories are allowed to grow to unspecified size, so they +# are stored as symlinks to the /data partition. mkfedora and yum +# expect some of them to be real directories, however. +datadirs=( +/etc/planetlab +/root +/var/lib/pgsql +/var/www/html/alpina-logs +/var/www/html/boot +/var/www/html/download +/var/www/html/files +/var/www/html/generated +/var/www/html/install-rpms +/var/www/html/xml +/tmp +/usr/tmp +/var/tmp +/var/log +) +for datadir in "${datadirs[@]}" ; do + # If we are being re-run, it may be a symlink + if [ -h root/$datadir ] ; then + rm -f root/$datadir + mkdir -p root/$datadir + fi +done + echo "* myplc: Installing base filesystem" mkdir -p root data make_chroot root plc_config.xml -# Build schema -echo "* myplc: Building database schema" -make -C $srcdir/pl_db - # Install configuration scripts echo "* myplc: Installing configuration scripts" install -D -m 755 plc_config.py root/tmp/plc_config.py @@ -98,11 +122,6 @@ 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' -# Install DB schema and API code -echo "* myplc: Installing DB schema and API code" -mkdir -p root/usr/share -rsync -a $srcdir/pl_db $srcdir/plc_api root/usr/share/ - # Install web scripts echo "* myplc: Installing web scripts" mkdir -p root/usr/bin @@ -115,31 +134,32 @@ install -m 755 \ # Install web pages echo "* myplc: Installing web pages" mkdir -p root/var/www/html -# Exclude old cruft, unrelated GENI pages, and official documents -rsync -a \ - --exclude='*2002' --exclude='*2003' \ - --exclude=geni --exclude=PDN --exclude=Talks \ - $srcdir/plc_www/ root/var/www/html/ +rsync -a $srcdir/new_plc_www/ root/var/www/html/ + +# Install Drupal rewrite rules +install -D -m 644 $srcdir/new_plc_www/drupal.conf root/etc/httpd/conf.d/drupal.conf # Install configuration file echo "* myplc: Installing configuration file" 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=( -/etc/planetlab -/var/lib/pgsql -/var/www/html/alpina-logs -/var/www/html/boot -/var/www/html/download -/var/www/html/generated -/var/www/html/install-rpms -/var/www/html/xml -) +# handle root's homedir and tweak root prompt +echo "* myplc: root's homedir and prompt" +roothome=data/root +mkdir -p $roothome +cat << EOF > $roothome/.profile +export PS1=" \$PS1" +EOF +chmod 644 $roothome/.profile +# Move "data" directories out of the installation +echo "* myplc: Moving data directories out of the installation" move_datadirs root data "${datadirs[@]}" +# Fix permissions on tmp directories +chmod 1777 data/tmp data/usr/tmp data/var/tmp + # Remove generated bootmanager script rm -f data/var/www/html/boot/bootmanager.sh