1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

shellcheck: some apostrophe changes and cleanups

This commit is contained in:
Zdenek Kabelac 2017-10-25 17:02:31 +02:00
parent 34618c2d30
commit 35df4b10eb
9 changed files with 59 additions and 61 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# Copyright (C) 2012 Red Hat, Inc. All rights reserved. # Copyright (C) 2012-2017 Red Hat, Inc. All rights reserved.
# #
# This copyrighted material is made available to anyone wishing to use, # This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions # modify, copy, or redistribute it subject to the terms and conditions
@ -40,12 +40,12 @@ LOCK_FILE="@DEFAULT_LOCK_DIR@/subsys/blk-availability"
case "$1" in case "$1" in
start) start)
touch $LOCK_FILE touch "$LOCK_FILE"
;; ;;
stop) stop)
action "Stopping block device availability:" $sbindir/$script $options action "Stopping block device availability:" "$sbindir/$script" $options
rm -f $LOCK_FILE rm -f "$LOCK_FILE"
;; ;;
status) status)

View File

@ -300,7 +300,7 @@ deactivate_md () {
echo -n " [MD]: deactivating $devtype device $kname... " echo -n " [MD]: deactivating $devtype device $kname... "
test "$MDRAID_DO_WAIT" -eq 1 && { test "$MDRAID_DO_WAIT" -eq 1 && {
sync_action="$(cat $SYS_BLK_DIR/$kname/md/sync_action)" sync_action=$(cat "$SYS_BLK_DIR/$kname/md/sync_action")
test "$sync_action" != "idle" && { test "$sync_action" != "idle" && {
echo -n "$sync_action action in progress... " echo -n "$sync_action action in progress... "
if eval "$MDADM" $MDADM_OPTS -W "$DEV_DIR/$kname" "$OUT" "$ERR"; then if eval "$MDADM" $MDADM_OPTS -W "$DEV_DIR/$kname" "$OUT" "$ERR"; then

View File

@ -23,15 +23,15 @@ DAEMON=clvmd
sbindir="@SBINDIR@" sbindir="@SBINDIR@"
usrsbindir="@USRSBINDIR@" usrsbindir="@USRSBINDIR@"
lvm_vgchange=${sbindir}/vgchange lvm_vgchange="$sbindir/vgchange"
lvm_vgs=${sbindir}/vgs lvm_vgs="$sbindir/vgs"
lvm_vgscan=${sbindir}/vgscan lvm_vgscan="$sbindir/vgscan"
lvm_lvs=${sbindir}/lvs lvm_lvs="$sbindir/lvs"
CLVMDOPTS="-T30" CLVMDOPTS="-T30"
[ -f /etc/sysconfig/cluster ] && . /etc/sysconfig/cluster [ -f /etc/sysconfig/cluster ] && . /etc/sysconfig/cluster
[ -f /etc/sysconfig/$DAEMON ] && . /etc/sysconfig/$DAEMON [ -f "/etc/sysconfig/$DAEMON" ] && . "/etc/sysconfig/$DAEMON"
[ -n "$CLVMD_CLUSTER_IFACE" ] && CLVMDOPTS="$CLVMDOPTS -I $CLVMD_CLUSTER_IFACE" [ -n "$CLVMD_CLUSTER_IFACE" ] && CLVMDOPTS="$CLVMDOPTS -I $CLVMD_CLUSTER_IFACE"
@ -43,15 +43,15 @@ CLVMDOPTS="-T30"
LOCK_FILE="/var/lock/subsys/$DAEMON" LOCK_FILE="/var/lock/subsys/$DAEMON"
clustered_vgs() { clustered_vgs() {
${lvm_vgs} --noheadings -o vg_name -S 'vg_clustered=1' 2>/dev/null "$lvm_vgs" --noheadings -o vg_name -S 'vg_clustered=1' 2>/dev/null
} }
clustered_active_lvs() { clustered_active_lvs() {
${lvm_lvs} --noheadings -o lv_name -S 'vg_clustered=1 && lv_active!=""' 2>/dev/null "$lvm_lvs" --noheadings -o lv_name -S 'vg_clustered=1 && lv_active!=""' 2>/dev/null
} }
rh_status() { rh_status() {
status $DAEMON status "$DAEMON"
} }
rh_status_q() { rh_status_q() {
@ -81,11 +81,11 @@ start()
# Ideally vgscan should have a startup mode that would not print # Ideally vgscan should have a startup mode that would not print
# unnecessary warnings. # unnecessary warnings.
${lvm_vgscan} > /dev/null 2>&1 "$lvm_vgscan" > /dev/null 2>&1
action "Activating VG(s):" ${lvm_vgchange} -aay $LVM_VGS || return $? action "Activating VG(s):" "$lvm_vgchange" -aay $LVM_VGS || return $?
touch $LOCK_FILE touch "$LOCK_FILE"
return 0 return 0
} }
@ -108,10 +108,10 @@ stop()
[ -z "$LVM_VGS" ] && LVM_VGS="$(clustered_vgs)" [ -z "$LVM_VGS" ] && LVM_VGS="$(clustered_vgs)"
if [ -n "$LVM_VGS" ]; then if [ -n "$LVM_VGS" ]; then
action "Deactivating clustered VG(s):" ${lvm_vgchange} -anl $LVM_VGS || return $? action "Deactivating clustered VG(s):" "$lvm_vgchange" -anl $LVM_VGS || return $?
fi fi
action "Signaling $DAEMON to exit" kill -TERM $(pidofproc $DAEMON) || return $? action "Signaling $DAEMON to exit" kill -TERM "$(pidofproc "$DAEMON")" || return $?
# wait half second before we start the waiting loop or we will show # wait half second before we start the waiting loop or we will show
# the loop more time than really necessary # the loop more time than really necessary
@ -131,7 +131,7 @@ stop()
echo echo
fi fi
rm -f $LOCK_FILE rm -f "$LOCK_FILE"
return 0 return 0
} }
@ -156,7 +156,7 @@ restart() {
stop && start stop && start
return $? return $?
else else
touch $LOCK_FILE touch "$LOCK_FILE"
return 0 return 0
fi fi
} }
@ -197,7 +197,7 @@ case "$1" in
status) status)
rh_status rh_status
rtrn=$? rtrn=$?
if [ $rtrn = 0 ]; then if [ "$rtrn" = 0 ]; then
cvgs="$(clustered_vgs)" cvgs="$(clustered_vgs)"
echo Clustered Volume Groups: ${cvgs:-"(none)"} echo Clustered Volume Groups: ${cvgs:-"(none)"}
clvs="$(clustered_active_lvs)" clvs="$(clustered_active_lvs)"

