Browse Source

Backup user files in .local

Which includes profanity settings
Bob Mottram 9 years ago
parent
commit
07427dcbda

+ 6
- 0
src/freedombone-backup-local View File

@@ -295,6 +295,12 @@ function backup_users {
295 295
                 backup_directory_to_usb /home/$USERNAME/.config config/$USERNAME
296 296
             fi
297 297
 
298
+            # Backup user local
299
+            if [ -d /home/$USERNAME/.local ]; then
300
+                echo $"Backing up local files for $USERNAME"
301
+                backup_directory_to_usb /home/$USERNAME/.local local/$USERNAME
302
+            fi
303
+
298 304
             # Backup mutt
299 305
             if [ -f /home/$USERNAME/.muttrc ]; then
300 306
                 echo $"Backing up Mutt settings for $USERNAME"

+ 6
- 0
src/freedombone-backup-remote View File

@@ -204,6 +204,12 @@ function backup_users {
204 204
                 backup_directory_to_friend /home/$USERNAME/.config config/$USERNAME
205 205
             fi
206 206
 
207
+            # local files
208
+            if [ -d /home/$USERNAME/.local ]; then
209
+                echo $"Backing up local files for $USERNAME"
210
+                backup_directory_to_friend /home/$USERNAME/.local local/$USERNAME
211
+            fi
212
+
207 213
             # mutt settings
208 214
             if [ -f /home/$USERNAME/.muttrc ]; then
209 215
                 echo $"Backing up Mutt settings for $USERNAME"

+ 28
- 0
src/freedombone-restore-local View File

@@ -596,6 +596,33 @@ function restore_user_config {
596 596
     fi
597 597
 }
598 598
 
599
+function restore_user_local {
600
+    if [[ $RESTORE_APP != 'all' ]]; then
601
+        if [[ $RESTORE_APP != 'userlocal' ]]; then
602
+            return
603
+        fi
604
+    fi
605
+    if [ -d $USB_MOUNT/backup/local ]; then
606
+        for d in $USB_MOUNT/backup/local/*/ ; do
607
+            USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
608
+            if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
609
+                if [ ! -d /home/$USERNAME ]; then
610
+                    ${PROJECT_NAME}-adduser $USERNAME
611
+                fi
612
+                echo $"Restoring local files for $USERNAME"
613
+                restore_directory_from_usb /root/templocal local/$USERNAME
614
+                cp -r /root/templocal/home/$USERNAME/.local /home/$USERNAME/
615
+                if [ ! "$?" = "0" ]; then
616
+                    rm -rf /root/templocal
617
+                    unmount_drive
618
+                    exit 664
619
+                fi
620
+                rm -rf /root/templocal
621
+            fi
622
+        done
623
+    fi
624
+}
625
+
599 626
 function restore_certs {
600 627
     if [[ $RESTORE_APP != 'all' ]]; then
601 628
         if [[ $RESTORE_APP != 'certs' ]]; then
@@ -1065,6 +1092,7 @@ restore_admin_readme
1065 1092
 restore_ipfs
1066 1093
 restore_user_ssh_keys
1067 1094
 restore_user_config
1095
+restore_user_local
1068 1096
 restore_certs
1069 1097
 restore_personal_settings
1070 1098
 restore_mailing_list

+ 27
- 0
src/freedombone-restore-remote View File

@@ -476,6 +476,32 @@ function restore_user_config {
476 476
     done
477 477
 }
478 478
 
479
+function restore_user_local {
480
+    if [[ $RESTORE_APP != 'all' ]]; then
481
+        if [[ $RESTORE_APP != 'userlocal' ]]; then
482
+            return
483
+        fi
484
+    fi
485
+    for d in $SERVER_DIRECTORY/backup/local/*/ ; do
486
+        USERNAME=$(echo "$d" | awk -F '/' '{print $6}')
487
+        if [[ $USERNAME != "git" && $USRNAME != "mirrors" ]]; then
488
+            if [ -d $SERVER_DIRECTORY/backup/local/$USERNAME ]; then
489
+                if [ ! -d /home/$USERNAME ]; then
490
+                    ${PROJECT_NAME}-adduser $USERNAME
491
+                fi
492
+                echo $"Restoring local files for $USERNAME"
493
+                restore_directory_from_friend /root/templocal local/$USERNAME
494
+                cp -r /root/templocal/home/$USERNAME/.local /home/$USERNAME/
495
+                if [ ! "$?" = "0" ]; then
496
+                    rm -rf /root/templocal
497
+                    exit 664
498
+                fi
499
+                rm -rf /root/templocal
500
+            fi
501
+        fi
502
+    done
503
+}
504
+
479 505
 function restore_certs {
480 506
     if [[ $RESTORE_APP != 'all' ]]; then
481 507
         if [[ $RESTORE_APP != 'certs' ]]; then
@@ -919,6 +945,7 @@ restore_admin_readme
919 945
 restore_ipfs
920 946
 restore_ssh_keys
921 947
 restore_user_config
948
+restore_user_local
922 949
 restore_certs
923 950
 restore_personal_settings
924 951
 restore_mailing_list