summaryrefslogtreecommitdiff
path: root/xorriso-layer.sh
blob: b8f6ede0bab49501244efd5cee7c928254fd9976 (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
#!/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="$1"

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

[ -f "$btrfs_layer_filesystem" ] || die "Usage: $0 <layer.btrfs>"

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"