1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Make clvmd_fix_conf.sh UNDOable

This commit is contained in:
Patrick Caulfield 2004-12-01 14:47:31 +00:00
parent 0ef6cc3f82
commit 838ebb8378
2 changed files with 23 additions and 14 deletions

View File

@ -16,6 +16,7 @@ Version 2.00.27 - 24th November 2004
Trap large memory allocation requests. Trap large memory allocation requests.
Fix to partition table detection code. Fix to partition table detection code.
Improve filter debug mesgs. Improve filter debug mesgs.
Make clvmd_fix_conf.sh UNDOable
Version 2.00.26 - 23rd November 2004 Version 2.00.26 - 23rd November 2004
==================================== ====================================

View File

@ -15,9 +15,10 @@ if [ -z "$PREFIX" ]
then then
echo "usage: $0 <prefix> [<config file>] [<library>]" echo "usage: $0 <prefix> [<config file>] [<library>]"
echo "" echo ""
echo "<prefix> location of the cluster locking shared library. (no default)" echo "<prefix>|UNDO location of the cluster locking shared library. (no default)"
echo "<config file> name of the LVM config file (default: /etc/lvm/lvm.conf)" echo " UNDO will reset the locking back to local"
echo "<library> name of the shared library (default: liblvm2clusterlock.so)" 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 "" echo ""
exit 0 exit 0
fi fi
@ -25,10 +26,23 @@ fi
[ -z "$LVMCONF" ] && LVMCONF="/etc/lvm/lvm.conf" [ -z "$LVMCONF" ] && LVMCONF="/etc/lvm/lvm.conf"
[ -z "$LIB" ] && LIB="liblvm2clusterlock.so" [ -z "$LIB" ] && LIB="liblvm2clusterlock.so"
if [ "${PREFIX:0:1}" != "/" ] if [ "$PREFIX" = "UNDO" ]
then then
echo "Prefix must be an absolute path name (starting with a /)" locking_type="1"
exit 12 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 fi
if [ ! -f "$LVMCONF" ] if [ ! -f "$LVMCONF" ]
@ -37,12 +51,6 @@ then
exit 10 exit 10
fi 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` SCRIPTFILE=`mktemp -t lvmscript.XXXXXXXXXX`
TMPFILE=`mktemp -t lvmtmp.XXXXXXXXXX` TMPFILE=`mktemp -t lvmtmp.XXXXXXXXXX`
@ -87,7 +95,7 @@ then
cat $LVMCONF - <<EOF > $TMPFILE cat $LVMCONF - <<EOF > $TMPFILE
global { global {
# Enable locking for cluster LVM # Enable locking for cluster LVM
locking_type = 2 locking_type = $locking_type
library_dir = "$PREFIX" library_dir = "$PREFIX"
locking_library = "$LIB" locking_library = "$LIB"
} }
@ -105,7 +113,7 @@ else
if [ "$have_type" = "0" ] if [ "$have_type" = "0" ]
then then
SEDCMD=" s/^[[:blank:]]*locking_type[[:blank:]]*=.*/\ \ \ \ locking_type = 2/g" SEDCMD=" s/^[[:blank:]]*locking_type[[:blank:]]*=.*/\ \ \ \ locking_type = $locking_type/g"
else else
SEDCMD=" /global[[:blank:]]*{/a\ \ \ \ locking_type = 2" SEDCMD=" /global[[:blank:]]*{/a\ \ \ \ locking_type = 2"
fi fi