Dirty migration of backup magic to external drive
This commit is contained in:
parent
fca4f238ec
commit
8127ad8e02
@ -13,14 +13,23 @@ let
|
|||||||
|
|
||||||
cb-sync = pkgs.writeScriptBin "cb-sync" ''
|
cb-sync = pkgs.writeScriptBin "cb-sync" ''
|
||||||
#!${pkgs.bash}/bin/bash
|
#!${pkgs.bash}/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
# Check, if the something is mounted in our sycdir
|
# Check, if the something is mounted in our sycdir
|
||||||
if grep -qs '/mnt/external-drive' /proc/mounts
|
if grep -qs '/mnt/external-drive' /proc/mounts
|
||||||
then
|
then
|
||||||
rsync -rltD '/mnt/palladium/alpha.0/clerie-backup/clerie-backup-replication/' '/mnt/external-drive/clerie-backup'
|
echo "fine"
|
||||||
else
|
else
|
||||||
echo "Please plug in a backup drive and mount it using cb-mount"
|
echo "Please plug in a backup drive and mount it using cb-mount"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
SNAPSHOT_NAME=$(${pkgs.borgbackup}/bin/borg list --last 1 --short /mnt/palladium/clerie-backup)
|
||||||
|
${pkgs.borgbackup}/bin/borg mount /mnt/palladium/clerie-backup::$SNAPSHOT_NAME /mnt/clerie-backup-mount
|
||||||
|
${pkgs.bindfs}/bin/bindfs /mnt/clerie-backup-mount/mnt/clerie-backup /mnt/clerie-backup
|
||||||
|
${pkgs.borgbackup}/bin/borg create /mnt/external-drive/clerie-backup::$SNAPSHOT_NAME /mnt/clerie-backup
|
||||||
|
umount /mnt/clerie-backup-mount
|
||||||
|
${pkgs.borgbackup}/bin/borg unmoumt /mnt/clerie-backup-mount
|
||||||
'';
|
'';
|
||||||
|
|
||||||
cb-unmount = pkgs.writeScriptBin "cb-unmount" ''
|
cb-unmount = pkgs.writeScriptBin "cb-unmount" ''
|
||||||
|
Loading…
Reference in New Issue
Block a user