Allow some additional user specified directories to be backed up

This commit is contained in:
Bob Mottram 2015-12-11 16:06:28 +00:00
parent b49b51d265
commit 7fb07fc11d
4 changed files with 42 additions and 0 deletions

View File

@ -30,6 +30,7 @@
PROJECT_NAME='freedombone'
COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv
export TEXTDOMAIN=${PROJECT_NAME}-backup-local
export TEXTDOMAINDIR="/usr/share/locale"
@ -413,6 +414,24 @@ function backup_mariadb {
fi
}
function backup_extra_directories {
if [ ! -f $BACKUP_EXTRA_DIRECTORIES ]; then
return
fi
echo $"Backing up some additional directories"
while read backup_line
do
backup_dir=$(echo "$backup_line" | awk -F ',' '{print $1}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
if [ -d "$backup_dir" ]; then
destination_dir=$(echo "$backup_line" | awk -F ',' '{print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
backup_directory_to_usb "$backup_dir" "$destination_dir"
else
echo $"WARNING: Directory $backup_dir does not exist"
fi
done <$BACKUP_EXTRA_DIRECTORIES
}
# has the remove option been set ?
remove_option=$2
if [[ $1 == "remove" ]]; then
@ -431,6 +450,7 @@ backup_configuration
backup_admin_readme
backup_voip
backup_mariadb
backup_extra_directories
unmount_drive
exit 0

View File

@ -31,6 +31,7 @@
PROJECT_NAME='freedombone'
COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
CONFIG_FILE=$HOME/${PROJECT_NAME}.cfg
BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv
export TEXTDOMAIN=${PROJECT_NAME}-backup-remote
export TEXTDOMAINDIR="/usr/share/locale"
@ -438,6 +439,24 @@ function disperse_key_shares {
fi
}
function backup_extra_directories {
if [ ! -f $BACKUP_EXTRA_DIRECTORIES ]; then
return
fi
echo $"Backing up some additional directories"
while read backup_line
do
backup_dir=$(echo "$backup_line" | awk -F ',' '{print $1}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
if [ -d "$backup_dir" ]; then
destination_dir=$(echo "$backup_line" | awk -F ',' '{print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
backup_directory_to_friend "$backup_dir" "$destination_dir"
else
echo $"WARNING: Directory $backup_dir does not exist"
fi
done <$BACKUP_EXTRA_DIRECTORIES
}
backup_configuration
backup_users
backup_letsencrypt
@ -457,6 +476,7 @@ backup_dlna
backup_voip
backup_tox
backup_mariadb
backup_extra_directories
# For each remote server
while read remote_server

View File

@ -30,6 +30,7 @@
PROJECT_NAME='freedombone'
COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv
export TEXTDOMAIN=${PROJECT_NAME}-restore-local
export TEXTDOMAINDIR="/usr/share/locale"

View File

@ -31,6 +31,7 @@
PROJECT_NAME='freedombone'
COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
CONFIG_FILE=$HOME/${PROJECT_NAME}.cfg
BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv
export TEXTDOMAIN=${PROJECT_NAME}-restore-remote
export TEXTDOMAINDIR="/usr/share/locale"