diff options
author | Denys Vlasenko | 2015-10-05 09:04:04 +0200 |
---|---|---|
committer | Denys Vlasenko | 2015-10-05 09:04:04 +0200 |
commit | 12efcf3285a75d197704d2eef23824b3e4f11e66 (patch) | |
tree | 1e518da57b55f527768e2d5031a71fbdca0f998f /qemu_multiarch_testing/make-hdc-img.sh | |
parent | 28b00ce6ff8cde91f3e83632e705709b7cd2ab20 (diff) | |
download | busybox-12efcf3285a75d197704d2eef23824b3e4f11e66.zip busybox-12efcf3285a75d197704d2eef23824b3e4f11e66.tar.gz |
Add qemu_multiarch_testing/
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'qemu_multiarch_testing/make-hdc-img.sh')
-rwxr-xr-x | qemu_multiarch_testing/make-hdc-img.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/qemu_multiarch_testing/make-hdc-img.sh b/qemu_multiarch_testing/make-hdc-img.sh new file mode 100755 index 0000000..3c35f4e --- /dev/null +++ b/qemu_multiarch_testing/make-hdc-img.sh @@ -0,0 +1,30 @@ +#!/bin/sh -ex + +mountpoint -q / +[ ! -e hdc.img.dir ] + +cleanup() +{ + trap - EXIT + if mountpoint -q hdc.img.dir; then + umount -d hdc.img.dir + fi + mountpoint -q hdc.img.dir || + rm -rf hdc.img.dir + exit $@ +} + +trap 'cleanup $?' EXIT +trap 'cleanup 1' HUP PIPE INT QUIT TERM + +size=$(du -ks hdc.dir | sed -rn 's/^([0-9]+).*/\1/p') +[ "$size" -gt 0 ] + +rm -f hdc.img +dd if=/dev/zero of=hdc.img count=1 bs=1024 seek=$(($size*2)) +mkfs.ext3 -q -F -b 1024 -i 4096 hdc.img +tune2fs -c 0 -i 0 hdc.img +mkdir hdc.img.dir +mount -o loop hdc.img hdc.img.dir +cp -a hdc.dir/* hdc.img.dir/ +umount -d hdc.img.dir |