aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2015-10-26 13:15:34 +0100
committerDavid Runge <dave@sleepmap.de>2015-10-26 13:15:34 +0100
commite83384118c6e817ab85c1a8c1522ef456cbbd482 (patch)
tree9b17410a07cdfe82eabfc5da1d1a95d6ac68fbdd /bin
parent438b595d033b6450d779f7db39ca7e93b36c1a55 (diff)
downloadcrypted-backups-e83384118c6e817ab85c1a8c1522ef456cbbd482.tar.gz
crypted-backups-e83384118c6e817ab85c1a8c1522ef456cbbd482.tar.bz2
crypted-backups-e83384118c6e817ab85c1a8c1522ef456cbbd482.tar.xz
crypted-backups-e83384118c6e817ab85c1a8c1522ef456cbbd482.zip
bin/crypted-backups: Adding backup settings for most programs. Fixing multi-layered setup for mail backup. Adding TODO for directory existence check.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/crypted-backups33
1 files changed, 30 insertions, 3 deletions
diff --git a/bin/crypted-backups b/bin/crypted-backups
index d0c80aa..429d3db 100755
--- a/bin/crypted-backups
+++ b/bin/crypted-backups
@@ -168,7 +168,7 @@ function backup_single_directory () {
notification_source_to_destination "$source_parent_directory$source_directory_basename" $destination_file
echo "Going to $source_directory_basename's parent directory: $source_parent_directory."
cd $source_parent_directory
-
+ #TODO: check if directory, not for existence?
check_directory_exists $source_directory
"check_"$user_mode"_directory" $tmp_directory
"check_"$user_mode"_directory" $destination_directory
@@ -179,12 +179,21 @@ function backup_single_directory () {
function backup_multiple_directories () {
local source_directory=$(sanitize_pathname $1)
local destination_directory=$(sanitize_pathname $2)
+ local layered=0
+ if [ ${#@} -gt 2 ]; then
+ layered=$3
+ echo "Multi-layered"
+ fi
"check_"$user_mode"_directory" $destination_directory
for sub_directory in $source_directory*
do
if [ -d $sub_directory ];then
"check_"$user_mode"_directory" $sub_directory
- backup_single_directory $sub_directory $destination_directory
+ if [ $layered -eq 1 ];then
+ backup_multiple_directories $sub_directory $destination_directory$(get_basename_directory $sub_directory)
+ else
+ backup_single_directory $sub_directory $destination_directory
+ fi
fi
done
@@ -201,7 +210,7 @@ function set_user_mode () {
function check_gpg_set () {
if [ -z "$gpg_public_key" ];then
- echo "Error. gpg_public_key not set!"
+ echo "Error. \"gpg_public_key\" not set!"
exit 1
fi
}
@@ -254,29 +263,46 @@ fi
if [ -n "$source_mode" ];then
case $source_mode in
aura)
+ backup_single_directory $aura_source $aura_destination
;;
bitlbee)
+ backup_single_directory $bitlbee_source $bitlbee_destination
;;
etc)
backup_single_directory $etc_source $etc_destination
;;
git)
+ backup_multiple_directories $git_source $git_destination
;;
mail)
+ if [ "$mail_domains_as_folders" = "yes" ]; then
+ backup_multiple_directories $mail_source $mail_destination "1"
+ elif [ "$mail_domains_as_folders" = "no" ]; then
+ backup_multiple_directories $mail_source $mail_destination
+ else
+ echo "Setting \"mail_domains_as_folders\" to $mail_domains_as_folders is not supported!"
+ exit 1
+ fi
;;
mailman)
+ backup_single_directory $mailman_source $mailman_destination
;;
mariadb)
;;
logs)
+ backup_single_directory $logs_source $logs_destination
;;
websites)
+ backup_multiple_directories $websites_source $websites_destination
;;
firefox)
+ backup_single_directory $firefox_source $firefox_destination
;;
thunderbird)
+ backup_single_directory $thunderbird_source $thunderbird_destination
;;
weechat)
+ backup_single_directory $weechat_source $weechat_destination
;;
*)
echo "Error. $source_mode is not a valid backup option."
@@ -284,3 +310,4 @@ if [ -n "$source_mode" ];then
esac
fi
+exit 0