mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
shellcheck: avoid assign warnings
Shellcheck seems to be happier when assigning variables with quotes.
This commit is contained in:
parent
8a92f70709
commit
e5e957e330
@ -31,34 +31,34 @@
|
||||
|
||||
set -euE -o pipefail
|
||||
|
||||
TOOL=fsadm
|
||||
TOOL="fsadm"
|
||||
|
||||
_SAVEPATH=$PATH
|
||||
PATH="/sbin:/usr/sbin:/bin:/usr/sbin:$PATH"
|
||||
|
||||
# utilities
|
||||
TUNE_EXT=tune2fs
|
||||
RESIZE_EXT=resize2fs
|
||||
TUNE_REISER=reiserfstune
|
||||
RESIZE_REISER=resize_reiserfs
|
||||
TUNE_XFS=xfs_info
|
||||
RESIZE_XFS=xfs_growfs
|
||||
TUNE_EXT="tune2fs"
|
||||
RESIZE_EXT="resize2fs"
|
||||
TUNE_REISER="reiserfstune"
|
||||
RESIZE_REISER="resize_reiserfs"
|
||||
TUNE_XFS="xfs_info"
|
||||
RESIZE_XFS="xfs_growfs"
|
||||
|
||||
MOUNT=mount
|
||||
UMOUNT=umount
|
||||
MKDIR=mkdir
|
||||
RMDIR=rmdir
|
||||
BLOCKDEV=blockdev
|
||||
BLKID=blkid
|
||||
DATE=date
|
||||
GREP=grep
|
||||
READLINK=readlink
|
||||
MOUNT="mount"
|
||||
UMOUNT="umount"
|
||||
MKDIR="mkdir"
|
||||
RMDIR="rmdir"
|
||||
BLOCKDEV="blockdev"
|
||||
BLKID="blkid"
|
||||
DATE="date"
|
||||
GREP="grep"
|
||||
READLINK="readlink"
|
||||
READLINK_E="-e"
|
||||
FSCK=fsck
|
||||
XFS_CHECK=xfs_check
|
||||
FSCK="fsck"
|
||||
XFS_CHECK="xfs_check"
|
||||
# XFS_REPAIR -n is used when XFS_CHECK is not found
|
||||
XFS_REPAIR=xfs_repair
|
||||
CRYPTSETUP=cryptsetup
|
||||
XFS_REPAIR="xfs_repair"
|
||||
CRYPTSETUP="cryptsetup"
|
||||
|
||||
# user may override lvm location by setting LVM_BINARY
|
||||
LVM=${LVM_BINARY:-lvm}
|
||||
@ -69,8 +69,8 @@ VERB=
|
||||
FORCE=
|
||||
EXTOFF=${_FSADM_EXTOFF:-0}
|
||||
DO_LVRESIZE=0
|
||||
FSTYPE=unknown
|
||||
VOLUME=unknown
|
||||
FSTYPE="unknown"
|
||||
VOLUME="unknown"
|
||||
TEMPDIR="${TMPDIR:-/tmp}/${TOOL}_${RANDOM}$$/m"
|
||||
DM_DEV_DIR="${DM_DEV_DIR:-/dev}"
|
||||
BLOCKSIZE=
|
||||
@ -321,10 +321,10 @@ detect_mounted_with_proc_self_mountinfo() {
|
||||
# device (which could have been renamed).
|
||||
# We need to visit every mount point and check it's major minor
|
||||
detect_mounted_with_proc_mounts() {
|
||||
MOUNTED=$("$GREP" "^$VOLUME[ \\t]" "$PROCMOUNTS")
|
||||
MOUNTED=$("$GREP" "^${VOLUME}[ \\t]" "$PROCMOUNTS")
|
||||
|
||||
# for empty string try again with real volume name
|
||||
test -z "$MOUNTED" && MOUNTED=$("$GREP" "^$RVOLUME[ \\t]" "$PROCMOUNTS")
|
||||
test -z "$MOUNTED" && MOUNTED=$("$GREP" "^${RVOLUME}[ \\t]" "$PROCMOUNTS")
|
||||
|
||||
MOUNTDEV=$(echo -n -e "${MOUNTED%% *}")
|
||||
# cut device name prefix and trim everything past mountpoint
|
||||
@ -335,8 +335,8 @@ detect_mounted_with_proc_mounts() {
|
||||
# for systems with different device names - check also mount output
|
||||
if test -z "$MOUNTED" ; then
|
||||
# will not work with spaces in paths
|
||||
MOUNTED=$(LC_ALL=C "$MOUNT" | "$GREP" "^$VOLUME[ \\t]")
|
||||
test -z "$MOUNTED" && MOUNTED=$(LC_ALL=C "$MOUNT" | "$GREP" "^$RVOLUME[ \\t]")
|
||||
MOUNTED=$(LC_ALL=C "$MOUNT" | "$GREP" "^${VOLUME}[ \\t]")
|
||||
test -z "$MOUNTED" && MOUNTED=$(LC_ALL=C "$MOUNT" | "$GREP" "^${RVOLUME}[ \\t]")
|
||||
MOUNTDEV=${MOUNTED%% on *}
|
||||
MOUNTED=${MOUNTED##* on }
|
||||
MOUNTED=${MOUNTED% type *} # allow type in the mount name
|
||||
|
@ -18,24 +18,24 @@
|
||||
|
||||
# following external commands are used throughout the script
|
||||
# echo and test are internal in bash at least
|
||||
MKDIR=mkdir # need -p
|
||||
TAR=tar # need czf
|
||||
RM=rm # need -rf
|
||||
CP=cp
|
||||
TAIL=tail # we need -n
|
||||
LS=ls # need -la
|
||||
PS=ps # need alx
|
||||
SED=sed
|
||||
DD=dd
|
||||
CUT=cut
|
||||
GREP=grep
|
||||
DATE=date
|
||||
BASENAME=basename
|
||||
UDEVADM=udevadm
|
||||
UNAME=uname
|
||||
TR=tr
|
||||
SOCAT=socat # either socat or nc is needed for dumping lvmetad state
|
||||
NC=nc
|
||||
MKDIR="mkdir" # need -p
|
||||
TAR="tar" # need czf
|
||||
RM="rm" # need -rf
|
||||
CP="cp"
|
||||
TAIL="tail" # we need -n
|
||||
LS="ls" # need -la
|
||||
PS="ps" # need alx
|
||||
SED="sed"
|
||||
DD="dd"
|
||||
CUT="cut"
|
||||
GREP="grep"
|
||||
DATE="date"
|
||||
BASENAME="basename"
|
||||
UDEVADM="udevadm"
|
||||
UNAME="uname"
|
||||
TR="tr"
|
||||
SOCAT="socat" # either socat or nc is needed for dumping lvmetad state
|
||||
NC="nc"
|
||||
|
||||
if test "@ODIRECT@" = yes; then
|
||||
DDFLAGS='iflag=direct oflag=direct'
|
||||
|
@ -807,7 +807,7 @@ wait_md_create() {
|
||||
local md=$1
|
||||
|
||||
while :; do
|
||||
if ! grep `basename $md` /proc/mdstat; then
|
||||
if ! grep "$(basename $md)" /proc/mdstat; then
|
||||
echo "$md not ready"
|
||||
cat /proc/mdstat
|
||||
sleep 2
|
||||
@ -1365,7 +1365,7 @@ EOF
|
||||
echo "$s {"
|
||||
local k
|
||||
for k in $(grep ^"$s"/ "$config_values" | cut -f1 -d= | sed -e 's, *$,,' | sort | uniq); do
|
||||
grep "^$k[ \t=]" "$config_values" | tail -n 1 | sed -e "s,^$s/, ," || true
|
||||
grep "^${k}[ \t=]" "$config_values" | tail -n 1 | sed -e "s,^$s/, ," || true
|
||||
done
|
||||
echo "}"
|
||||
echo
|
||||
|
@ -267,7 +267,7 @@ get_devs() {
|
||||
|
||||
prepare_test_vars() {
|
||||
vg="${PREFIX}vg"
|
||||
lv=LV
|
||||
lv="LV"
|
||||
|
||||
for i in {1..16}; do
|
||||
eval "lv$i=\"LV$i\""
|
||||
|
@ -20,9 +20,9 @@ SKIP_WITH_LVMPOLLD=1
|
||||
if test -e LOCAL_CLVMD ; then
|
||||
# In cluster, the error from activation is logged in clvmd
|
||||
# so we can only check resulting state of activation
|
||||
GREP=echo
|
||||
GREP="echo"
|
||||
else
|
||||
GREP=grep
|
||||
GREP="grep"
|
||||
fi
|
||||
|
||||
make_fake_() {
|
||||
|
Loading…
Reference in New Issue
Block a user