- create a build user with the same uid/gid as the sudoer, if
[myplc.git] / build.sh
index 0bbea3d..914101e 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -15,7 +15,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: build.sh,v 1.32 2006/08/16 21:44:48 mlhuang Exp $
+# $Id$
 #
 
 . build.functions
@@ -75,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
@@ -99,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
@@ -116,11 +134,10 @@ 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"
@@ -138,20 +155,11 @@ chmod 644 $roothome/.profile
 
 # Move "data" directories out of the installation
 echo "* myplc: Moving data directories out of the installation"
-datadirs=(
-/etc/planetlab
-/root
-/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
-)
-
 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