Przeglądaj źródła

Remote restore of configuration files

Bob Mottram 9 lat temu
rodzic
commit
5df28375eb
2 zmienionych plików z 22 dodań i 2 usunięć
  1. 2
    2
      src/freedombone-restore-local
  2. 20
    0
      src/freedombone-restore-remote

+ 2
- 2
src/freedombone-restore-local Wyświetl plik

231
     if [ -d $USB_MOUNT/backup/config ]; then
231
     if [ -d $USB_MOUNT/backup/config ]; then
232
         echo $"Restoring configuration files"
232
         echo $"Restoring configuration files"
233
         restore_directory_from_usb /root/tempconfig config
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
         if [ ! "$?" = "0" ]; then
235
         if [ ! "$?" = "0" ]; then
236
             unmount_drive
236
             unmount_drive
237
             rm -rf /root/tempconfig
237
             rm -rf /root/tempconfig
238
             exit 5294
238
             exit 5294
239
         fi
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
         if [ ! "$?" = "0" ]; then
241
         if [ ! "$?" = "0" ]; then
242
             unmount_drive
242
             unmount_drive
243
             rm -rf /root/tempconfig
243
             rm -rf /root/tempconfig

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

30
 
30
 
31
 PROJECT_NAME='freedombone'
31
 PROJECT_NAME='freedombone'
32
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
32
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
33
+CONFIG_FILE=$HOME/${PROJECT_NAME}.cfg
33
 
34
 
34
 export TEXTDOMAIN=${PROJECT_NAME}-restore-remote
35
 export TEXTDOMAIN=${PROJECT_NAME}-restore-remote
35
 export TEXTDOMAINDIR="/usr/share/locale"
36
 export TEXTDOMAINDIR="/usr/share/locale"
135
     fi
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
 # Restore MariaDB
158
 # Restore MariaDB
139
 if [ -d $SERVER_DIRECTORY/backup/mariadb ]; then
159
 if [ -d $SERVER_DIRECTORY/backup/mariadb ]; then
140
     echo $"Restoring MariaDB settings"
160
     echo $"Restoring MariaDB settings"