diff --git a/src/freedombone-backup-local b/src/freedombone-backup-local index 10101f0a..1b00cc98 100755 --- a/src/freedombone-backup-local +++ b/src/freedombone-backup-local @@ -295,6 +295,12 @@ function backup_users { backup_directory_to_usb /home/$USERNAME/.config config/$USERNAME fi + # Backup user local + if [ -d /home/$USERNAME/.local ]; then + echo $"Backing up local files for $USERNAME" + backup_directory_to_usb /home/$USERNAME/.local local/$USERNAME + fi + # Backup mutt if [ -f /home/$USERNAME/.muttrc ]; then echo $"Backing up Mutt settings for $USERNAME" diff --git a/src/freedombone-backup-remote b/src/freedombone-backup-remote index 0d7d33ed..23f0e2ba 100755 --- a/src/freedombone-backup-remote +++ b/src/freedombone-backup-remote @@ -204,6 +204,12 @@ function backup_users { backup_directory_to_friend /home/$USERNAME/.config config/$USERNAME fi + # local files + if [ -d /home/$USERNAME/.local ]; then + echo $"Backing up local files for $USERNAME" + backup_directory_to_friend /home/$USERNAME/.local local/$USERNAME + fi + # mutt settings if [ -f /home/$USERNAME/.muttrc ]; then echo $"Backing up Mutt settings for $USERNAME" diff --git a/src/freedombone-restore-local b/src/freedombone-restore-local index bab2db23..2e3cfc0e 100755 --- a/src/freedombone-restore-local +++ b/src/freedombone-restore-local @@ -596,6 +596,33 @@ function restore_user_config { fi } +function restore_user_local { + if [[ $RESTORE_APP != 'all' ]]; then + if [[ $RESTORE_APP != 'userlocal' ]]; then + return + fi + fi + if [ -d $USB_MOUNT/backup/local ]; then + for d in $USB_MOUNT/backup/local/*/ ; do + USERNAME=$(echo "$d" | awk -F '/' '{print $6}') + if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then + if [ ! -d /home/$USERNAME ]; then + ${PROJECT_NAME}-adduser $USERNAME + fi + echo $"Restoring local files for $USERNAME" + restore_directory_from_usb /root/templocal local/$USERNAME + cp -r /root/templocal/home/$USERNAME/.local /home/$USERNAME/ + if [ ! "$?" = "0" ]; then + rm -rf /root/templocal + unmount_drive + exit 664 + fi + rm -rf /root/templocal + fi + done + fi +} + function restore_certs { if [[ $RESTORE_APP != 'all' ]]; then if [[ $RESTORE_APP != 'certs' ]]; then @@ -1065,6 +1092,7 @@ restore_admin_readme restore_ipfs restore_user_ssh_keys restore_user_config +restore_user_local restore_certs restore_personal_settings restore_mailing_list diff --git a/src/freedombone-restore-remote b/src/freedombone-restore-remote index 2850a71a..66d6877f 100755 --- a/src/freedombone-restore-remote +++ b/src/freedombone-restore-remote @@ -476,6 +476,32 @@ function restore_user_config { done } +function restore_user_local { + if [[ $RESTORE_APP != 'all' ]]; then + if [[ $RESTORE_APP != 'userlocal' ]]; then + return + fi + fi + for d in $SERVER_DIRECTORY/backup/local/*/ ; do + USERNAME=$(echo "$d" | awk -F '/' '{print $6}') + if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then + if [ -d $SERVER_DIRECTORY/backup/local/$USERNAME ]; then + if [ ! -d /home/$USERNAME ]; then + ${PROJECT_NAME}-adduser $USERNAME + fi + echo $"Restoring local files for $USERNAME" + restore_directory_from_friend /root/templocal local/$USERNAME + cp -r /root/templocal/home/$USERNAME/.local /home/$USERNAME/ + if [ ! "$?" = "0" ]; then + rm -rf /root/templocal + exit 664 + fi + rm -rf /root/templocal + fi + fi + done +} + function restore_certs { if [[ $RESTORE_APP != 'all' ]]; then if [[ $RESTORE_APP != 'certs' ]]; then @@ -919,6 +945,7 @@ restore_admin_readme restore_ipfs restore_ssh_keys restore_user_config +restore_user_local restore_certs restore_personal_settings restore_mailing_list