#!/bin/sh # # Do Emulab stuff # if [ -f /etc/emulab/paths.sh ]; then . /etc/emulab/paths.sh else BINDIR=/etc/testbed fi mode=admin start() { for token in `cat /proc/cmdline`; do case $token in elab_mode=*) mode=${token##*=} ;; esac done # if newnode, there is no DB state for quotes if [ "$mode" = "newnode" ]; then echo "FATAL: secure MFS does not support 'newnode'" sleep 5 /sbin/reboot fi echo "Starting secure MFS in \"$mode\" mode" script="" scriptarg="" if [ -x $BINDIR/script1.sh ]; then if $BINDIR/script1.sh; then scriptarg="-secure" else echo "WARNING: secure setup failed, dropping to MFS" mode="admin" fi fi case $mode in admin) script=$BINDIR/rc/rc.mfs scriptarg="boot" ;; frisbee) if $BINDIR/rc/rc.frisbee $scriptarg; then echo "Disk load done"; else echo "WARNING: disk load failed, continuing anyway" fi script="" scriptarg="" ;; *) echo "Invalid mode, dropping to MFS" 1>&2 script=$BINDIR/rc/rc.mfs scriptarg="boot" ;; esac # must sign-off before executing any further scripts if [ -x $BINDIR/script2.sh ]; then if $BINDIR/script2.sh; then echo "Signed off from secure MFS" else echo "WARNING: TPM sign-off failed" script="" fi fi if [ -z "$script" ]; then echo "Rebooting ..." sleep 2 /sbin/reboot fi echo "Starting ${script##*/} ..." $script $scriptarg exit $? } stop() { : } restart() { : } case "$1" in start) start ;; stop) stop ;; restart|reload) restart ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 esac exit $?