grml2usb: add python3 test variant
[grml2usb.git] / debian / tests / smoke-grml2usb-py3
1 #!/bin/bash
2 exec 2>&1
3 set -ex
4
5 TMPDIR=$(mktemp -d)
6 LODEV=$(losetup -f)
7 cleanup() {
8   kpartx -d "$LODEV" || true
9   losetup -d "$LODEV" || true
10   rm -rf "$TMPDIR"
11 }
12 trap cleanup EXIT
13
14 mkdir "$TMPDIR"/isoroot "$TMPDIR"/isoroot/boot "$TMPDIR"/isoroot/boot/isolinux
15 cp /usr/lib/ISOLINUX/isolinux.bin "$TMPDIR"/isoroot/boot/isolinux/
16 echo 'FAKE' > "$TMPDIR"/isoroot/grml-version
17 echo 'LOGO' > "$TMPDIR"/isoroot/boot/logo.16
18 touch "$TMPDIR"/isoroot/boot/isolinux/FAKE_default.cfg
19 touch "$TMPDIR"/isoroot/boot/isolinux/FAKE_grml.cfg
20 touch "$TMPDIR"/isoroot/boot/isolinux/hidden.cfg
21 xorriso -as mkisofs -l -r -J -no-pad -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -o "$TMPDIR"/fake.iso "$TMPDIR"/isoroot
22 xorriso -dev "$TMPDIR"/fake.iso -ls
23
24 dd if=/dev/zero of="$TMPDIR"/blockdev bs=1M count=50
25
26 sfdisk "$TMPDIR"/blockdev <<EOT
27 label: dos
28 label-id: 0x00000000
29 unit: sectors
30
31 p1 : start=        2048, size=      100352, type=6, bootable
32 EOT
33
34 losetup -P "$LODEV" "$TMPDIR"/blockdev
35
36 python3 $(which grml2usb) --bootloader-only --verbose --skip-usb-check --force --fat16 "$TMPDIR"/fake.iso "$LODEV"p1