Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Commit

Permalink
Fix a usage quirk with warden. Don't report jail as running just
Browse files Browse the repository at this point in the history
because a mount-point is still left.

We will now check for that condition only before trying to delete a
jail
  • Loading branch information
Kris Moore committed Jun 17, 2014
1 parent 65f39d9 commit 6d06bd1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
14 changes: 2 additions & 12 deletions src-sh/warden/scripts/backend/checkstatus.sh
Expand Up @@ -34,16 +34,6 @@ fi
# End of error checking, now see if the jail is active # End of error checking, now see if the jail is active
##################################################################### #####################################################################


# Check if anything is still mounted in this jail
hasmount="0"
for mountpoint in $(mount | grep -e "${JAILDIR}/" | cut -d" " -f3); do
hasmount="1"
done

# Check if the jail is active # Check if the jail is active
jls | grep "${JAILDIR}$" >/dev/null 2>/dev/null jls | grep -q "${JAILDIR}$"
if [ "$?" = "0" -o "$hasmount" = "1" ]; then exit $?
exit 0
else
exit 1
fi
12 changes: 11 additions & 1 deletion src-sh/warden/scripts/backend/deletejail.sh
Expand Up @@ -45,7 +45,17 @@ fi
# Confirm jail was shutdown and no mounts are left # Confirm jail was shutdown and no mounts are left
${PROGDIR}/scripts/backend/checkstatus.sh "${JAILNAME}" ${PROGDIR}/scripts/backend/checkstatus.sh "${JAILNAME}"
if [ "$?" = "0" ] ; then if [ "$?" = "0" ] ; then
echo "ERROR: Jail is still running, or has active mount-points.. Please stop manually." echo "ERROR: Jail is still running! Please stop manually."
exit 5
fi

# Check if anything is still mounted in this jail
hasmount=0
for mountpoint in $(mount | grep -e "${JAILDIR}/" | cut -d" " -f3); do
hasmount=1
done
if [ $hasmount -eq 1 ] ; then
echo "ERROR: Jail still has active mount points. Please unmount them manually."
exit 5 exit 5
fi fi


Expand Down

0 comments on commit 6d06bd1

Please sign in to comment.