aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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