1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #!/bin/sh
set -ex
dd if=/dev/zero of=test.img bs=1M count=128
mkfs.vfat -F 32 test.img $((134217728/512))
mkdir -p toimg/foo/bar
touch toimg/foo/bar
touch toimg/baz
#mcopy -p -v -s -i test.img toimg ::
for f in $(find toimg); do
dst=$(echo $f | cut -f2- -d/)
if [ -d $f ]; then
mmd -i test.img ::$dst
else
mcopy -i test.img $f ::$dst
fi
done
mdir -s -i test.img
fsck.vfat -V test.img
|