diff options
Diffstat (limited to 'src/xorriso-layer.sh')
-rwxr-xr-x | src/xorriso-layer.sh | 38 |
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 | |||
3 | outdev=debian-live-8.4.0-amd64-standard.btrfs.layered.iso | ||
4 | indev=debian-live-8.4.0-amd64-standard.btrfs.iso | ||
5 | volid=SamizdatLive | ||
6 | btrfs_layer_iso_path=live/layer%s.btrfs | ||
7 | btrfs_layer_filesystem="$1" | ||
8 | |||
9 | die() { printf '%s\n' "$*"; exit 1; } | ||
10 | |||
11 | [ -f "$btrfs_layer_filesystem" ] || die "Usage: $0 <layer.btrfs> [layer2.btrfs ...]" | ||
12 | |||
13 | i=0 | ||
14 | while [ $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)) | ||
21 | done | ||
22 | |||
23 | for arg; do echo "a=$arg"; done; exit; | ||
24 | |||
25 | set -ex | ||
26 | |||
27 | cp --reflink "$indev" "$outdev"~ | ||
28 | time 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 | |||
38 | mv -f "$outdev"~ "$outdev" | ||