summaryrefslogtreecommitdiff
path: root/xorriso.sh
blob: dbe5fe8bcdd77fdd40097101863dce0eb74ac087 (plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/sh

outdev=samizdat.iso
indev=debian-live-8.4.0-amd64-standard.iso
volid=SamizdatLive
gpg_iso_path=gnupghome
gnupghome=gnupghome
secrets=secrets

if [ $# = 0 ]; then
    set -- debian-live-8.4.0-amd64-standard.btrfs layer.btrfs
fi

for fs; do
    [ -f "$fs" ] || exit 1
    shift
    set -- "$@" "rootfs/${fs##*/}=$fs"
done

die() { printf '%s\n' "$*"; exit 1; }

make_gnupghome()
{
  [ -d "$gnupghome" ] && return
  local reset=$-
  set -e
  [ ! -d "$gnupghome".tmp ] || die "Error: refusing to overwrite $gnupghome.tmp"
  [ ! -d "$secrets".tmp   ] || die "Error: refusing to overwrite $secrets.tmp"
  mkdir -p "$gnupghome".tmp "$secrets".tmp
  local PATH="$HOME"/src/samizdat/src:"$PATH" NO_USE_RAMFS=y
  NEW_GNUPGHOME="$gnupghome".tmp SECRETS_DIRECTORY="$secrets".tmp ~/src/samizdat/src/samizdat-make-key --adam
  mv "$secrets".tmp "$secrets"
  mv "$gnupghome".tmp "$gnupghome"
  set -$reset
}

make_gnupghome

set -ex

# http://www.syslinux.org/wiki/index.php?title=Isohybrid
# xorriso -as mkisofs \
#   -o output.iso \
#   -isohybrid-mbr /usr/lib/syslinux/isohdpfx.bin \
#   -c isolinux/boot.cat \
#   -b isolinux/isolinux.bin \
#      -no-emul-boot -boot-load-size 4 -boot-info-table \
#   -eltorito-alt-boot \
#   -e isolinux/efiboot.img \
#      -no-emul-boot \
#      -isohybrid-gpt-basdat \
#   CD_root

# http://ftp.nluug.nl/os/Linux/distr/slackware/slackware64-current/isolinux/
# http://ftp.nluug.nl/os/Linux/distr/slackware/slackware64-current/isolinux/efiboot.img

xorriso \
        -drive_class clear_list all \
        -outdev "$outdev"~ \
        -report_about mishap \
        -return_with sorry 0 \
        -volid "$volid" \
        -pathspecs on \
        \
        \
        -add isolinux -- \
        -follow link -add "$@" -- -follow default \
        -add "${gpg_iso_path}=${gnupghome}" -- \
        \
        \
        -as mkisofs \
        -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
        -c isolinux/boot.cat \
        -b isolinux/isolinux.bin \
        -no-emul-boot -boot-load-size 4 -boot-info-table \
        -eltorito-alt-boot \
        -e isolinux/efiboot.img \
        -no-emul-boot \
        -isohybrid-gpt-basdat \

mv -f "$outdev"~ "$outdev"