diff options
Diffstat (limited to 'btrfs-send-root.sh')
-rw-r--r-- | btrfs-send-root.sh | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/btrfs-send-root.sh b/btrfs-send-root.sh deleted file mode 100644 index 25e60f2..0000000 --- a/btrfs-send-root.sh +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | . ./var.sh | ||
3 | . ./btrfs-functions.sh | ||
4 | |||
5 | rootfs_uuid () | ||
6 | { | ||
7 | btrfs filesystem show / | sed -ne 's/.*uuid: //p' | ||
8 | } | ||
9 | |||
10 | remote_btrfs_receiver() | ||
11 | { | ||
12 | # ssh "$BTRFS_RECEIVE_DESTINATION_HOST" -- "sudo btrfs receive $(shellescape "$BTRFS_RECEIVE_DESTINATION_PATH")" | ||
13 | ssh "$BTRFS_RECEIVE_DESTINATION_HOST" -- \ | ||
14 | "sudo sh sami/btrfs-receive-root.sh $(shellescape "$BTRFS_RECEIVE_DESTINATION_PATH") $(shellescape "$BTRFS_RECEIVE_SUBVOLUME_NAME")" | ||
15 | } | ||
16 | |||
17 | dummy_receiver() | ||
18 | { | ||
19 | true | ||
20 | } | ||
21 | |||
22 | push_remote() | ||
23 | { | ||
24 | $(ARGS_NE mnt src ssh_dst) | ||
25 | |||
26 | now=$(date +%F.%H%M%S) || die | ||
27 | snap_dir=$mnt/snapshot.$now | ||
28 | prev_dir=$mnt/SEED | ||
29 | |||
30 | case "$ssh_dst" in | ||
31 | *:*) ;; | ||
32 | *) return 1;; | ||
33 | esac | ||
34 | local BTRFS_RECEIVE_DESTINATION_PATH="${ssh_dst#*:}" | ||
35 | local BTRFS_RECEIVE_DESTINATION_HOST="${ssh_dst%%:*}" | ||
36 | local BTRFS_RECEIVE_SUBVOLUME_NAME="${snap_dir#$mnt/}" | ||
37 | push_helper false "$snap_dir" "$prev_dir" "$src" remote_btrfs_receiver | ||
38 | } | ||
39 | |||
40 | ssh_dst=d@fifty.local:sami/test_dest | ||
41 | |||
42 | mkdir -p /mnt/rootfs || die | ||
43 | mountpoint -q /mnt/rootfs || mount -o subvol=/ UUID=$(rootfs_uuid) /mnt/rootfs || die | ||
44 | push_remote /mnt/rootfs / "$ssh_dst" | ||