Use a fixed obnam client name

This commit is contained in:
Bob Mottram 2016-10-24 12:35:34 +01:00
parent f17003d675
commit d79ad89c16
4 changed files with 545 additions and 509 deletions

View File

@ -68,6 +68,14 @@ if [ -f /root/dbpass ]; then
DATABASE_PASSWORD=$(cat /root/dbpass)
fi
function set_obnam_client_name {
# obnam can backup multiple machines with different domain names to
# a repository. To be able to restore directories from different
# machines we need to enforce a single client name for all backups
echo '[config]' > /etc/obnam.conf
echo "client-name = ${PROJECT_NAME}" >> /etc/obnam.conf
}
function suspend_site {
# suspends a given website
if [[ $ENABLE_VERIFICATION != "yes" ]]; then
@ -217,6 +225,7 @@ function backup_directory_to_usb {
if [ ! -d $USB_MOUNT/backup/${2} ]; then
mkdir -p $USB_MOUNT/backup/${2}
fi
set_obnam_client_name
obnam force-lock -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID ${1}
obnam backup -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID ${1}
if [[ $ENABLE_VERIFICATION == "yes" ]]; then

File diff suppressed because it is too large Load Diff

View File

@ -71,6 +71,14 @@ GIT_DOMAIN_NAME=
WIKI_DOMAIN_NAME=
FULLBLOG_DOMAIN_NAME=
function set_obnam_client_name {
# obnam can backup multiple machines with different domain names to
# a repository. To be able to restore directories from different
# machines we need to enforce a single client name for all backups
echo '[config]' > /etc/obnam.conf
echo "client-name = ${PROJECT_NAME}" >> /etc/obnam.conf
}
function mount_drive {
if [ $1 ]; then
USB_DRIVE=/dev/${1}1
@ -169,6 +177,7 @@ function restore_directory_from_usb {
if [ ! -d ${1} ]; then
mkdir ${1}
fi
set_obnam_client_name
obnam restore -r $USB_MOUNT/backup/${2} --to ${1}
}

View File

@ -97,10 +97,19 @@ fi
# MariaDB password
DATABASE_PASSWORD=$(cat /root/dbpass)
function set_obnam_client_name {
# obnam can backup multiple machines with different domain names to
# a repository. To be able to restore directories from different
# machines we need to enforce a single client name for all backups
echo '[config]' > /etc/obnam.conf
echo "client-name = ${PROJECT_NAME}" >> /etc/obnam.conf
}
function restore_directory_from_friend {
if [ ! -d ${1} ]; then
mkdir ${1}
fi
set_obnam_client_name
obnam restore -r $SERVER_DIRECTORY/backup/${2} --to ${1}
}