Fix SC2120, SC2119.

This commit is contained in:
Darko Poljak 2018-10-05 15:18:59 +02:00
parent b284bafbee
commit 68fad03a6b
2 changed files with 4 additions and 8 deletions

View File

@ -111,7 +111,6 @@ startJail() {
fi
}
# shellcheck disable=SC2120
deleteJail() {
# Unmount the jail's mountpoints if necessary
cat <<EOF
@ -122,12 +121,12 @@ deleteJail() {
output="\$(mount | grep "\/rw\/${name}\/")" || true
if [ -n "\${output}" ]; then # >=1 rw mount is mounted still
for DIR in "${output}"; do
umount -F "/etc/fstab.${name}" "\$(echo "${DIR}" | awk '{print $3}')"
umount -F "/etc/fstab.${name}" "\$(echo "${DIR}" | awk '{print \$3}')"
done
fi
output="\$(mount | grep "\/${name} (")" || true
if [ -n "\${output}" ]; then # ro mount is mounted still
umount -F "/etc/fstab.${name}" "\$(echo "${output}" | awk '{print $3}')"
umount -F "/etc/fstab.${name}" "\$(echo "${output}" | awk '{print \$3}')"
fi
EOF
# Remove the jail's rw mountpoints
@ -348,7 +347,6 @@ if [ "$present" = "EXISTS" ]; then # The jail currently exists
exit 0
else # The jail is not supposed to exist
stopJail
# shellcheck disable=SC2119
deleteJail
exit 0
fi

View File

@ -116,7 +116,6 @@ startJail() {
fi
}
# shellcheck disable=SC2120
deleteJail() {
# Unmount the jail's mountpoints if necessary
cat <<EOF
@ -127,12 +126,12 @@ deleteJail() {
output="\$(mount | grep "\/rw\/${name}\/")" || true
if [ -n "\${output}" ]; then # >=1 rw mount is mounted still
for DIR in "${output}"; do
umount -F "/etc/fstab.${name}" "\$(echo "${DIR}" | awk '{print $3}')"
umount -F "/etc/fstab.${name}" "\$(echo "${DIR}" | awk '{print \$3}')"
done
fi
output="\$(mount | grep "\/${name} (")" || true
if [ -n "\${output}" ]; then # ro mount is mounted still
umount -F "/etc/fstab.${name}" "\$(echo "${output}" | awk '{print $3}')"
umount -F "/etc/fstab.${name}" "\$(echo "${output}" | awk '{print \$3}')"
fi
EOF
# Remove the jail's rw mountpoints
@ -343,7 +342,6 @@ if [ "$present" = "EXISTS" ]; then # The jail currently exists
exit 0
else # The jail is not supposed to exist
stopJail
# shellcheck disable=SC2119
deleteJail
exit 0
fi