1
0
Fork 0

Finalize test script at fail

This commit is contained in:
Braiden Vasco 2017-09-25 18:47:11 +00:00
parent 48595a35ab
commit 917a2a9542

View file

@ -18,17 +18,9 @@ mount -v $ROOT_DEV "$MOUNT_DIR" -t ext4
mkdir -p "$MOUNT_DIR/boot/"
mount -v $BOOT_DEV "$MOUNT_DIR/boot/" -t vfat
IMGID="$(fdisk -l "$IMG_FILE" | sed -n 's/Disk identifier: 0x\([^ ]*\)/\1/p')"
BOOT_PARTUUID="$IMGID-01"
ROOT_PARTUUID="$IMGID-02"
echo
grep --color "PARTUUID=$BOOT_PARTUUID" "$MOUNT_DIR/etc/fstab"
grep --color "PARTUUID=$ROOT_PARTUUID" "$MOUNT_DIR/etc/fstab"
grep --color "PARTUUID=$ROOT_PARTUUID" "$MOUNT_DIR/boot/cmdline.txt"
function finalize {
echo
umount -v "$MOUNT_DIR/boot/"
@ -38,3 +30,15 @@ rmdir "$MOUNT_DIR"
losetup -d "$BOOT_DEV"
losetup -d "$ROOT_DEV"
}
trap finalize EXIT
IMGID="$(fdisk -l "$IMG_FILE" | sed -n 's/Disk identifier: 0x\([^ ]*\)/\1/p')"
BOOT_PARTUUID="$IMGID-01"
ROOT_PARTUUID="$IMGID-02"
grep --color "PARTUUID=$BOOT_PARTUUID" "$MOUNT_DIR/etc/fstab"
grep --color "PARTUUID=$ROOT_PARTUUID" "$MOUNT_DIR/etc/fstab"
grep --color "PARTUUID=$ROOT_PARTUUID" "$MOUNT_DIR/boot/cmdline.txt"