Whamcloud - gitweb
96d074dc111521a981fab551f1dad180ff34f7dd
[fs/lustre-release.git] / lustre / demos / config.sh
1 #!/bin/sh
2 # File which holds configuation parameters in a single place to avoid any
3 # mismatch between scripts (especially the cleanup scripts, which are
4 # destructive).
5 #set -vx
6
7 # Major number for OBD devices
8 OBDMAJ=186
9
10 # Module configuration file
11 [ -f /etc/conf.modules ] && MODCONF=/etc/conf.modules
12 [ -z "$MODCONF" -a -f /etc/modules.conf ] && MODCONF=/etc/modules.conf
13
14 # If LOOPDEV is empty (""), then no loopback device will be configured.
15 # If TMPFILE is empty (""), then no temporary file will be created for loop.
16 [ "$TMPFILE" ] || TMPFILE="/tmp/obdfs.tmpfile"
17 [ "$TMPSIZE" ] || TMPSIZE=10240
18 [ -b /dev/loop/0 ] && LOOPDEV=/dev/loop/0
19 [ -z "$LOOPDEV" -a -b /dev/loop0 ] && LOOPDEV="/dev/loop0"
20
21 # If LOOPDEV is empty, then it is assumed that BASEDEV is a real block device
22 # that doesn't mind being overwritten - don't use a partition with data on it!!
23 BASEDEV="$LOOPDEV"
24
25 # The following are mount points for the filesystems during the test.
26 MNTOBD="/mnt/obd"
27 MNTSNAP="/mnt/snap"
28 MNTSNAP2="/mnt/snap2"
29
30 # This is where the snapshot table will be stored:
31 SNAPTABLE="/tmp/obdfs.snaptable"
32
33 # A simple routine called by most of the scripts to help debugging.  The
34 # kernel code has a lot of debugging statements, so this helps us keep
35 # track of what is going on in user-land to generate the kernel messages.
36 plog () {
37     if [ "$1" = "log" ]; then
38         shift
39         logger -p kern.info "******** $* **********"
40         echo "$*"
41     else
42         logger -p kern.info "****start**** $* *****"
43         echo "$*"
44         $*
45         logger -p kern.info "*****end***** $* *****"
46     fi
47 }
48
49 # A routine to display a command, and prompt user if it should be run
50 qrun () {
51     echo
52     echo -n "Run '$*' [Y/n]?'";
53     read JUNK
54
55     case $JUNK in
56         n*|N*) echo "'$*' not run" ;;
57         *) plog $* ;;
58     esac
59 }