source: MondoRescue/branches/3.3/mindi-busybox/qemu_multiarch_testing/make-hdc-img.sh@ 3621

Last change on this file since 3621 was 3621, checked in by Bruno Cornec, 7 years ago

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 586 bytes
Line 
1#!/bin/sh -ex
2
3mountpoint -q /
4[ ! -e hdc.img.dir ]
5
6cleanup()
7{
8 trap - EXIT
9 if mountpoint -q hdc.img.dir; then
10 umount -d hdc.img.dir
11 fi
12 mountpoint -q hdc.img.dir ||
13 rm -rf hdc.img.dir
14 exit $@
15}
16
17trap 'cleanup $?' EXIT
18trap 'cleanup 1' HUP PIPE INT QUIT TERM
19
20size=$(du -ks hdc.dir | sed -rn 's/^([0-9]+).*/\1/p')
21[ "$size" -gt 0 ]
22
23rm -f hdc.img
24dd if=/dev/zero of=hdc.img count=1 bs=1024 seek=$(($size*2))
25mkfs.ext3 -q -F -b 1024 -i 4096 hdc.img
26tune2fs -c 0 -i 0 hdc.img
27mkdir hdc.img.dir
28mount -o loop hdc.img hdc.img.dir
29cp -a hdc.dir/* hdc.img.dir/
30umount -d hdc.img.dir
Note: See TracBrowser for help on using the repository browser.