瀏覽代碼

Remote restore of configuration files

Bob Mottram 9 年之前
父節點
當前提交
5df28375eb
共有 2 個文件被更改,包括 22 次插入2 次删除
  1. 2
    2
      src/freedombone-restore-local
  2. 20
    0
      src/freedombone-restore-remote

+ 2
- 2
src/freedombone-restore-local 查看文件

@@ -231,13 +231,13 @@ function restore_configuration {
231 231
     if [ -d $USB_MOUNT/backup/config ]; then
232 232
         echo $"Restoring configuration files"
233 233
         restore_directory_from_usb /root/tempconfig config
234
-        cp -f /root/tempconfig/root/${PROJECT_NAME}.cfg /homeroot/${PROJECT_NAME}.cfg
234
+        cp -f /root/tempconfig/root/${PROJECT_NAME}.cfg $CONFIG_FILE
235 235
         if [ ! "$?" = "0" ]; then
236 236
             unmount_drive
237 237
             rm -rf /root/tempconfig
238 238
             exit 5294
239 239
         fi
240
-        cp -f /root/tempconfig/root/${PROJECT_NAME}-completed.txt /root/${PROJECT_NAME}-completed.txt
240
+        cp -f /root/tempconfig/root/${PROJECT_NAME}-completed.txt $COMPLETION_FILE
241 241
         if [ ! "$?" = "0" ]; then
242 242
             unmount_drive
243 243
             rm -rf /root/tempconfig

+ 20
- 0
src/freedombone-restore-remote 查看文件

@@ -30,6 +30,7 @@
30 30
 
31 31
 PROJECT_NAME='freedombone'
32 32
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
33
+CONFIG_FILE=$HOME/${PROJECT_NAME}.cfg
33 34
 
34 35
 export TEXTDOMAIN=${PROJECT_NAME}-restore-remote
35 36
 export TEXTDOMAINDIR="/usr/share/locale"
@@ -135,6 +136,25 @@ function restore_database_from_friend {
135 136
     fi
136 137
 }
137 138
 
139
+# Restore configuration files
140
+if [ -d $SERVER_DIRECTORY/backup/config ]; then
141
+    echo $"Restoring configuration files"
142
+    restore_directory_from_friend /root/tempconfig config
143
+    cp -f /root/tempconfig/root/${PROJECT_NAME}.cfg $CONFIG_FILE
144
+    if [ ! "$?" = "0" ]; then
145
+        unmount_drive
146
+        rm -rf /root/tempconfig
147
+        exit 5372
148
+    fi
149
+    cp -f /root/tempconfig/root/${PROJECT_NAME}-completed.txt $COMPLETION_FILE
150
+    if [ ! "$?" = "0" ]; then
151
+        unmount_drive
152
+        rm -rf /root/tempconfig
153
+        exit 7252
154
+    fi
155
+    rm -rf /root/tempconfig
156
+fi
157
+
138 158
 # Restore MariaDB
139 159
 if [ -d $SERVER_DIRECTORY/backup/mariadb ]; then
140 160
     echo $"Restoring MariaDB settings"