|
|
|
@ -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 |
|
|
|
|