diff options
author | Patrick Caulfield <pcaulfie@redhat.com> | 2004-12-01 14:47:31 +0000 |
---|---|---|
committer | Patrick Caulfield <pcaulfie@redhat.com> | 2004-12-01 14:47:31 +0000 |
commit | 838ebb8378500bce5eef5ce6acc2db41bd41a25c (patch) | |
tree | 8c512d2aee6d07981a665d1b5ec1f8716b3c43f6 /scripts/clvmd_fix_conf.sh | |
parent | 0ef6cc3f82d7740669ce9f3c77336c22f28cc463 (diff) | |
download | lvm2-838ebb8378500bce5eef5ce6acc2db41bd41a25c.tar.gz lvm2-838ebb8378500bce5eef5ce6acc2db41bd41a25c.tar.xz lvm2-838ebb8378500bce5eef5ce6acc2db41bd41a25c.zip |
Make clvmd_fix_conf.sh UNDOable
Diffstat (limited to 'scripts/clvmd_fix_conf.sh')
-rw-r--r-- | scripts/clvmd_fix_conf.sh | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/scripts/clvmd_fix_conf.sh b/scripts/clvmd_fix_conf.sh index 9e363d52..a00263c1 100644 --- a/scripts/clvmd_fix_conf.sh +++ b/scripts/clvmd_fix_conf.sh @@ -15,9 +15,10 @@ if [ -z "$PREFIX" ] then echo "usage: $0 <prefix> [<config file>] [<library>]" echo "" - echo "<prefix> location of the cluster locking shared library. (no default)" - echo "<config file> name of the LVM config file (default: /etc/lvm/lvm.conf)" - echo "<library> name of the shared library (default: liblvm2clusterlock.so)" + echo "<prefix>|UNDO location of the cluster locking shared library. (no default)" + echo " UNDO will reset the locking back to local" + echo "<config file> name of the LVM config file (default: /etc/lvm/lvm.conf)" + echo "<library> name of the shared library (default: liblvm2clusterlock.so)" echo "" exit 0 fi @@ -25,10 +26,23 @@ fi [ -z "$LVMCONF" ] && LVMCONF="/etc/lvm/lvm.conf" [ -z "$LIB" ] && LIB="liblvm2clusterlock.so" -if [ "${PREFIX:0:1}" != "/" ] +if [ "$PREFIX" = "UNDO" ] then - echo "Prefix must be an absolute path name (starting with a /)" - exit 12 + locking_type="1" +else + locking_type="2" + + if [ "${PREFIX:0:1}" != "/" ] + then + echo "Prefix must be an absolute path name (starting with a /)" + exit 12 + fi + + if [ ! -f "$PREFIX/$LIB" ] + then + echo "$PREFIX/$LIB does not exist, did you do a \"make install\" ?" + exit 11 + fi fi if [ ! -f "$LVMCONF" ] @@ -37,12 +51,6 @@ then exit 10 fi -if [ ! -f "$PREFIX/$LIB" ] -then - echo "$PREFIX/$LIB does not exist, did you do a \"make install\" ?" - exit 11 -fi - SCRIPTFILE=`mktemp -t lvmscript.XXXXXXXXXX` TMPFILE=`mktemp -t lvmtmp.XXXXXXXXXX` @@ -87,7 +95,7 @@ then cat $LVMCONF - <<EOF > $TMPFILE global { # Enable locking for cluster LVM - locking_type = 2 + locking_type = $locking_type library_dir = "$PREFIX" locking_library = "$LIB" } @@ -105,7 +113,7 @@ else if [ "$have_type" = "0" ] then - SEDCMD=" s/^[[:blank:]]*locking_type[[:blank:]]*=.*/\ \ \ \ locking_type = 2/g" + SEDCMD=" s/^[[:blank:]]*locking_type[[:blank:]]*=.*/\ \ \ \ locking_type = $locking_type/g" else SEDCMD=" /global[[:blank:]]*{/a\ \ \ \ locking_type = 2" fi |