#!/bin/sh # Make some files persistent in DLS Live CD. # # chkconfig: 2345 98 01 # description: DLS LiveCD Utility # Source function library. . /etc/rc.d/init.d/functions MOUNT_DIR='/mnt/storage' NAME="dlscdtool" # Start this script. start() { #gprintf "Starting ${NAME}: " if test -f $MOUNT_DIR/.dlscd; then . $MOUNT_DIR/.dlscd /home/dlsadmin/nexedi-dls/autoconf.py nexedi $host_id if test -f $MOUNT_DIR/config.tgz; then (cd /; tar zxpvf $MOUNT_DIR/config.tgz) fi if test -f $MOUNT_DIR/config.sh; then (cd /; /bin/sh $MOUNT_DIR/config.sh) fi home=/home/$master_hostname test -d $home || mkdir $home if test $dls_type = master; then mount --bind $MOUNT_DIR/home $home else mount -t nfs $master_ip_addr:$home $home fi # Make a lock file. touch /var/lock/subsys/dlscdtool exit fi # Failed. exit 1 } # Stop this script. Quite simple. Just stop services and unmount the filesystem. stop() { #gprintf "Stopping ${NAME}: " if test -f $MOUNT_DIR/.dlscd; then . $MOUNT_DIR/.dlscd home=/home/$master_hostname umount $home fi # Remove the lock file. rm -f /var/lock/subsys/dlscdtool } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) gprintf "Usage: %s {start|stop|restart}\n" "$0" exit 1 esac