summaryrefslogtreecommitdiff
path: root/btrfs-send-root.sh
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2016-04-29 14:36:26 -0400
committerAndrew Cady <d@jerkface.net>2016-04-29 14:36:30 -0400
commit153d299a41b9be4e15dab1ca29bb93a74bd2445d (patch)
tree96fbfbe7c64f0b3f02f3d755e2b129917785bb98 /btrfs-send-root.sh
parent5f41fb879ca830e5ad3345878e59072f3d6573bc (diff)
fix paths (in progress)
Diffstat (limited to 'btrfs-send-root.sh')
-rw-r--r--btrfs-send-root.sh44
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
5rootfs_uuid ()
6{
7 btrfs filesystem show / | sed -ne 's/.*uuid: //p'
8}
9
10remote_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
17dummy_receiver()
18{
19 true
20}
21
22push_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
40ssh_dst=d@fifty.local:sami/test_dest
41
42mkdir -p /mnt/rootfs || die
43mountpoint -q /mnt/rootfs || mount -o subvol=/ UUID=$(rootfs_uuid) /mnt/rootfs || die
44push_remote /mnt/rootfs / "$ssh_dst"