Move xmpp local restore to app script

This commit is contained in:
Bob Mottram 2016-07-09 10:54:41 +01:00
parent 781453c7fe
commit 9ffb0fe508
3 changed files with 53 additions and 44 deletions

View File

@ -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

View File

@ -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

View File

@ -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