mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
lvmconf_lockingtype2: double quote
This commit is contained in:
parent
ef8691a2d2
commit
051c7f88cf
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
|
# Copyright (C) 2004-2017 Red Hat, Inc. All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of the lvm2-cluster package.
|
# This file is part of the lvm2-cluster package.
|
||||||
#
|
#
|
||||||
@ -34,7 +34,7 @@ function usage
|
|||||||
function parse_args
|
function parse_args
|
||||||
{
|
{
|
||||||
while [ -n "$1" ]; do
|
while [ -n "$1" ]; do
|
||||||
case $1 in
|
case "$1" in
|
||||||
--enable-cluster)
|
--enable-cluster)
|
||||||
LOCKING_TYPE=2
|
LOCKING_TYPE=2
|
||||||
shift
|
shift
|
||||||
@ -135,19 +135,19 @@ have_dir=1
|
|||||||
have_library=1
|
have_library=1
|
||||||
have_global=1
|
have_global=1
|
||||||
|
|
||||||
grep -q '^[[:blank:]]*locking_type[[:blank:]]*=' $CONFIGFILE
|
grep -q '^[[:blank:]]*locking_type[[:blank:]]*=' "$CONFIGFILE"
|
||||||
have_type=$?
|
have_type=$?
|
||||||
|
|
||||||
grep -q '^[[:blank:]]*library_dir[[:blank:]]*=' $CONFIGFILE
|
grep -q '^[[:blank:]]*library_dir[[:blank:]]*=' "$CONFIGFILE"
|
||||||
have_dir=$?
|
have_dir=$?
|
||||||
|
|
||||||
grep -q '^[[:blank:]]*locking_library[[:blank:]]*=' $CONFIGFILE
|
grep -q '^[[:blank:]]*locking_library[[:blank:]]*=' "$CONFIGFILE"
|
||||||
have_library=$?
|
have_library=$?
|
||||||
|
|
||||||
# Those options are in section "global {" so we must have one if any are present.
|
# Those options are in section "global {" so we must have one if any are present.
|
||||||
if [ "$have_type" = "0" ] || [ "$have_dir" = "0" ] || [ "$have_library" = "0" ]; then
|
if [ "$have_type" = "0" ] || [ "$have_dir" = "0" ] || [ "$have_library" = "0" ]; then
|
||||||
# See if we can find it...
|
# See if we can find it...
|
||||||
grep -q '^[[:blank:]]*global[[:blank:]]*{' $CONFIGFILE
|
grep -q '^[[:blank:]]*global[[:blank:]]*{' "$CONFIGFILE"
|
||||||
have_global=$?
|
have_global=$?
|
||||||
|
|
||||||
if [ "$have_global" = "1" ]
|
if [ "$have_global" = "1" ]
|
||||||
@ -171,7 +171,7 @@ then
|
|||||||
LOCKING_TYPE=1
|
LOCKING_TYPE=1
|
||||||
fi
|
fi
|
||||||
if [ "$LOCKING_TYPE" = "2" ]; then
|
if [ "$LOCKING_TYPE" = "2" ]; then
|
||||||
cat $CONFIGFILE - <<EOF > $TMPFILE
|
cat "$CONFIGFILE" - <<EOF > $TMPFILE
|
||||||
global {
|
global {
|
||||||
# Enable locking for cluster LVM
|
# Enable locking for cluster LVM
|
||||||
locking_type = $LOCKING_TYPE
|
locking_type = $LOCKING_TYPE
|
||||||
@ -230,8 +230,8 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -e $SEDCMD > $SCRIPTFILE
|
echo -e "$SEDCMD" > "$SCRIPTFILE"
|
||||||
sed <$CONFIGFILE >$TMPFILE -f $SCRIPTFILE
|
sed <"$CONFIGFILE" >"$TMPFILE" -f "$SCRIPTFILE"
|
||||||
if [ $? != 0 ]
|
if [ $? != 0 ]
|
||||||
then
|
then
|
||||||
echo "sed failed, $CONFIGFILE not updated"
|
echo "sed failed, $CONFIGFILE not updated"
|
||||||
@ -242,18 +242,18 @@ fi
|
|||||||
# Now we have a suitably editted config file in a temp place,
|
# Now we have a suitably editted config file in a temp place,
|
||||||
# backup the original and copy our new one into place.
|
# backup the original and copy our new one into place.
|
||||||
|
|
||||||
cp $CONFIGFILE $CONFIGFILE.lvmconfold
|
cp "$CONFIGFILE" "$CONFIGFILE.lvmconfold"
|
||||||
if [ $? != 0 ]
|
if [ $? != 0 ]
|
||||||
then
|
then
|
||||||
echo "failed to backup old config file, $CONFIGFILE not updated"
|
echo "failed to backup old config file, $CONFIGFILE not updated"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp $TMPFILE $CONFIGFILE
|
cp "$TMPFILE" "$CONFIGFILE"
|
||||||
if [ $? != 0 ]
|
if [ $? != 0 ]
|
||||||
then
|
then
|
||||||
echo "failed to copy new config file into place, check $CONFIGFILE is still OK"
|
echo "failed to copy new config file into place, check $CONFIGFILE is still OK"
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f $SCRIPTFILE $TMPFILE
|
rm -f "$SCRIPTFILE" "$TMPFILE"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user