Przeglądaj źródła

Move local cjdns restore to app script

Bob Mottram 9 lat temu
rodzic
commit
3910ab6ac6
3 zmienionych plików z 52 dodań i 48 usunięć
  1. 25
    2
      src/freedombone-app-cjdns
  2. 26
    1
      src/freedombone-app-dlna
  3. 1
    45
      src/freedombone-restore-local

+ 25
- 2
src/freedombone-app-cjdns Wyświetl plik

@@ -117,11 +117,34 @@ function get_cjdns_password {
117 117
 }
118 118
 
119 119
 function backup_local_cjdns {
120
-	echo ''
120
+	echo -n ''
121
+}
122
+
123
+function restore_local_cjdns {
124
+	if [ -d $USB_MOUNT/backup/cjdns ]; then
125
+		echo $"Restoring cjdns installation"
126
+		temp_restore_dir=/root/tempcjdns
127
+		function_check restore_directory_from_usb
128
+		restore_directory_from_usb $temp_restore_dir cjdns
129
+		rm -rf /etc/cjdns
130
+		cp -r $temp_restore_dir/etc/cjdns /etc/
131
+		if [ ! "$?" = "0" ]; then
132
+			function_check set_user_permissions
133
+			set_user_permissions
134
+			function_check backup_unmount_drive
135
+			backup_unmount_drive
136
+			exit 8472
137
+		fi
138
+		rm -rf $temp_restore_dir
139
+	fi
121 140
 }
122 141
 
123 142
 function backup_remote_cjdns {
124
-	echo ''
143
+	echo -n ''
144
+}
145
+
146
+function restore_remote_cjdns {
147
+	echo -n ''
125 148
 }
126 149
 
127 150
 function remove_cjdns {

+ 26
- 1
src/freedombone-app-dlna Wyświetl plik

@@ -65,8 +65,33 @@ function backup_local_dlna {
65 65
 	fi
66 66
 }
67 67
 
68
+function restore_local_dlna {
69
+	if [ -d /var/cache/minidlna ]; then
70
+		if [ -d $USB_MOUNT/backup/dlna ]; then
71
+			echo $"Restoring DLNA cache"
72
+			temp_restore_dir=/root/tempdlna
73
+			function_check restore_directory_from_usb
74
+			restore_directory_from_usb $temp_restore_dir dlna
75
+			cp -r $temp_restore_dir/var/cache/minidlna/* /var/cache/minidlna/
76
+			if [ ! "$?" = "0" ]; then
77
+				rm -rf $temp_restore_dir
78
+				function_check set_user_permissions
79
+				set_user_permissions
80
+				function_check backup_unmount_drive
81
+				backup_unmount_drive
82
+				exit 982572
83
+			fi
84
+			rm -rf $temp_restore_dir
85
+		fi
86
+	fi
87
+}
88
+
68 89
 function backup_remote_dlna {
69
-	echo ''
90
+	echo -n ''
91
+}
92
+
93
+function restore_remote_dlna {
94
+	echo -n ''
70 95
 }
71 96
 
72 97
 function remove_dlna {

+ 1
- 45
src/freedombone-restore-local Wyświetl plik

@@ -1113,26 +1113,6 @@ function restore_blog {
1113 1113
     fi
1114 1114
 }
1115 1115
 
1116
-function restore_cjdns {
1117
-    if [[ $RESTORE_APP != 'all' ]]; then
1118
-        if [[ $RESTORE_APP != 'cjdns' ]]; then
1119
-            return
1120
-        fi
1121
-    fi
1122
-    if [ -d $USB_MOUNT/backup/cjdns ]; then
1123
-        echo $"Restoring cjdns installation"
1124
-        restore_directory_from_usb /root/tempcjdns cjdns
1125
-        rm -rf /etc/cjdns
1126
-        cp -r /root/tempcjdns/etc/cjdns /etc/
1127
-        if [ ! "$?" = "0" ]; then
1128
-            set_user_permissions
1129
-            backup_unmount_drive
1130
-            exit 8472
1131
-        fi
1132
-        rm -rf /root/tempcjdns
1133
-    fi
1134
-}
1135
-
1136 1116
 function restore_email {
1137 1117
     if [[ $RESTORE_APP != 'all' ]]; then
1138 1118
         if [[ $RESTORE_APP != 'email' ]]; then
@@ -1163,28 +1143,6 @@ function restore_email {
1163 1143
     fi
1164 1144
 }
1165 1145
 
1166
-function restore_dlna {
1167
-    if [[ $RESTORE_APP != 'all' ]]; then
1168
-        if [[ $RESTORE_APP != 'dlna' ]]; then
1169
-            return
1170
-        fi
1171
-    fi
1172
-    if [ -d /var/cache/minidlna ]; then
1173
-        if [ -d $USB_MOUNT/backup/dlna ]; then
1174
-            echo $"Restoring DLNA cache"
1175
-            restore_directory_from_usb /root/tempdlna dlna
1176
-            cp -r /root/tempdlna/var/cache/minidlna/* /var/cache/minidlna/
1177
-            if [ ! "$?" = "0" ]; then
1178
-                rm -rf /root/tempdlna
1179
-                set_user_permissions
1180
-                backup_unmount_drive
1181
-                exit 982
1182
-            fi
1183
-            rm -rf /root/tempdlna
1184
-        fi
1185
-    fi
1186
-}
1187
-
1188 1146
 function get_restore_app {
1189 1147
     if [ ${1} ]; then
1190 1148
         if [ ! -d /home/${1} ]; then
@@ -1252,10 +1210,8 @@ restore_mediagoblin
1252 1210
 restore_gogs
1253 1211
 restore_wiki
1254 1212
 restore_blog
1255
-restore_cjdns
1256
-restore_email
1257
-restore_dlna
1258 1213
 
1214
+restore_email
1259 1215
 restore_apps
1260 1216
 set_user_permissions
1261 1217
 backup_unmount_drive