View File

@ -25,8 +25,8 @@ LOCK_FILE="@DEFAULT_SYS_LOCK_DIR@/subsys/$DAEMON"
start() start()
{ {
rtrn=0 rtrn=0
if ! pidof $DAEMON > /dev/null if ! pidof "$DAEMON" > /dev/null
then then
echo -n "Starting $DAEMON: " echo -n "Starting $DAEMON: "
daemon "$usrsbindir/$DAEMON" daemon "$usrsbindir/$DAEMON"
rtrn=$? rtrn=$?
@ -39,7 +39,7 @@ start()
stop() stop()
{ {
echo -n "Stopping $DAEMON:" echo -n "Stopping $DAEMON:"
killproc $DAEMON -TERM killproc "$DAEMON" -TERM
rtrn=$? rtrn=$?
echo echo
@ -55,8 +55,8 @@ wait_for_finish()
sleep 1 sleep 1
count=$((count + 1)) count=$((count + 1))
done done
if [ `pidof $DAEMON` ] if [ "$(pidof "$DAEMON")" ]
then then
return 1 return 1
else else
@ -66,7 +66,7 @@ wait_for_finish()
cmirror_status() cmirror_status()
{ {
status $DAEMON status "$DAEMON"
} }
rtrn=1 rtrn=1
@ -76,13 +76,13 @@ case "$1" in
start) start)
start start
rtrn=$? rtrn=$?
[ $rtrn = 0 ] && touch $LOCK_FILE [ "$rtrn" = 0 ] && touch "$LOCK_FILE"
;; ;;
stop) stop)
stop stop
rtrn=$? rtrn=$?
[ $rtrn = 0 ] && rm -f $LOCK_FILE [ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
;; ;;
restart) restart)
@ -97,7 +97,7 @@ case "$1" in
status) status)
cmirror_status cmirror_status
rtrn=$? rtrn=$?
if [ $rtrn -eq 0 ]; then if [ "$rtrn" -eq 0 ]; then
echo "cmirror is running." echo "cmirror is running."
fi fi
;; ;;

