diff options
author | erdgeist <erdgeist@erdgeist.org> | 2006-05-03 00:59:00 +0000 |
---|---|---|
committer | erdgeist <erdgeist@erdgeist.org> | 2006-05-03 00:59:00 +0000 |
commit | f2cf85c611a66a6664296b6dd69332612889fe08 (patch) | |
tree | ab90c3c235ce3824c829486ab2cfe6cfb03dfe5c /ezjail-admin | |
parent | 65310b7582dd27d9726e8224321ef7de6bf364a8 (diff) |
Some sanity checks on image size
Diffstat (limited to 'ezjail-admin')
-rwxr-xr-x | ezjail-admin | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ezjail-admin b/ezjail-admin index 70213b2..429cbb8 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 ] || exerr "Error: The image size you specified is somehow incomprehensible." | 170 | [ $? -eq 0 -o ${_val} -lt 1 ] || 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,8 @@ create) | |||
233 | 233 | ||
234 | # Now create jail disc image | 234 | # Now create jail disc image |
235 | touch "${ezjail_image}" | 235 | touch "${ezjail_image}" |
236 | 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 | [ "${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}." |
237 | ( 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 | [ "${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}." |
238 | 238 | ||
239 | # And attach device | 239 | # And attach device |
240 | ezjail_imagedevice=`mdconfig -a -t vnode -f ${ezjail_image}` | 240 | ezjail_imagedevice=`mdconfig -a -t vnode -f ${ezjail_image}` |