Backup and restore any monkeysphere ids

This commit is contained in:
Bob Mottram 2016-04-29 16:46:44 +01:00
parent d6badcc4cc
commit af1c64912d
No known key found for this signature in database
GPG Key ID: BA68F26108DC9F87
4 changed files with 2839 additions and 2772 deletions

View File

@ -327,6 +327,12 @@ function backup_users {
backup_directory_to_usb /home/$USERNAME/.config config/$USERNAME
fi
# Backup monkeysphere
if [ -d /home/$USERNAME/.monkeysphere ]; then
echo $"Backing up monkeysphere files for $USERNAME"
backup_directory_to_usb /home/$USERNAME/.monkeysphere monkeysphere/$USERNAME
fi
# Backup user local
if [ -d /home/$USERNAME/.local ]; then
echo $"Backing up local files for $USERNAME"

View File

@ -234,6 +234,12 @@ function backup_users {
backup_directory_to_friend /home/$USERNAME/.config config/$USERNAME
fi
# monkeysphere files
if [ -d /home/$USERNAME/.monkeysphere ]; then
echo $"Backing up monkeysphere files for $USERNAME"
backup_directory_to_friend /home/$USERNAME/.monkeysphere monkeysphere/$USERNAME
fi
# fin files
if [ -d /home/$USERNAME/.fin ]; then
echo $"Backing up fin files for $USERNAME"

View File

@ -612,6 +612,33 @@ function restore_user_config {
fi
}
function restore_user_monkeysphere {
if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'usermonkeysphere' ]]; then
return
fi
fi
if [ -d $USB_MOUNT/backup/monkeysphere ]; then
for d in $USB_MOUNT/backup/monkeysphere/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
if [ ! -d /home/$USERNAME ]; then
${PROJECT_NAME}-adduser $USERNAME
fi
echo $"Restoring monkeysphere files for $USERNAME"
restore_directory_from_usb /root/tempmonkeysphere monkeysphere/$USERNAME
cp -r /root/tempmonkeysphere/home/$USERNAME/.monkeysphere /home/$USERNAME/
if [ ! "$?" = "0" ]; then
rm -rf /root/tempmonkeysphere
unmount_drive
exit 664
fi
rm -rf /root/tempmonkeysphere
fi
done
fi
}
function restore_user_fin {
if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'userfin' ]]; then
@ -1210,6 +1237,7 @@ restore_admin_readme
restore_ipfs
restore_user_ssh_keys
restore_user_config
restore_user_monkeysphere
restore_user_fin
restore_user_local
restore_certs

View File

@ -488,6 +488,32 @@ function restore_user_config {
done
}
function restore_user_monkeysphere {
if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'usermonkeysphere' ]]; then
return
fi
fi
for d in $SERVER_DIRECTORY/backup/monkeysphere/*/ ; do
USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
if [[ $USERNAME != "git" && $USERNAME != "mirrors" && $USERNAME != "sync" ]]; then
if [ -d $SERVER_DIRECTORY/backup/monkeysphere/$USERNAME ]; then
if [ ! -d /home/$USERNAME ]; then
${PROJECT_NAME}-adduser $USERNAME
fi
echo $"Restoring monkeysphere files for $USERNAME"
restore_directory_from_friend /root/tempmonkeysphere monkeysphere/$USERNAME
cp -r /root/tempmonkeysphere/home/$USERNAME/.monkeysphere /home/$USERNAME/
if [ ! "$?" = "0" ]; then
rm -rf /root/tempmonkeysphere
exit 664
fi
rm -rf /root/tempmonkeysphere
fi
fi
done
}
function restore_user_fin {
if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'userfin' ]]; then
@ -1052,6 +1078,7 @@ restore_admin_readme
restore_ipfs
restore_ssh_keys
restore_user_config
restore_user_monkeysphere
restore_user_fin
restore_user_local
restore_certs