Add mount.qemu script to mount raw qemu images
authorColin McCabe <colinmcc@lab126.com>
Mon, 28 Dec 2009 23:18:10 +0000 (15:18 -0800)
committerColin McCabe <colinmcc@lab126.com>
Mon, 28 Dec 2009 23:18:10 +0000 (15:18 -0800)
mount.qemu [new file with mode: 0755]

diff --git a/mount.qemu b/mount.qemu
new file mode 100755 (executable)
index 0000000..d3f3d0f
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+# check arguments
+if [ $# -ne 2 ]; then
+       echo "usage: ${0} [image-file] [mount-point]"
+       exit 1
+fi
+
+image_file=${1}
+if [ -f ${image_file} ]; then
+       :
+else
+       echo "can't find regular file ${image_file}"
+       exit 1
+fi
+
+mount_point=${2}
+if [ -d ${mount_point} ]; then
+       :
+else
+       echo "can't find directory ${mount_point}"
+       exit 1
+fi
+
+# mount raw qemu device
+mount -o loop,offset=32256 ${image_file} ${mount_point}