summaryrefslogtreecommitdiff
path: root/ezjail-admin
diff options
context:
space:
mode:
authorerdgeist <erdgeist@erdgeist.org>2006-05-03 01:04:45 +0000
committererdgeist <erdgeist@erdgeist.org>2006-05-03 01:04:45 +0000
commit2e43ae3750164eee688a01dc6f9526707d27bc39 (patch)
tree653700b6ed8bb144e01ea051cc0be3edb2d5a414 /ezjail-admin
parentf2cf85c611a66a6664296b6dd69332612889fe08 (diff)
Sanity checks tidied up now.
Diffstat (limited to 'ezjail-admin')
-rwxr-xr-xezjail-admin10
1 files changed, 7 insertions, 3 deletions
diff --git a/ezjail-admin b/ezjail-admin
index 429cbb8..71863ef 100755
--- a/ezjail-admin
+++ b/ezjail-admin
@@ -167,7 +167,7 @@ create)
167 if [ "${ezjail_imagesize}" ]; then 167 if [ "${ezjail_imagesize}" ]; then
168 _val=`echo "${ezjail_imagesize}"|tr A-Z a-z|sed -Ees:g:km:g -es:m:kk:g -es:k:*2b:g -es:b:*128w:g -es:w:*4\ :g -e"s:(^|[^0-9])0x:\1\0X:g" -ey:x:*:` 168 _val=`echo "${ezjail_imagesize}"|tr A-Z a-z|sed -Ees:g:km:g -es:m:kk:g -es:k:*2b:g -es:b:*128w:g -es:w:*4\ :g -e"s:(^|[^0-9])0x:\1\0X:g" -ey:x:*:`
169 _val=`echo $(( ${_val} ))` 169 _val=`echo $(( ${_val} ))`
170 [ $? -eq 0 -o ${_val} -lt 1 ] || exerr "Error: The image size you specified is somehow incomprehensible (you specified ${ezjail_imagesize}." 170 [ $? -eq 0 -a ${_val} -gt 0 ] || exerr "Error: The image size you specified is somehow incomprehensible (you specified ${ezjail_imagesize}."
171 ezjail_imageblockcount=$(( ${_val} / 1048576 )) 171 ezjail_imageblockcount=$(( ${_val} / 1048576 ))
172 ezjail_imagerestbytes=$(( ${_val} % 1048576 )) 172 ezjail_imagerestbytes=$(( ${_val} % 1048576 ))
173 fi 173 fi
@@ -233,8 +233,12 @@ create)
233 233
234 # Now create jail disc image 234 # Now create jail disc image
235 touch "${ezjail_image}" 235 touch "${ezjail_image}"
236 [ "${ezjail_imageblockcount}" -gt 0 ] && dd if=/dev/random of="${ezjail_image}" bs=1m count=${ezjail_imageblockcount} || exerr "Error: Could not (or not fully) create the image file. You might want to check (and possibly remove) the file ${ezjail_image}. The image size provided was ${ezjail_imagesize}." 236 if [ "${ezjail_imageblockcount}" -gt 0 ]; then
237 [ "${ezjail_imagerestbytes}" -gt 0 ] && ( dd if=/dev/random bs=${ezjail_imagerestbytes} count=1 >> "${ezjail_image}" ) || exerr "Error: Could not (or not fully) create the image file. You might want to check (and possibly remove) the file ${ezjail_image}. The image size provided was ${ezjail_imagesize}." 237 dd if=/dev/random of="${ezjail_image}" bs=1m count=${ezjail_imageblockcount} || exerr "Error: Could not (or not fully) create the image file. You might want to check (and possibly remove) the file ${ezjail_image}. The image size provided was ${ezjail_imagesize}."
238 fi
239 if [ "${ezjail_imagerestbytes}" -gt 0 ]; then
240 ( dd if=/dev/random bs=${ezjail_imagerestbytes} count=1 >> "${ezjail_image}" ) || exerr "Error: Could not (or not fully) create the image file. You might want to check (and possibly remove) the file ${ezjail_image}. The image size provided was ${ezjail_imagesize}."
241 fi
238 242
239 # And attach device 243 # And attach device
240 ezjail_imagedevice=`mdconfig -a -t vnode -f ${ezjail_image}` 244 ezjail_imagedevice=`mdconfig -a -t vnode -f ${ezjail_image}`