From 59dde63a40f176a9e0dbebd6ec49edd4a32199f9 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 23 Mar 2007 15:45:35 +0000 Subject: Stale device link detection for image devices. Heads up. Untested. --- ezjail.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ezjail.sh b/ezjail.sh index 2751ea0..9f181f2 100755 --- a/ezjail.sh +++ b/ezjail.sh @@ -101,7 +101,12 @@ attach_detach_pre () if [ -L "${ezjail_rootdir}.device" ]; then # Fetch destination of soft link ezjail_device=`stat -f "%Y" ${ezjail_rootdir}.device` - [ -e "${ezjail_device}" ] && echo "Jail image file ${ezjail} already attached as ${ezjail_device}. 'ezjail-admin config -i detach' it first." && return 1 + + mount -p -v | grep -E "^${ezjail_rootdir}.device.${ezjail_rootdir}" && echo "Jail image file ${ezjail} already attached as ${ezjail_device}. 'ezjail-admin config -i detach' it first." && return 1 + mount -p -v | grep -E "^${ezjail_device}.${ezjail_rootdir}" && echo "Jail image file ${ezjail} already attached as ${ezjail_device}. 'ezjail-admin config -i detach' it first." && return 1 + + # Remove stale device link + rm -f ${ezjail_rootdir}.device fi # Create a memory disc from jail image -- cgit v1.2.3