소스 검색

Move xmpp local restore to app script

Bob Mottram 8 년 전
부모
커밋
9ffb0fe508
3개의 변경된 파일53개의 추가작업 그리고 44개의 파일을 삭제
  1. 28
    0
      src/freedombone-app-ipfs
  2. 25
    0
      src/freedombone-app-xmpp
  3. 0
    44
      src/freedombone-restore-local

+ 28
- 0
src/freedombone-app-ipfs 파일 보기

63
 	fi
63
 	fi
64
 }
64
 }
65
 
65
 
66
+function restore_local_ipfs {
67
+	if ! grep -q "Admin user" $COMPLETION_FILE; then
68
+		return
69
+	fi
70
+	if [ -d $USB_MOUNT/backup/ipfs ]; then
71
+		echo $"Restoring IPFS"
72
+		temp_restore_dir=/root/tempipfs
73
+		function_check restore_directory_from_usb
74
+		restore_directory_from_usb $temp_restore_dir ipfs
75
+		ADMIN_USERNAME=$(cat $COMPLETION_FILE | grep "Admin user" | awk -F ':' '{print $2}')
76
+		cp -rf $temp_restore_dir/home/$ADMIN_USERNAME/.ipfs/* /home/$ADMIN_USERNAME/.ipfs
77
+		if [ ! "$?" = "0" ]; then
78
+			rm -rf $temp_restore_dir
79
+			function_check set_user_permissions
80
+			set_user_permissions
81
+			function_check backup_unmount_drive
82
+			backup_unmount_drive
83
+			exit 27627
84
+		fi
85
+		rm -rf $temp_restore_dir
86
+		echo $"Restore of IPFS complete"
87
+	fi
88
+}
89
+
66
 function backup_remote_ipfs {
90
 function backup_remote_ipfs {
67
 	echo -n ''
91
 	echo -n ''
68
 }
92
 }
69
 
93
 
94
+function restore_remote_ipfs {
95
+	echo -n ''
96
+}
97
+
70
 function remove_ipfs {
98
 function remove_ipfs {
71
 	if ! grep -Fxq "install_ipfs" $COMPLETION_FILE; then
99
 	if ! grep -Fxq "install_ipfs" $COMPLETION_FILE; then
72
 		return
100
 		return

+ 25
- 0
src/freedombone-app-xmpp 파일 보기

116
 	fi
116
 	fi
117
 }
117
 }
118
 
118
 
119
+function restore_local_xmpp {
120
+	if [ -d /var/lib/prosody ]; then
121
+		echo $"Restoring XMPP settings"
122
+		temp_restore_dir=/root/tempxmpp
123
+		function_check restore_directory_from_usb
124
+		restore_directory_from_usb $temp_restore_dir xmpp
125
+		cp -r $temp_restore_dir/var/lib/prosody/* /var/lib/prosody
126
+		if [ ! "$?" = "0" ]; then
127
+			function_check set_user_permissions
128
+			set_user_permissions
129
+			function_check backup_unmount_drive
130
+			backup_unmount_drive
131
+			exit 725
132
+		fi
133
+		rm -rf $temp_restore_dir
134
+		service prosody restart
135
+		chown -R prosody:prosody /var/lib/prosody/*
136
+		echo $"Restore of XMPP settings complete"
137
+	fi
138
+}
139
+
119
 function backup_remote_xmpp {
140
 function backup_remote_xmpp {
120
 	echo -n ''
141
 	echo -n ''
121
 }
142
 }
122
 
143
 
144
+function restore_remote_xmpp {
145
+	echo -n ''
146
+}
147
+
123
 function configure_firewall_for_xmpp {
148
 function configure_firewall_for_xmpp {
124
 	if [ ! -d /etc/prosody ]; then
149
 	if [ ! -d /etc/prosody ]; then
125
 		return
150
 		return

+ 0
- 44
src/freedombone-restore-local 파일 보기

491
     fi
491
     fi
492
 }
492
 }
493
 
493
 
494
-function restore_ipfs {
495
-    if [[ $RESTORE_APP != 'all' ]]; then
496
-        if [[ $RESTORE_APP != 'ipfs' ]]; then
497
-            return
498
-        fi
499
-    fi
500
-    if [ -d $USB_MOUNT/backup/ipfs ]; then
501
-        echo $"Restoring IPFS"
502
-        restore_directory_from_usb /root/tempipfs ipfs
503
-        cp -rf /root/tempipfs/home/$ADMIN_USERNAME/.ipfs/* /home/$ADMIN_USERNAME/.ipfs
504
-        if [ ! "$?" = "0" ]; then
505
-            rm -rf /root/tempipfs
506
-            set_user_permissions
507
-            backup_unmount_drive
508
-            exit 276
509
-        fi
510
-        rm -rf /root/tempipfs
511
-    fi
512
-}
513
-
514
 function restore_user_ssh_keys {
494
 function restore_user_ssh_keys {
515
     if [[ $RESTORE_APP != 'all' ]]; then
495
     if [[ $RESTORE_APP != 'all' ]]; then
516
         if [[ $RESTORE_APP != 'ssh' ]]; then
496
         if [[ $RESTORE_APP != 'ssh' ]]; then
797
     fi
777
     fi
798
 }
778
 }
799
 
779
 
800
-function restore_xmpp {
801
-    if [[ $RESTORE_APP != 'all' ]]; then
802
-        if [[ $RESTORE_APP != 'xmpp' ]]; then
803
-            return
804
-        fi
805
-    fi
806
-    if [ -d /var/lib/prosody ]; then
807
-        echo $"Restoring XMPP settings"
808
-        restore_directory_from_usb /root/tempxmpp xmpp
809
-        cp -r /root/tempxmpp/var/lib/prosody/* /var/lib/prosody
810
-        if [ ! "$?" = "0" ]; then
811
-            set_user_permissions
812
-            backup_unmount_drive
813
-            exit 725
814
-        fi
815
-        rm -rf /root/tempxmpp
816
-        service prosody restart
817
-        chown -R prosody:prosody /var/lib/prosody/*
818
-    fi
819
-}
820
-
821
 function restore_email {
780
 function restore_email {
822
     if [[ $RESTORE_APP != 'all' ]]; then
781
     if [[ $RESTORE_APP != 'all' ]]; then
823
         if [[ $RESTORE_APP != 'email' ]]; then
782
         if [[ $RESTORE_APP != 'email' ]]; then
905
 restore_personal_settings
864
 restore_personal_settings
906
 restore_mailing_list
865
 restore_mailing_list
907
 
866
 
908
-restore_ipfs
909
-restore_xmpp
910
-
911
 restore_email
867
 restore_email
912
 restore_apps
868
 restore_apps
913
 set_user_permissions
869
 set_user_permissions