summaryrefslogtreecommitdiff
path: root/src/xorriso.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/xorriso.sh')
-rwxr-xr-xsrc/xorriso.sh66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/xorriso.sh b/src/xorriso.sh
new file mode 100755
index 0000000..5068d4b
--- /dev/null
+++ b/src/xorriso.sh
@@ -0,0 +1,66 @@
1#!/bin/sh
2
3outdev=samizdat.iso
4indev=debian-live-8.4.0-amd64-standard.iso
5volid=SamizdatLive
6gpg_iso_path=gnupghome
7gnupghome=gnupghome
8secrets=secrets
9
10if [ $# = 0 ]; then
11 set -- debian-live-8.4.0-amd64-standard.btrfs layer.btrfs
12fi
13
14for fs; do
15 [ -f "$fs" ] || exit 1
16 shift
17 set -- "$@" "rootfs/${fs##*/}=$fs"
18done
19
20die() { printf '%s\n' "$*"; exit 1; }
21
22make_gnupghome()
23{
24 [ -d "$gnupghome" ] && return
25 local reset=$-
26 set -e
27 [ ! -d "$gnupghome".tmp ] || die "Error: refusing to overwrite $gnupghome.tmp"
28 [ ! -d "$secrets".tmp ] || die "Error: refusing to overwrite $secrets.tmp"
29 mkdir -p "$gnupghome".tmp "$secrets".tmp
30 local PATH="$HOME"/src/samizdat/src:"$PATH" NO_USE_RAMFS=y
31 NEW_GNUPGHOME="$gnupghome".tmp SECRETS_DIRECTORY="$secrets".tmp ~/src/samizdat/src/samizdat-make-key --adam
32 mv "$secrets".tmp "$secrets"
33 mv "$gnupghome".tmp "$gnupghome"
34 set -$reset
35}
36
37make_gnupghome
38
39if [ grub-efi.sh -nt grub-efi ]; then
40 ./grub-efi.sh || die "Error: grub-efi.sh failed"
41fi
42
43set -ex
44
45xorriso \
46 -drive_class clear_list all \
47 -outdev "$outdev"~ \
48 -report_about mishap \
49 -return_with sorry 0 \
50 -volid "$volid" \
51 -pathspecs on \
52 \
53 \
54 -add "${gpg_iso_path}=${gnupghome}" -- \
55 -add linux=isolinux/linux -- \
56 -follow link -add "$@" -- -follow default \
57 \
58 \
59 -as mkisofs -graft-points \
60 -b grub/i386-pc/eltorito.img \
61 -no-emul-boot -boot-info-table \
62 --embedded-boot grub-efi/embedded.img \
63 --protective-msdos-label \
64 grub=grub-efi/grub
65
66mv -f "$outdev"~ "$outdev"