Restore directories

This commit is contained in:
Bob Mottram 2015-09-21 21:36:31 +01:00
parent 5cd6989e59
commit be6c6d46be
1 changed files with 41 additions and 26 deletions

View File

@ -3330,14 +3330,14 @@ function create_restore_script {
fi
if grep -Fxq "install_owncloud" $COMPLETION_FILE; then
RESTORE_SUBDIR='root/'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/owncloud2/'
fi
BACKUP_INCLUDES_WEBSITES="yes"
restore_database owncloud $OWNCLOUD_DOMAIN_NAME
echo "if [ -d $USB_MOUNT/backup/owncloud2 ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
restore_directory_from_usb '/root/tempowncloud2' 'owncloud2'
RESTORE_SUBDIR='etc/'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/owncloud2/'
fi
echo " cp -r /root/tempowncloud2/${RESTORE_SUBDIR}owncloud/* /etc/owncloud/" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3355,12 +3355,12 @@ function create_restore_script {
fi
if grep -Fxq "install_gogs" $COMPLETION_FILE; then
RESTORE_SUBDIR='root'
BACKUP_INCLUDES_WEBSITES="yes"
restore_database gogs $GIT_DOMAIN_NAME
RESTORE_SUBDIR='home'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/gogs'
fi
BACKUP_INCLUDES_WEBSITES="yes"
restore_database gogs $GIT_DOMAIN_NAME
echo "if [ -d $USB_MOUNT/backup/gogs ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring Gogs settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! -d /home/git/go/src/github.com/gogits/gogs/custom ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -3405,7 +3405,7 @@ function create_restore_script {
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
fi
RESTORE_SUBDIR='root'
RESTORE_SUBDIR='var'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/wiki'
fi
@ -3419,6 +3419,7 @@ function create_restore_script {
echo ' exit 868' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
restore_directory_from_usb '/root/tempwiki2' 'wiki2'
RESTORE_SUBDIR='etc'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/wiki2'
fi
@ -3438,7 +3439,7 @@ function create_restore_script {
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
RESTORE_SUBDIR='root'
RESTORE_SUBDIR='var'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/blog'
fi
@ -3467,7 +3468,7 @@ function create_restore_script {
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
RESTORE_SUBDIR='root'
RESTORE_SUBDIR='etc'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/cjdns'
fi
@ -3505,7 +3506,7 @@ function create_restore_script {
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
RESTORE_SUBDIR='root'
RESTORE_SUBDIR='var'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/dlna'
fi
@ -3524,16 +3525,22 @@ function create_restore_script {
echo 'fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_SCRIPT_NAME
RESTORE_SUBDIR='root'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/voip'
fi
echo "if [ -d $USB_MOUNT/backup/voip ]; then" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' echo "Restoring VoIP settings"' >> /usr/bin/$RESTORE_SCRIPT_NAME
restore_directory_from_usb '/root/tempvoip' 'voip'
RESTORE_SUBDIR='home'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='usb/backup/voip'
fi
echo -n " cp -f /root/tempvoip/${RESTORE_SUBDIR}/" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo -n '$MY_USERNAME/tempbackup/' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo "$VOIP_CONFIG_FILE /etc/" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " umount $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo " rm -rf $USB_MOUNT" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' rm -rf /root/tempvoip' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' exit 3679' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo -n " cp -f /root/tempvoip/${RESTORE_SUBDIR}/" >> /usr/bin/$RESTORE_SCRIPT_NAME
echo -n '$MY_USERNAME/tempbackup/' >> /usr/bin/$RESTORE_SCRIPT_NAME
echo "$VOIP_DATABASE /var/lib/mumble-server/" >> /usr/bin/$RESTORE_SCRIPT_NAME
@ -4639,12 +4646,12 @@ function restore_from_friend {
fi
if grep -Fxq "install_owncloud" $COMPLETION_FILE; then
RESTORE_SUBDIR='root'
BACKUP_INCLUDES_WEBSITES="yes"
restore_database_from_friend owncloud $OWNCLOUD_DOMAIN_NAME
RESTORE_SUBDIR='var'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='remoterestore/backup/owncloud'
fi
BACKUP_INCLUDES_WEBSITES="yes"
restore_database_from_friend owncloud $OWNCLOUD_DOMAIN_NAME
echo 'if [ -d $SERVER_DIRECTORY/backup/owncloud ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo ' echo "Restoring Owncloud installation"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo " cp -r /root/tempowncloud/${RESTORE_SUBDIR}/lib/owncloud/* /var/lib/owncloud/" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
@ -4652,6 +4659,7 @@ function restore_from_friend {
echo ' exit 981' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
restore_directory_from_friend /root/tempowncloud2 owncloud2
RESTORE_SUBDIR='etc'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='remoterestore/backup/owncloud2'
fi
@ -4670,12 +4678,12 @@ function restore_from_friend {
fi
if grep -Fxq "install_gogs" $COMPLETION_FILE; then
RESTORE_SUBDIR='root'
BACKUP_INCLUDES_WEBSITES="yes"
restore_database_from_friend gogs $GIT_DOMAIN_NAME
RESTORE_SUBDIR='home'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='remoterestore/backup/gogs'
fi
BACKUP_INCLUDES_WEBSITES="yes"
restore_database_from_friend gogs $GIT_DOMAIN_NAME
echo 'if [ -d $SERVER_DIRECTORY/backup/gogs ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo ' if [ ! -d /home/git/go/src/github.com/gogits/gogs/custom ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo ' mkdir -p /home/git/go/src/github.com/gogits/gogs/custom' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
@ -4686,6 +4694,7 @@ function restore_from_friend {
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo ' echo "Restoring Gogs repos"' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
restore_directory_from_friend /root/tempgogsrepos gogsrepos
RESTORE_SUBDIR='home'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='remoterestore/backup/gogsrepos'
fi
@ -4698,6 +4707,7 @@ function restore_from_friend {
echo ' if [ ! -d /home/git/.ssh ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo ' mkdir /home/git/.ssh' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
RESTORE_SUBDIR='home'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='remoterestore/backup/gogsssh'
fi
@ -4713,7 +4723,7 @@ function restore_from_friend {
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
fi
RESTORE_SUBDIR='root'
RESTORE_SUBDIR='var'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='remoterestore/backup/wiki'
fi
@ -4725,6 +4735,7 @@ function restore_from_friend {
echo ' exit 868' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
restore_directory_from_friend /root/tempwiki2 wiki2
RESTORE_SUBDIR='etc'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='remoterestore/backup/wiki2'
fi
@ -4742,7 +4753,7 @@ function restore_from_friend {
echo 'fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
RESTORE_SUBDIR='root'
RESTORE_SUBDIR='var'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='remoterestore/backup/blog'
fi
@ -4767,7 +4778,7 @@ function restore_from_friend {
echo 'fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
RESTORE_SUBDIR='root'
RESTORE_SUBDIR='etc'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='remoterestore/backup/cjdns'
fi
@ -4783,7 +4794,7 @@ function restore_from_friend {
echo 'fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
RESTORE_SUBDIR='root'
RESTORE_SUBDIR='home'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='remoterestore/backup/voip'
fi
@ -4793,6 +4804,10 @@ function restore_from_friend {
echo -n " cp -f /root/tempvoip/${RESTORE_SUBDIR}" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo -n '/$MY_USERNAME/tempbackup/' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo "$VOIP_CONFIG_FILE /etc/" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo ' if [ ! "$?" = "0" ]; then' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo ' rm -rf /root/tempvoip' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo ' exit 7823' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo ' fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo -n " cp -f /root/tempvoip/${RESTORE_SUBDIR}/" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo -n '$MY_USERNAME/tempbackup/' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo "$VOIP_DATABASE /var/lib/mumble-server/" >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
@ -4840,7 +4855,7 @@ function restore_from_friend {
echo 'fi' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
echo '' >> /usr/bin/$RESTORE_FROM_FRIEND_SCRIPT_NAME
RESTORE_SUBDIR='root'
RESTORE_SUBDIR='var'
if [[ $BACKUP_TYPE != 'obnam' ]]; then
RESTORE_SUBDIR='remoterestore/backup/dlna'
fi