View File

@ -2,13 +2,13 @@
sbindir="@SBINDIR@" sbindir="@SBINDIR@"
lvm_vgchange="${sbindir}/vgchange" lvm_vgchange="$sbindir/vgchange"
lvm_vgscan="${sbindir}/vgscan" lvm_vgscan="$sbindir/vgscan"
lvm_vgs="${sbindir}/vgs" lvm_vgs="$sbindir/vgs"
lvm_lvm="${sbindir}/lvm" lvm_lvm="$sbindir/lvm"
clustered_vgs() { clustered_vgs() {
"${lvm_vgs}" --noheadings -o vg_name -S 'vg_clustered=1' 2>/dev/null "$lvm_vgs" --noheadings -o vg_name -S 'vg_clustered=1' 2>/dev/null
} }
activate() { activate() {
@ -19,13 +19,13 @@ activate() {
if [ -z "$obtain_device_list_from_udev" ] || [ "$obtain_device_list_from_udev" -ne 1 ]; then if [ -z "$obtain_device_list_from_udev" ] || [ "$obtain_device_list_from_udev" -ne 1 ]; then
echo -n "lvm.conf option obtain_device_list_from_udev!=1: Executing vgscan" echo -n "lvm.conf option obtain_device_list_from_udev!=1: Executing vgscan"
"${lvm_vgscan}" > /dev/null 2>&1 "$lvm_vgscan" > /dev/null 2>&1
fi fi
echo -n "Activating ${LVM_VGS:-"all VG(s)"}: " echo -n "Activating ${LVM_VGS:-"all VG(s)"}: "
# Respect activation/auto_activation_volume_list! # Respect activation/auto_activation_volume_list!
# Call "-aay" which is equal to "-aly" but respects this list. # Call "-aay" which is equal to "-aly" but respects this list.
"${lvm_vgchange}" -aay $LVM_VGS || return 1 "$lvm_vgchange" -aay $LVM_VGS || return 1
return 0 return 0
} }
@ -38,7 +38,7 @@ deactivate()
[ -z "$LVM_VGS" ] && LVM_VGS="$(clustered_vgs)" [ -z "$LVM_VGS" ] && LVM_VGS="$(clustered_vgs)"
if [ -n "$LVM_VGS" ]; then if [ -n "$LVM_VGS" ]; then
echo -n "Deactivating clustered VG(s): " echo -n "Deactivating clustered VG(s): "
"${lvm_vgchange}" -anl $LVM_VGS || return 1 "$lvm_vgchange" -anl $LVM_VGS || return 1
fi fi
return 0 return 0

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# Copyright (C) 2012 Red Hat, Inc. All rights reserved. # Copyright (C) 2012-2017 Red Hat, Inc. All rights reserved.
# #
# This copyrighted material is made available to anyone wishing to use, # This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions # modify, copy, or redistribute it subject to the terms and conditions
@ -41,7 +41,7 @@ LOCK_FILE="@DEFAULT_SYS_LOCK_DIR@/subsys/$DAEMON"
PID_FILE="@LVMETAD_PIDFILE@" PID_FILE="@LVMETAD_PIDFILE@"
rh_status() { rh_status() {
status -p $PID_FILE $DAEMON status -p "$PID_FILE" "$DAEMON"
} }
rh_status_q() { rh_status_q() {
@ -55,11 +55,10 @@ start()
return $ret return $ret
} }
stop() stop()
{ {
ret=0 ret=0
action "Signaling LVM metadata daemon to exit:" killproc -p $PID_FILE $DAEMON -TERM || ret=$? action "Signaling LVM metadata daemon to exit:" killproc -p "$PID_FILE" "$DAEMON" -TERM || ret=$?
return $ret return $ret
} }
@ -71,14 +70,14 @@ case "$1" in
rh_status_q && exit 0 rh_status_q && exit 0
start start
rtrn=$? rtrn=$?
[ $rtrn = 0 ] && touch $LOCK_FILE [ "$rtrn" = 0 ] && touch "$LOCK_FILE"
;; ;;
stop|force-stop) stop|force-stop)
rh_status_q || exit 0 rh_status_q || exit 0
stop stop
rtrn=$? rtrn=$?
[ $rtrn = 0 ] && rm -f $LOCK_FILE [ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
;; ;;
restart) restart)

