bugfix
[bootmanager.git] / plc.d / bootmanager
1 #!/bin/bash
2 #
3 # priority: 1100
4 #
5 # Rebuild the Boot Manager
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         shopt -s nullglob
29         for topdir in /usr/share/bootmanager/* ; do
30             [ -d "$topdir" ] || continue
31             deployment=$(basename $topdir)
32             if [ "$deployment" = "regular" ] ; then
33                 action $"Rebuilding Boot Manager"  $topdir/build.sh regular
34                 check
35             elif [ -x $topdir/build.sh ] ; then
36                 action $"Rebuilding Boot Manager for deployment $deployment" $topdir/build.sh $deployment
37                 check
38             elif [ "$deployment" == "source" ] ; then
39                 action $"Ignoring obsolete dir, please cleanup $topdir"
40             else
41                 action $"WARNING: missing build.sh script in $topdir"
42             fi
43         done
44
45         result "$MESSAGE"
46         ;;
47 esac
48
49 exit $ERRORS