2 # Get the locations for the files from a single place to avoid confusion
4 # Copyright (C) 2001 Cluster File Systems, Inc.
6 # This code is issued under the GNU General Public License.
7 # See the file COPYING in this distribution
8 OBDDIR="`dirname $0`/.."
11 . $OBDDIR/demos/config.sh
13 # module configuration
14 if [ "$MODCONF" -a -f $MODCONF ]; then
15 if [ -z "`grep -i "alias *char-major-$OBDMAJ *obdclass" $MODCONF`" ]; then
16 if [ -d /etc/modutils ]; then
17 # Debian-style modules configuration.
18 echo "alias char-major-${OBDMAJ} obdclass" > /etc/modutils/obd
21 echo "alias char-major-${OBDMAJ} obdclass" >>$MODCONF
28 if [ "$LOOPDEV" -a "$TMPFILE" -a -f $TMPFILE ]; then
29 echo "$TMPFILE exists; I'm unwilling to overwrite it. Remove [N/y]?" 1>&2
31 [ -f $TMPFILE ] && exit 1
33 [ "$TMPFILE" ] && dd if=/dev/zero of=$TMPFILE bs=1k count=$TMPSIZE
37 if [ "$LOOPDEV" ]; then
38 insmod loop > /dev/null 2>&1
39 if [ -a "`losetup $LOOPDEV 2> /dev/null`" ]; then
40 echo "It appears that $LOOPDEV is in use. Unable to continue" 1>&2
41 echo "You need to clean up $LOOPDEV (via cleanup.sh),"
42 echo "or you can change which device is used in demos/config.sh" 1>&2
44 [ "$TMPFILE" ] && rm $TMPFILE
47 losetup $LOOPDEV $TMPFILE
50 # Ensure that we have the correct devices for OBD to work
51 [ ! -c /dev/obd0 ] && mknod /dev/obd0 c $OBDMAJ 0
52 [ ! -c /dev/obd1 ] && mknod /dev/obd1 c $OBDMAJ 1
53 [ ! -c /dev/obd2 ] && mknod /dev/obd2 c $OBDMAJ 2
56 if [ "$BASEDEV" ]; then
57 mke2fs -r 0 -b 4096 $BASEDEV
59 echo "\$BASEDEV not defined in demos/config.sh. Please fix!"
60 [ "$LOOPDEV" ] && losetup -d $LOOPDEV
61 [ "$TMPFILE" ] && rm $TMPFILE