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

View file

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