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

clvmd_fix_conf.sh: double quote

This commit is contained in:
Zdenek Kabelac 2017-06-29 22:07:49 +02:00
parent 99925d0d41
commit 191dadc623

View File

@ -63,21 +63,20 @@ have_dir=1
have_library=1 have_library=1
have_global=1 have_global=1
grep -q '^[[:blank:]]*locking_type[[:blank:]]*=' $LVMCONF grep -q '^[[:blank:]]*locking_type[[:blank:]]*=' "$LVMCONF"
have_type=$? have_type=$?
grep -q '^[[:blank:]]*library_dir[[:blank:]]*=' $LVMCONF grep -q '^[[:blank:]]*library_dir[[:blank:]]*=' "$LVMCONF"
have_dir=$? have_dir=$?
grep -q '^[[:blank:]]*locking_library[[:blank:]]*=' $LVMCONF grep -q '^[[:blank:]]*locking_library[[:blank:]]*=' "$LVMCONF"
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" -o "$have_dir" = "0" -o "$have_library" = "0" ] if [ "$have_type" = 0 ] || [ "$have_dir" = 0 ] || [ "$have_library" = 0 ] ; then
then
# See if we can find it... # See if we can find it...
grep -q '^[[:blank:]]*global[[:blank:]]*{' $LVMCONF grep -q '^[[:blank:]]*global[[:blank:]]*{' "$LVMCONF"
have_global=$? have_global=$?
if [ "$have_global" = "1" ] if [ "$have_global" = "1" ]
@ -92,7 +91,7 @@ fi
if [ "$have_global" = "1" ] if [ "$have_global" = "1" ]
then then
cat $LVMCONF - <<EOF > $TMPFILE cat "$LVMCONF" - <<EOF > "$TMPFILE"
global { global {
# Enable locking for cluster LVM # Enable locking for cluster LVM
locking_type = $locking_type locking_type = $locking_type
@ -132,8 +131,8 @@ else
SEDCMD="${SEDCMD}\n/global[[:blank:]]*{/a\ \ \ \ locking_library = \"$LIB\"" SEDCMD="${SEDCMD}\n/global[[:blank:]]*{/a\ \ \ \ locking_library = \"$LIB\""
fi fi
echo -e $SEDCMD > $SCRIPTFILE echo -e "$SEDCMD" > "$SCRIPTFILE"
sed <$LVMCONF >$TMPFILE -f $SCRIPTFILE sed <"$LVMCONF" >"$TMPFILE" -f "$SCRIPTFILE"
if [ $? != 0 ] if [ $? != 0 ]
then then
echo "sed failed, $LVMCONF not updated" echo "sed failed, $LVMCONF not updated"
@ -144,19 +143,19 @@ 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 $LVMCONF $LVMCONF.nocluster cp "$LVMCONF" "$LVMCONF.nocluster"
if [ $? != 0 ] if [ $? != 0 ]
then then
echo "failed to backup old config file, $LVMCONF not updated" echo "failed to backup old config file, $LVMCONF not updated"
exit 2 exit 2
fi fi
cp $TMPFILE $LVMCONF cp "$TMPFILE" "$LVMCONF"
if [ $? != 0 ] if [ $? != 0 ]
then then
echo "failed to copy new config file into place, check $LVMCONF is still OK" echo "failed to copy new config file into place, check $LVMCONF is still OK"
exit 3 exit 3
fi fi
rm -f $SCRIPTFILE $TMPFILE rm -f "$SCRIPTFILE" "$TMPFILE"