lvm2/cluster-locking-built-in.patch
2006-10-20 21:15:26 +00:00

101 lines
3.0 KiB
Diff

--- LVM2.2.02.12-old/scripts/lvmconf.sh 2006-09-20 18:36:47.000000000 +0100
+++ LVM2.2.02.12/scripts/lvmconf.sh 2006-10-20 19:20:26.000000000 +0100
@@ -36,7 +36,7 @@ function parse_args
while [ -n "$1" ]; do
case $1 in
--enable-cluster)
- LOCKING_TYPE=2
+ LOCKING_TYPE=3
shift
;;
--disable-cluster)
@@ -94,15 +94,13 @@ function validate_args
if [ -n "$LOCKINGLIBDIR" ]; then
- [ -z "$LOCKINGLIB" ] && LOCKINGLIB="liblvm2clusterlock.so"
-
if [ "${LOCKINGLIBDIR:0:1}" != "/" ]
then
echo "Prefix must be an absolute path name (starting with a /)"
exit 12
fi
- if [ ! -f "$LOCKINGLIBDIR/$LOCKINGLIB" ]
+ if [ -n "$LOCKINGLIB" ] && [ ! -f "$LOCKINGLIBDIR/$LOCKINGLIB" ]
then
echo "$LOCKINGLIBDIR/$LOCKINGLIB does not exist, did you do a \"make install\" ?"
exit 11
@@ -170,13 +168,29 @@ then
if [ -z "$LOCKING_TYPE" ]; then
LOCKING_TYPE=1
fi
- if [ "$LOCKING_TYPE" = "2" ]; then
+ if [ "$LOCKING_TYPE" = "3" ] || [ "$LOCKING_TYPE" = "2" ]; then
cat $CONFIGFILE - <<EOF > $TMPFILE
global {
# Enable locking for cluster LVM
locking_type = $LOCKING_TYPE
library_dir = "$LOCKINGLIBDIR"
+EOF
+ if [ $? != 0 ]
+ then
+ echo "failed to create temporary config file, $CONFIGFILE not updated"
+ exit 14
+ fi
+ if [ -n "$LOCKINGLIB" ]; then
+ cat - <<EOF >> $TMPFILE
locking_library = "$LOCKINGLIB"
+EOF
+ if [ $? != 0 ]
+ then
+ echo "failed to create temporary config file, $CONFIGFILE not updated"
+ exit 16
+ fi
+ fi
+ cat - <<EOF >> $TMPFILE
}
EOF
fi # if we aren't setting cluster locking, we don't need to create a global section
@@ -184,7 +198,7 @@ EOF
if [ $? != 0 ]
then
echo "failed to create temporary config file, $CONFIGFILE not updated"
- exit 14
+ exit 17
fi
else
#
@@ -208,8 +222,10 @@ else
else
SEDCMD="${SEDCMD}\n/global[[:blank:]]*{/a\ \ \ \ library_dir = \"$LOCKINGLIBDIR\""
fi
+ fi
- if [ "$have_library" = "0" ]
+ if [ -n "$LOCKINGLIB" ]; then
+ if [ "$have_library" = "0" ]
then
SEDCMD="${SEDCMD}\ns/^[[:blank:]]*locking_library[[:blank:]]*=.*/\ \ \ \ locking_library = \"$LOCKINGLIB\"/g"
else
@@ -217,19 +233,6 @@ else
fi
fi
- if [ "$LOCKING_TYPE" = "1" ]; then
- # if we're not using cluster locking, remove the library dir and locking library name
- if [ "$have_dir" = "0" ]
- then
- SEDCMD="${SEDCMD}\n/^[[:blank:]]*library_dir[[:blank:]]*=.*/d"
- fi
-
- if [ "$have_library" = "0" ]
- then
- SEDCMD="${SEDCMD}\n/^[[:blank:]]*locking_library[[:blank:]]*=.*/d"
- fi
- fi
-
echo -e $SEDCMD > $SCRIPTFILE
sed <$CONFIGFILE >$TMPFILE -f $SCRIPTFILE
if [ $? != 0 ]