Whamcloud - gitweb
demos/*: update demos to handle module autoloading (Steve Bruggeman)
[fs/lustre-release.git] / lustre / demos / config.sh
index 713a199..51f4df5 100644 (file)
@@ -7,9 +7,14 @@
 # Major number for OBD devices
 OBDMAJ=186
 
+# Module configuration file
+[ -f /etc/conf.modules ] && MODCONF=/etc/conf.modules
+[ -z "$MODCONF" -a -f /etc/modules.conf ] && MODCONF=/etc/modules.conf
+
 # If LOOPDEV is empty (""), then no loopback device will be configured.
 # If TMPFILE is empty (""), then no temporary file will be created for loop.
-TMPFILE="/tmp/obdfs.tmpfile"
+[ "$TMPFILE" ] || TMPFILE="/tmp/obdfs.tmpfile"
+[ "$TMPSIZE" ] || TMPSIZE=10240
 LOOPDEV="/dev/loop0"
 
 # If LOOPDEV is empty, then it is assumed that BASEDEV is a real block device
@@ -30,14 +35,24 @@ SNAPTABLE="/tmp/obdfs.snaptable"
 plog () {
     if [ "$1" = "log" ]; then
        shift
-       echo "******** $* **********" >> /var/log/messages
+       logger -p kern.info "******** $* **********"
        echo "$*"
     else
-       echo "****start**** $* *****" >> /var/log/messages
+       logger -p kern.info "****start**** $* *****"
        echo "$*"
        $*
-       # sleep 3 # to allow messages to be flushed
-       echo "*****end***** $* *****" >> /var/log/messages
+       logger -p kern.info "*****end***** $* *****"
     fi
 }
 
+# A routine to display a command, and prompt user if it should be run
+qrun () {
+    echo
+    echo -n "Run '$*' [Y/n]?'";
+    read JUNK
+
+    case $JUNK in
+       n*|N*) echo "'$*' not run" ;;
+       *) plog $* ;;
+    esac
+}