Przeglądaj źródła

Backup user files in .local

Which includes profanity settings
Bob Mottram 9 lat temu
rodzic
commit
07427dcbda

+ 6
- 0
src/freedombone-backup-local Wyświetl plik

295
                 backup_directory_to_usb /home/$USERNAME/.config config/$USERNAME
295
                 backup_directory_to_usb /home/$USERNAME/.config config/$USERNAME
296
             fi
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
             # Backup mutt
304
             # Backup mutt
299
             if [ -f /home/$USERNAME/.muttrc ]; then
305
             if [ -f /home/$USERNAME/.muttrc ]; then
300
                 echo $"Backing up Mutt settings for $USERNAME"
306
                 echo $"Backing up Mutt settings for $USERNAME"

+ 6
- 0
src/freedombone-backup-remote Wyświetl plik

204
                 backup_directory_to_friend /home/$USERNAME/.config config/$USERNAME
204
                 backup_directory_to_friend /home/$USERNAME/.config config/$USERNAME
205
             fi
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
             # mutt settings
213
             # mutt settings
208
             if [ -f /home/$USERNAME/.muttrc ]; then
214
             if [ -f /home/$USERNAME/.muttrc ]; then
209
                 echo $"Backing up Mutt settings for $USERNAME"
215
                 echo $"Backing up Mutt settings for $USERNAME"

+ 28
- 0
src/freedombone-restore-local Wyświetl plik

596
     fi
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
 function restore_certs {
626
 function restore_certs {
600
     if [[ $RESTORE_APP != 'all' ]]; then
627
     if [[ $RESTORE_APP != 'all' ]]; then
601
         if [[ $RESTORE_APP != 'certs' ]]; then
628
         if [[ $RESTORE_APP != 'certs' ]]; then
1065
 restore_ipfs
1092
 restore_ipfs
1066
 restore_user_ssh_keys
1093
 restore_user_ssh_keys
1067
 restore_user_config
1094
 restore_user_config
1095
+restore_user_local
1068
 restore_certs
1096
 restore_certs
1069
 restore_personal_settings
1097
 restore_personal_settings
1070
 restore_mailing_list
1098
 restore_mailing_list

+ 27
- 0
src/freedombone-restore-remote Wyświetl plik

476
     done
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
 function restore_certs {
505
 function restore_certs {
480
     if [[ $RESTORE_APP != 'all' ]]; then
506
     if [[ $RESTORE_APP != 'all' ]]; then
481
         if [[ $RESTORE_APP != 'certs' ]]; then
507
         if [[ $RESTORE_APP != 'certs' ]]; then
919
 restore_ipfs
945
 restore_ipfs
920
 restore_ssh_keys
946
 restore_ssh_keys
921
 restore_user_config
947
 restore_user_config
948
+restore_user_local
922
 restore_certs
949
 restore_certs
923
 restore_personal_settings
950
 restore_personal_settings
924
 restore_mailing_list
951
 restore_mailing_list