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

shellcheck: fsadm cleanup

Use some more "" for bash vars
This commit is contained in:
Zdenek Kabelac 2017-11-05 18:22:02 +01:00
parent 0f0baec1f3
commit d45a9c0f5b

View File

@ -532,7 +532,7 @@ detect_luks_device() {
CRYPT_NAME=""
CRYPT_DATA_OFFSET=""
_LUKS_VERSION=$($CRYPTSETUP luksDump $VOLUME 2> /dev/null | $GREP "Version:")
_LUKS_VERSION=$("$CRYPTSETUP" luksDump "$VOLUME" 2> /dev/null | "$GREP" "Version:")
if [ -z "$_LUKS_VERSION" ]; then
verbose "Failed to parse LUKS version on volume \"$VOLUME\""
@ -541,7 +541,7 @@ detect_luks_device() {
_LUKS_VERSION=${_LUKS_VERSION//[Version:[:space:]]/}
_LUKS_UUID=$($CRYPTSETUP luksDump $VOLUME 2> /dev/null | $GREP "UUID:")
_LUKS_UUID=$("$CRYPTSETUP" luksDump "$VOLUME" 2> /dev/null | "$GREP" "UUID:")
if [ -z "$_LUKS_UUID" ]; then
verbose "Failed to parse LUKS UUID on volume \"$VOLUME\""
@ -551,10 +551,10 @@ detect_luks_device() {
_LUKS_UUID="CRYPT-LUKS$_LUKS_VERSION-${_LUKS_UUID//[UID:[:space:]-]/}-"
CRYPT_NAME=$(dmsetup info -c --noheadings -S "UUID=~^$_LUKS_UUID&&segments=1&&devnos_used='$MAJOR:$MINOR'" -o name)
test -z "$CRYPT_NAME" || CRYPT_DATA_OFFSET=$(dmsetup table $CRYPT_NAME | cut -d ' ' -f 8)
test -z "$CRYPT_NAME" || CRYPT_DATA_OFFSET=$(dmsetup table "$CRYPT_NAME" | cut -d ' ' -f 8)
# LUKS device must be active and mapped over volume where detected
if [ -z "$CRYPT_NAME" -o -z "$CRYPT_DATA_OFFSET" ]; then
if [ -z "$CRYPT_NAME" ] || [ -z "$CRYPT_DATA_OFFSET" ]; then
error "Can not find active LUKS device. Unlock \"$VOLUME\" volume first."
fi
}
@ -599,7 +599,7 @@ resize_luks() {
fi
# resize LUKS device
dry $CRYPTSETUP resize $NAME --size $L_NEWBLOCKCOUNT || error "Failed to resize active LUKS device"
dry "$CRYPTSETUP" resize "$NAME" --size $L_NEWBLOCKCOUNT || error "Failed to resize active LUKS device"
if [ $SHRINK -eq 0 ]; then
# grow fs on top of LUKS device
@ -612,9 +612,9 @@ detect_crypt_device() {
local L_NEWSIZE
local TMP
which $CRYPTSETUP > /dev/null 2>&1 || error "$CRYPTSETUP utility required to resize crypt device"
which "$CRYPTSETUP" > /dev/null 2>&1 || error "$CRYPTSETUP utility required to resize crypt device"
CRYPT_TYPE=$($CRYPTSETUP status $1 2> /dev/null | $GREP "type:")
CRYPT_TYPE=$("$CRYPTSETUP" status "$1" 2> /dev/null | "$GREP" "type:")
test -n "$CRYPT_TYPE" || error "$CRYPTSETUP failed to detect device type on $1."
@ -651,7 +651,7 @@ detect_crypt_device() {
# (on direct user request only)
#################################
resize_crypt() {
dry $CRYPTSETUP resize "$1" --size $CRYPT_RESIZE_BLOCKS || error "$CRYPTSETUP failed to resize device $1"
dry "$CRYPTSETUP" resize "$1" --size $CRYPT_RESIZE_BLOCKS || error "$CRYPTSETUP failed to resize device $1"
}
####################
@ -674,7 +674,7 @@ resize() {
"reiserfs") resize_reiser $NEWSIZE ;;
"xfs") resize_xfs $NEWSIZE ;;
"crypto_LUKS")
which $CRYPTSETUP > /dev/null 2>&1 || error "$CRYPTSETUP utility required to resize LUKS volume"
which "$CRYPTSETUP" > /dev/null 2>&1 || error "$CRYPTSETUP utility required to resize LUKS volume"
resize_luks $NEWSIZE ;;
*) error "Filesystem \"$FSTYPE\" on device \"$VOLUME\" is not supported by this tool." ;;
esac || error "Resize $FSTYPE failed."
@ -746,7 +746,7 @@ check() {
*) dry "$FSCK" $FORCE -p "$VOLUME" ;;
esac ;;
"crypto_LUKS")
which $CRYPTSETUP > /dev/null 2>&1 || error "$CRYPTSETUP utility required."
which "$CRYPTSETUP" > /dev/null 2>&1 || error "$CRYPTSETUP utility required."
check_luks ;;
*)
error "Filesystem \"$FSTYPE\" on device \"$VOLUME\" is not supported by this tool." ;;