svn:keywords
[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"
34                 $topdir/build.sh regular
35                 check
36             elif [ -x $topdir/build.sh ] ; then
37                 action $"Rebuilding Boot Manager for deployment $deployment"
38                 $topdir/build.sh $deployment
39                 check
40             elif [ "$deployment" == "source" ] ; then
41                 action $"Ignoring obsolete dir, please cleanup" "$topdir"
42             else
43                 action $"WARNING: missing build.sh script in" "$topdir"
44             fi
45         done
46
47         result "$MESSAGE"
48         ;;
49 esac
50
51 exit $ERRORS