summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2007-03-23 16:08:43 +0000
committererdgeist <erdgeist@erdgeist.org>2007-03-23 16:08:43 +0000
commit312c276483c2277b93ddc79ce51b4b017521e5f1 (patch)
treedaa0fb530c30e9562ebbfe1b921b0427b8303ece
parent59dde63a40f176a9e0dbebd6ec49edd4a32199f9 (diff)
Stale device link detection completed and tested. More testing required.
-rwxr-xr-xezjail-admin7
-rwxr-xr-xezjail.sh4
2 files changed, 8 insertions, 3 deletions
diff --git a/ezjail-admin b/ezjail-admin
index aa7b16d..a4e50e1 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -120,7 +120,12 @@ fetchjailinfo () {
120 if [ -n "${ezjail_image}" -a -L "${ezjail_rootdir}.device" ]; then 120 if [ -n "${ezjail_image}" -a -L "${ezjail_rootdir}.device" ]; then
121 # Fetch destination of soft link 121 # Fetch destination of soft link
122 ezjail_device=`stat -f "%Y" ${ezjail_rootdir}.device` 122 ezjail_device=`stat -f "%Y" ${ezjail_rootdir}.device`
123 [ -e "${ezjail_device}" ] && ezjail_attached="YES" 123
124 mount -p -v | grep -q -E "^${ezjail_rootdir}.device.${ezjail_rootdir}" && ezjail_attached="YES"
125 mount -p -v | grep -q -E "^${ezjail_device}.${ezjail_rootdir}" && ezjail_attached="YES"
126
127 # Stale device link detected. Remove and clean.
128 [ -z "${ezjail_attached}" ] && unset ezjail_device && rm -f ${ezjail_rootdir}.device
124 fi 129 fi
125 130
126 [ -f /var/run/jail_${ezjail_safename}.id ] && ezjail_id=`cat /var/run/jail_${ezjail_safename}.id` || return 131 [ -f /var/run/jail_${ezjail_safename}.id ] && ezjail_id=`cat /var/run/jail_${ezjail_safename}.id` || return
diff --git a/ezjail.sh b/ezjail.sh
index 9f181f2..5394a63 100755
--- a/ezjail.sh
+++ b/ezjail.sh
@@ -102,8 +102,8 @@ attach_detach_pre ()
102 # Fetch destination of soft link 102 # Fetch destination of soft link
103 ezjail_device=`stat -f "%Y" ${ezjail_rootdir}.device` 103 ezjail_device=`stat -f "%Y" ${ezjail_rootdir}.device`
104 104
105 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 105 mount -p -v | grep -E "^${ezjail_rootdir}.device.${ezjail_rootdir}" && echo "Warning: Skipping jail. Jail image file ${ezjail} already attached as ${ezjail_device}. 'ezjail-admin config -i detach' it first." && return 1
106 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 106 mount -p -v | grep -E "^${ezjail_device}.${ezjail_rootdir}" && echo "Warning: Skipping jail. Jail image file ${ezjail} already attached as ${ezjail_device}. 'ezjail-admin config -i detach' it first." && return 1
107 107
108 # Remove stale device link 108 # Remove stale device link
109 rm -f ${ezjail_rootdir}.device 109 rm -f ${ezjail_rootdir}.device