diff --git a/src/freedombone-app-ipfs b/src/freedombone-app-ipfs index c95c52be26bcfa1634c04d6edd7806f6b8d11a38..8e6e0a39f2d76e015188a790e10ecbbb4f2a6af6 100755 --- a/src/freedombone-app-ipfs +++ b/src/freedombone-app-ipfs @@ -63,10 +63,38 @@ function backup_local_ipfs { fi } +function restore_local_ipfs { + if ! grep -q "Admin user" $COMPLETION_FILE; then + return + fi + if [ -d $USB_MOUNT/backup/ipfs ]; then + echo $"Restoring IPFS" + temp_restore_dir=/root/tempipfs + function_check restore_directory_from_usb + restore_directory_from_usb $temp_restore_dir ipfs + ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}') + cp -rf $temp_restore_dir/home/$ADMIN_USERNAME/.ipfs/* /home/$ADMIN_USERNAME/.ipfs + if [ ! "$?" = "0" ]; then + rm -rf $temp_restore_dir + function_check set_user_permissions + set_user_permissions + function_check backup_unmount_drive + backup_unmount_drive + exit 27627 + fi + rm -rf $temp_restore_dir + echo $"Restore of IPFS complete" + fi +} + function backup_remote_ipfs { echo -n '' } +function restore_remote_ipfs { + echo -n '' +} + function remove_ipfs { if ! grep -Fxq "install_ipfs" $COMPLETION_FILE; then return diff --git a/src/freedombone-app-xmpp b/src/freedombone-app-xmpp index 7309d309893a695d3d9394445fdb76d6bc9e8bf0..3c816c5b5b24fecb4680a0dc5c71b2fcd3b92fd5 100755 --- a/src/freedombone-app-xmpp +++ b/src/freedombone-app-xmpp @@ -116,10 +116,35 @@ function backup_local_xmpp { fi } +function restore_local_xmpp { + if [ -d /var/lib/prosody ]; then + echo $"Restoring XMPP settings" + temp_restore_dir=/root/tempxmpp + function_check restore_directory_from_usb + restore_directory_from_usb $temp_restore_dir xmpp + cp -r $temp_restore_dir/var/lib/prosody/* /var/lib/prosody + if [ ! "$?" = "0" ]; then + function_check set_user_permissions + set_user_permissions + function_check backup_unmount_drive + backup_unmount_drive + exit 725 + fi + rm -rf $temp_restore_dir + service prosody restart + chown -R prosody:prosody /var/lib/prosody/* + echo $"Restore of XMPP settings complete" + fi +} + function backup_remote_xmpp { echo -n '' } +function restore_remote_xmpp { + echo -n '' +} + function configure_firewall_for_xmpp { if [ ! -d /etc/prosody ]; then return diff --git a/src/freedombone-restore-local b/src/freedombone-restore-local index 39c69fcce2a553cc1bf7ead1fe2c5c656b1ff05f..bf8d1a6d263c31cd13917dca18b9772280a24caf 100755 --- a/src/freedombone-restore-local +++ b/src/freedombone-restore-local @@ -491,26 +491,6 @@ function restore_admin_readme { fi } -function restore_ipfs { - if [[ $RESTORE_APP != 'all' ]]; then - if [[ $RESTORE_APP != 'ipfs' ]]; then - return - fi - fi - if [ -d $USB_MOUNT/backup/ipfs ]; then - echo $"Restoring IPFS" - restore_directory_from_usb /root/tempipfs ipfs - cp -rf /root/tempipfs/home/$ADMIN_USERNAME/.ipfs/* /home/$ADMIN_USERNAME/.ipfs - if [ ! "$?" = "0" ]; then - rm -rf /root/tempipfs - set_user_permissions - backup_unmount_drive - exit 276 - fi - rm -rf /root/tempipfs - fi -} - function restore_user_ssh_keys { if [[ $RESTORE_APP != 'all' ]]; then if [[ $RESTORE_APP != 'ssh' ]]; then @@ -797,27 +777,6 @@ function restore_mailing_list { fi } -function restore_xmpp { - if [[ $RESTORE_APP != 'all' ]]; then - if [[ $RESTORE_APP != 'xmpp' ]]; then - return - fi - fi - if [ -d /var/lib/prosody ]; then - echo $"Restoring XMPP settings" - restore_directory_from_usb /root/tempxmpp xmpp - cp -r /root/tempxmpp/var/lib/prosody/* /var/lib/prosody - if [ ! "$?" = "0" ]; then - set_user_permissions - backup_unmount_drive - exit 725 - fi - rm -rf /root/tempxmpp - service prosody restart - chown -R prosody:prosody /var/lib/prosody/* - fi -} - function restore_email { if [[ $RESTORE_APP != 'all' ]]; then if [[ $RESTORE_APP != 'email' ]]; then @@ -905,9 +864,6 @@ restore_certs restore_personal_settings restore_mailing_list -restore_ipfs -restore_xmpp - restore_email restore_apps set_user_permissions