summaryrefslogtreecommitdiff
path: root/xorriso-layer.sh
blob: 1afb9f8c428be147aa8e5a22fee674764cf624b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

outdev=debian-live-8.4.0-amd64-standard.btrfs.layered.iso
indev=debian-live-8.4.0-amd64-standard.btrfs.iso
volid=SamizdatLive
btrfs_layer_iso_path=live/layer.btrfs
btrfs_layer_filesystem=debian-live-8.4.0-amd64-standard.layer.snapshot.2016-04-22.154447.btrfs

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

set -ex

cp --reflink "$indev" "$outdev"~
time xorriso \
        -drive_class clear_list all \
        -outdev "$outdev"~ -indev "$outdev"~ \
        -report_about mishap \
        -volid "$volid" \
        -return_with sorry 0 \
        -pathspecs on -overwrite on \
        -add_plainly any \
        "${btrfs_layer_iso_path}=${btrfs_layer_filesystem}"
mv -f "$outdev"~ "$outdev"