contrib/mount-ext4-ramdisk.sh: clean up in error case
Also fix all shellcheck warnings.
This commit is contained in:
parent
55fcacfc27
commit
95caa66e0b
@ -8,9 +8,13 @@ fi
|
|||||||
|
|
||||||
IMG=$(mktemp /tmp/ext4-ramdisk-XXX.img)
|
IMG=$(mktemp /tmp/ext4-ramdisk-XXX.img)
|
||||||
|
|
||||||
dd if=/dev/zero of=$IMG bs=1M count=1030
|
# unlink the file when done, space will be
|
||||||
mkfs.ext4 -q $IMG
|
# reclaimed once the fs is unmounted. Also
|
||||||
mkdir -p $MNT
|
# cleans up in the error case.
|
||||||
mount $IMG $MNT
|
trap 'rm "$IMG"' EXIT
|
||||||
chmod 777 $MNT
|
|
||||||
rm $IMG # unlink the file, it will be deleted once the fs is unmounted
|
dd if=/dev/zero of="$IMG" bs=1M count=1030 status=none
|
||||||
|
mkfs.ext4 -q "$IMG"
|
||||||
|
mkdir -p "$MNT"
|
||||||
|
mount "$IMG" "$MNT"
|
||||||
|
chmod 777 "$MNT"
|
||||||
|
Loading…
Reference in New Issue
Block a user