From 81d4fab28383b99b62b44a858f4175b9bc84d396 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 10 Jul 2016 14:54:19 +0100 Subject: [PATCH] Move remote tox restore to app script --- src/freedombone-app-mumble | 28 ++++++++++++++++- src/freedombone-app-tox | 16 +++++++++- src/freedombone-restore-remote | 57 ---------------------------------- 3 files changed, 42 insertions(+), 59 deletions(-) diff --git a/src/freedombone-app-mumble b/src/freedombone-app-mumble index 2d77c0a7..8134628a 100755 --- a/src/freedombone-app-mumble +++ b/src/freedombone-app-mumble @@ -107,7 +107,33 @@ function backup_remote_mumble { } function restore_remote_mumble { - echo -n '' + if [ -d $SERVER_DIRECTORY/backup/voip ]; then + echo $"Restoring Mumble settings" + temp_restore_dir=/root/tempvoip + function_check restore_directory_from_friend + restore_directory_from_friend $temp_restore_dir voip + cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/mumble-server.ini /etc/ + if [ ! "$?" = "0" ]; then + rm -rf $temp_restore_dir + exit 7823 + fi + cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/sipwitch.conf /etc/sipwitch.conf + if [ ! "$?" = "0" ]; then + rm -rf $temp_restore_dir + exit 7823 + fi + cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/mumble-server.sqlite /var/lib/mumble-server/ + if [ ! "$?" = "0" ]; then + rm -rf $temp_restore_dir + exit 276 + fi + rm -rf $temp_restore_dir + cp /etc/ssl/certs/mumble* /var/lib/mumble-server + cp /etc/ssl/private/mumble* /var/lib/mumble-server + chown -R mumble-server:mumble-server /var/lib/mumble-server + service mumble-server restart + echo $"Restore of Mumble complete" + fi } function remove_mumble { diff --git a/src/freedombone-app-tox b/src/freedombone-app-tox index e337709a..ffb6a8d8 100755 --- a/src/freedombone-app-tox +++ b/src/freedombone-app-tox @@ -117,7 +117,21 @@ function backup_remote_tox { } function restore_remote_tox { - echo -n '' + if [ -d $SERVER_DIRECTORY/backup/tox ]; then + echo $"Restoring Tox node settings" + function_check restore_directory_from_friend + restore_directory_from_friend / tox + if [ ! "$?" = "0" ]; then + exit 93653 + fi + cp /var/lib/tox-bootstrapd/tox-bootstrapd.conf /etc/tox-bootstrapd.conf + systemctl restart tox-bootstrapd.service + if [ ! "$?" = "0" ]; then + systemctl status tox-bootstrapd.service + exit 59369 + fi + echo $"Restore of Tox node complete" + fi } function remove_tox_node { diff --git a/src/freedombone-restore-remote b/src/freedombone-restore-remote index c0cd7fa2..fe4fe78a 100755 --- a/src/freedombone-restore-remote +++ b/src/freedombone-restore-remote @@ -666,61 +666,6 @@ function restore_mailing_list { fi } -function restore_voip { - if [[ $RESTORE_APP != 'all' ]]; then - if [[ $RESTORE_APP != 'voip' ]]; then - return - fi - fi - if [ -d $SERVER_DIRECTORY/backup/voip ]; then - echo $"Restoring VoIP settings" - temp_restore_dir=/root/tempvoip - restore_directory_from_friend $temp_restore_dir voip - cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/mumble-server.ini /etc/ - if [ ! "$?" = "0" ]; then - rm -rf $temp_restore_dir - exit 7823 - fi - cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/sipwitch.conf /etc/sipwitch.conf - if [ ! "$?" = "0" ]; then - rm -rf $temp_restore_dir - exit 7823 - fi - cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/mumble-server.sqlite /var/lib/mumble-server/ - if [ ! "$?" = "0" ]; then - rm -rf $temp_restore_dir - exit 276 - fi - rm -rf $temp_restore_dir - cp /etc/ssl/certs/mumble* /var/lib/mumble-server - cp /etc/ssl/private/mumble* /var/lib/mumble-server - chown -R mumble-server:mumble-server /var/lib/mumble-server - service sipwitch restart - service mumble-server restart - fi -} - -function restore_tox { - if [[ $RESTORE_APP != 'all' ]]; then - if [[ $RESTORE_APP != 'tox' ]]; then - return - fi - fi - if [ -d $SERVER_DIRECTORY/backup/tox ]; then - echo $"Restoring Tox node settings" - restore_directory_from_friend / tox - if [ ! "$?" = "0" ]; then - exit 93653 - fi - cp /var/lib/tox-bootstrapd/tox-bootstrapd.conf /etc/tox-bootstrapd.conf - systemctl restart tox-bootstrapd.service - if [ ! "$?" = "0" ]; then - systemctl status tox-bootstrapd.service - exit 59369 - fi - fi -} - function restore_email { if [[ $RESTORE_APP != 'all' ]]; then if [[ $RESTORE_APP != 'email' ]]; then @@ -794,8 +739,6 @@ restore_mailing_list restore_email #restore_apps remote -restore_voip -restore_tox restore_dlna echo $"*** Remote restore was successful ***"