aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2015-10-27 11:05:40 +0100
committerDavid Runge <dave@sleepmap.de>2015-10-27 11:05:40 +0100
commitf07a4a2c90e65351d262aaae0ec90f9725fed293 (patch)
treee6361c01cc84d77ea9871f0fb8c38eea9bd4eaa7
parent650e402d9069126720c629be1dda9e77bdc80e6b (diff)
downloadcrypted-backups-master.tar.gz
crypted-backups-master.tar.bz2
crypted-backups-master.tar.xz
crypted-backups-master.zip
bin/crypted-backups: Adding function for mirroring the backup locally or remotely. Adding TODO for recall function. Adding setting for irssi backup.HEADmaster
-rwxr-xr-xbin/crypted-backups70
1 files changed, 69 insertions, 1 deletions
diff --git a/bin/crypted-backups b/bin/crypted-backups
index d96ad36..5883c5c 100755
--- a/bin/crypted-backups
+++ b/bin/crypted-backups
@@ -354,12 +354,74 @@ function cleanup_backup () {
return 0
}
+function check_mirror_settings () {
+ if [ $mirror_host = "" -o $mirror_host = "127.0.0.1" -o $mirror_host = "localhost" ];then
+ "check_"$user_mode"_directory" $mirror_source
+ echo "local"
+ return 0
+ else
+ if [ $mirror_user = "" ];then
+ echo "The \"mirror_user\" variable can not be empty if using a remote mirror!"
+ return 1
+ fi
+ echo "remote"
+ return 0
+ fi
+}
+
+function mirror_backup () {
+ local mirror_source=$(sanitize_pathname $mirror_source)
+ local mirror_destination=$mirror_destination
+ local mirror_type=$(check_mirror_settings)
+ check_directory_exists $mirror_source
+ if [ $mirror_type = "local" ];then
+ rsync -r \
+ -t \
+ -p \
+ -o \
+ -g \
+ -v \
+ --progress\
+ --delete\
+ --ignore-existing\
+ --size-only\
+ -s \
+ --exclude 'lost+found' \
+ --exclude '.Trash-1000' \
+ --exclude '$RECYCLEBIN' \
+ --exclude 'System Volume Information' \
+ --exclude '.thumbs' \
+ $mirror_source \
+ $mirror_destination
+ elif [ $mirror_type = "remote" ];then
+ rsync -r \
+ -t \
+ -p \
+ -o \
+ -g \
+ -v \
+ --progress\
+ --delete\
+ --ignore-existing\
+ --size-only\
+ -s \
+ --exclude 'lost+found' \
+ --exclude '.Trash-1000' \
+ --exclude '$RECYCLEBIN' \
+ --exclude 'System Volume Information' \
+ --exclude '.thumbs' \
+ $mirror_source \
+ $mirror_user"@"$mirror_host":"$mirror_destination
+ fi
+
+}
+
function print_help () {
echo "help"
exit 0
}
-#TODO: Add function to mirror backups
+#TODO: Add function to recall backup by selection
#TODO: Add function to automatically add key to keyring, if not found
@@ -375,6 +437,9 @@ if [ ${#@} -gt 0 ]; then
h)
print_help
;;
+ m)
+ mirror_backup
+ ;;
r)
echo "recall"
;;
@@ -433,6 +498,9 @@ if [ -n "$source_mode" ];then
firefox)
backup_single_directory $firefox_source $firefox_destination
;;
+ irssi)
+ backup_single_directory $irssi_source $irssi_destination
+ ;;
thunderbird)
backup_single_directory $thunderbird_source $thunderbird_destination
;;