password generation utility was still python2
[bootcd.git] / plc.d / bootcd
1 #!/bin/bash
2 #
3 # priority: 1000
4 #
5 # Rebuild the Boot CD
6 #
7 # Mark Huang <mlhuang@cs.princeton.edu>
8 # Copyright (C) 2006 The Trustees of Princeton University
9 #
10 # $Id$
11 # $URL$
12 #
13
14 # Source function library and configuration
15 . /etc/plc.d/functions
16 . /etc/planetlab/plc_config
17
18 # Be verbose
19 set -x
20
21 case "$1" in
22     start)
23         if [ "$PLC_BOOT_ENABLED" != "1" -a \
24              "$PLC_WWW_ENABLED" != "1" ] ; then
25             exit 0
26         fi
27
28         dialog $"Rebuilding Boot CD"
29
30         # Customize the Boot CD : run build.sh on all available bootcd's
31         shopt -s nullglob
32         # xxx nodefamily xxx - might make sense to detect sequel from older installs
33         for bootcd in /usr/share/bootcd-* ; do
34             name=$(basename $bootcd)
35             nodefamily=$(echo $name | sed -e s,bootcd-,,)
36             download=/var/www/html/download-${nodefamily}
37             [ -d ${download} ] || mkdir -p ${download}
38
39             pushd ${download}
40             action $"Rebuilding BootCD $name" ${bootcd}/build.sh ${PLC_BUILD_ALL_BOOTCDS:+-a}
41             check
42             popd
43         
44         done
45
46         # just issue a warning about legacy locations
47         for legacy in /usr/share/bootcd /var/www/html/download ; do
48             [ -e $legacy ] && echo "WARNING: found legacy location $legacy -- ignored"
49         done
50
51         result "$MESSAGE"
52         ;;
53 esac
54
55 exit $ERRORS