summaryrefslogtreecommitdiff
path: root/src/xorriso-layer.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/xorriso-layer.sh')
-rwxr-xr-xsrc/xorriso-layer.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/xorriso-layer.sh b/src/xorriso-layer.sh
new file mode 100755
index 0000000..7ce4776
--- /dev/null
+++ b/src/xorriso-layer.sh
@@ -0,0 +1,38 @@
1#!/bin/bash
2
3outdev=debian-live-8.4.0-amd64-standard.btrfs.layered.iso
4indev=debian-live-8.4.0-amd64-standard.btrfs.iso
5volid=SamizdatLive
6btrfs_layer_iso_path=live/layer%s.btrfs
7btrfs_layer_filesystem="$1"
8
9die() { printf '%s\n' "$*"; exit 1; }
10
11[ -f "$btrfs_layer_filesystem" ] || die "Usage: $0 <layer.btrfs> [layer2.btrfs ...]"
12
13i=0
14while [ $i -lt $# ]; do
15 arg=$1
16 [ $i -eq 0 ] && n='' || n=$((i + 1))
17 arg=$(printf "${btrfs_layer_iso_path}=%s" "$n" "$arg")
18 shift
19 set -- "$@" "$arg"
20 i=$((i + 1))
21done
22
23for arg; do echo "a=$arg"; done; exit;
24
25set -ex
26
27cp --reflink "$indev" "$outdev"~
28time xorriso \
29 -drive_class clear_list all \
30 -outdev "$outdev"~ -indev "$outdev"~ \
31 -report_about mishap \
32 -volid "$volid" \
33 -return_with sorry 0 \
34 -pathspecs on -overwrite on \
35 -add_plainly any \
36 "$@"
37
38mv -f "$outdev"~ "$outdev"