Remote backup of tahoelafs

This commit is contained in:
Bob Mottram 2016-08-29 11:21:39 +01:00
parent 0c842943f4
commit 5fe86e97e6
1 changed files with 34 additions and 6 deletions

View File

@ -112,12 +112,13 @@ function backup_local_tahoelafs {
if [ ! -d $source_directory ]; then
return
fi
echo $"Backing up Tahoe-LAFS introducer"
systemctl stop tahoelafs
dest_directory=tahoelafs
function_check backup_directory_to_usb
backup_directory_to_usb $source_directory $dest_directory
echo $"Backup to $dest_directory complete"
systemctl start tahoelafs
echo $"Backup to $dest_directory complete"
}
function restore_local_tahoelafs {
@ -125,20 +126,47 @@ function restore_local_tahoelafs {
systemctl stop tahoelafs
temp_restore_dir=/root/temptahoelafs
restore_directory_from_usb $temp_restore_dir tahoelafs
rm -rf /home/tahoelafs/.tahoe-introducer
mv /home/tahoelafs/.tahoe-introducer /home/tahoelafs/.tahoe-introducer-old
cp -r $temp_restore_dir/home/tahoelafs/.tahoe-introducer /home/tahoelafs/
if [ ! "$?" = "0" ]; then
mv /home/tahoelafs/.tahoe-introducer-old /home/tahoelafs/.tahoe-introducer
exit 246833
fi
rm -rf /home/tahoelafs/.tahoe-introducer
chown -R tahoelafs:tahoelafs /home/tahoelafs
systemctl start tahoelafs
echo $"Restore complete"
}
function backup_remote_tahoelafs {
echo -n ''
# TODO
source_directory=/home/tahoelafs/.tahoe-introducer
if [ ! -d $source_directory ]; then
return
fi
echo $"Backing up Tahoe-LAFS introducer"
systemctl stop tahoelafs
dest_directory=tahoelafs
function_check backup_directory_to_usb
backup_directory_to_friend $source_directory $dest_directory
systemctl start tahoelafs
echo $"Backup to $dest_directory complete"
}
function restore_remote_tahoelafs {
echo -n ''
# TODO
echo $"Restoring Tahoe-LAFS introducer"
systemctl stop tahoelafs
temp_restore_dir=/root/temptahoelafs
restore_directory_from_friend $temp_restore_dir tahoelafs
mv /home/tahoelafs/.tahoe-introducer /home/tahoelafs/.tahoe-introducer-old
cp -r $temp_restore_dir/home/tahoelafs/.tahoe-introducer /home/tahoelafs/
if [ ! "$?" = "0" ]; then
mv /home/tahoelafs/.tahoe-introducer-old /home/tahoelafs/.tahoe-introducer
exit 623925
fi
rm -rf /home/tahoelafs/.tahoe-introducer-old
chown -R tahoelafs:tahoelafs /home/tahoelafs
systemctl start tahoelafs
echo $"Restore complete"
}
function remove_tahoelafs {