View File

@ -43,7 +43,7 @@ LOCK_FILE="@DEFAULT_LOCK_DIR@/subsys/$DAEMON"
PID_FILE="@LVMPOLLD_PIDFILE@" PID_FILE="@LVMPOLLD_PIDFILE@"
rh_status() { rh_status() {
status -p $PID_FILE $DAEMON status -p "$PID_FILE" "$DAEMON"
} }
rh_status_q() { rh_status_q() {
@ -57,12 +57,11 @@ start()
return $ret return $ret
} }
stop() stop()
{ {
ret=0 ret=0
action "Signaling LVM poll daemon to exit:" killproc -p $PID_FILE $DAEMON -TERM || ret=$? action "Signaling LVM poll daemon to exit:" killproc -p "$PID_FILE" "$DAEMON" -TERM || ret=$?
return $ret return "$ret"
} }
rtrn=1 rtrn=1
@ -73,14 +72,14 @@ case "$1" in
rh_status_q && exit 0 rh_status_q && exit 0
start start
rtrn=$? rtrn=$?
[ $rtrn = 0 ] && touch $LOCK_FILE [ $rtrn = 0 ] && touch "$LOCK_FILE"
;; ;;
stop|force-stop) stop|force-stop)
rh_status_q || exit 0 rh_status_q || exit 0
stop stop
rtrn=$? rtrn=$?
[ $rtrn = 0 ] && rm -f $LOCK_FILE [ $rtrn = 0 ] && rm -f "$LOCK_FILE"
;; ;;
restart) restart)

View File

