diff options
Diffstat (limited to 'contrib/image-convert/tar2ext2.mount')
-rwxr-xr-x | contrib/image-convert/tar2ext2.mount | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/contrib/image-convert/tar2ext2.mount b/contrib/image-convert/tar2ext2.mount new file mode 100755 index 0000000000..7e23098c4d --- /dev/null +++ b/contrib/image-convert/tar2ext2.mount @@ -0,0 +1,25 @@ +#!/bin/sh + +if [ $# -ne 2 ]; then + echo "Usage: $0 <tarball> <ext2 size>" + exit +fi + +ext=`echo $1 | sed -r -e 's/.+\.([^.]+\.[^.]+)/\1/'` +base=$(basename $1 .$ext) +if [ "$ext" == "tar.bz2" ]; then + uncompress=j +else + uncompress=z +fi + +dd if=/dev/zero of=$base.img bs=1M count=$2 +mkfs.ext2 -F -m1 $base.img + +mkdir -p mnt +mount -o loop $base.img mnt + +tar -x$uncompress -f $1 -C mnt + +umount mnt +rm -rf mnt |