@ -47,7 +47,7 @@ WARN=1
export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1 export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
rh_status() { rh_status() {
status -p $PID_FILE $DMEVENTD_DAEMON status -p "$PID_FILE" "$DMEVENTD_DAEMON"
} }
rh_status_q() { rh_status_q() {
@ -60,7 +60,7 @@ start()
VGSLIST=`$VGS --noheadings -o name --ignoreskippedcluster --config 'log{command_names=0 prefix=" "}' 2> /dev/null` VGSLIST=`$VGS --noheadings -o name --ignoreskippedcluster --config 'log{command_names=0 prefix=" "}' 2> /dev/null`
for vg in $VGSLIST for vg in $VGSLIST
do do
action "Starting monitoring for VG $vg:" $VGCHANGE --monitor y --poll y --ignoreskippedcluster --config 'log{command_names=0 prefix=" "}' $vg || ret=$? action "Starting monitoring for VG $vg:" "$VGCHANGE" --monitor y --poll y --ignoreskippedcluster --config 'log{command_names=0 prefix=" "}' $vg || ret=$?
done done
return $ret return $ret
@ -78,7 +78,7 @@ stop()
VGSLIST=`$VGS --noheadings -o name --ignoreskippedcluster --config 'log{command_names=0 prefix=" "}' 2> /dev/null` VGSLIST=`$VGS --noheadings -o name --ignoreskippedcluster --config 'log{command_names=0 prefix=" "}' 2> /dev/null`
for vg in $VGSLIST for vg in $VGSLIST
do do
action "Stopping monitoring for VG $vg:" $VGCHANGE --monitor n --ignoreskippedcluster --config 'log{command_names=0 prefix=" "}' $vg || ret=$? action "Stopping monitoring for VG $vg:" "$VGCHANGE" --monitor n --ignoreskippedcluster --config 'log{command_names=0 prefix=" "}' $vg || ret=$?
done done
return $ret return $ret
} }
@ -91,7 +91,7 @@ case "$1" in
rh_status_q && exit 0 rh_status_q && exit 0
start start
rtrn=$? rtrn=$?
[ $rtrn = 0 ] && touch $LOCK_FILE [ "$rtrn" = 0 ] && touch "$LOCK_FILE"
;; ;;
force-stop) force-stop)
@ -99,7 +99,7 @@ case "$1" in
WARN=0 WARN=0
stop stop
rtrn=$? rtrn=$?
[ $rtrn = 0 ] && rm -f $LOCK_FILE [ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
;; ;;
stop) stop)
@ -108,7 +108,7 @@ case "$1" in
test "$runlevel" = "6" && WARN=0 test "$runlevel" = "6" && WARN=0
stop stop
rtrn=$? rtrn=$?
[ $rtrn = 0 ] && rm -f $LOCK_FILE [ "$rtrn" = 0 ] && rm -f "$LOCK_FILE"
;; ;;
restart) restart)
@ -123,7 +123,7 @@ case "$1" in
status) status)
rh_status rh_status
rtrn=$? rtrn=$?
[ $rtrn = 0 ] && $LVS -S 'seg_monitor=monitored' -o lv_full_name,seg_monitor [ "$rtrn" = 0 ] && "$LVS" -S 'seg_monitor=monitored' -o lv_full_name,seg_monitor
;; ;;
*) *)

View File

@ -83,12 +83,12 @@ function usage {
function cleanup { function cleanup {
#set to use old lvm.conf #set to use old lvm.conf
LVM_SYSTEM_DIR=${ORIG_LVM_SYS_DIR} LVM_SYSTEM_DIR=$ORIG_LVM_SYS_DIR
if [ "$KEEP_TMP_LVM_SYSTEM_DIR" -eq 1 ]; then if [ "$KEEP_TMP_LVM_SYSTEM_DIR" -eq 1 ]; then
echo "${SCRIPTNAME}: LVM_SYSTEM_DIR (${TMP_LVM_SYSTEM_DIR}) must be cleaned up manually." echo "${SCRIPTNAME}: LVM_SYSTEM_DIR (${TMP_LVM_SYSTEM_DIR}) must be cleaned up manually."
else else
"$RM" -rf -- "${TMP_LVM_SYSTEM_DIR}" "$RM" -rf -- "$TMP_LVM_SYSTEM_DIR"
fi fi
} }
@ -309,11 +309,11 @@ done <<< "$(echo "$VGLIST")"
### Restore the old environment ### Restore the old environment
##################################################################### #####################################################################
### set to use old lvm.conf ### set to use old lvm.conf
if [ -z "${ORIG_LVM_SYS_DIR}" ] if [ -z "$ORIG_LVM_SYS_DIR" ]
then then
unset LVM_SYSTEM_DIR unset LVM_SYSTEM_DIR
else else
LVM_SYSTEM_DIR=${ORIG_LVM_SYS_DIR} LVM_SYSTEM_DIR=$ORIG_LVM_SYS_DIR
fi fi
### update the device cache and make sure all ### update the device cache and make sure all