Bob Mottram 8 лет назад
Родитель
Сommit
58d1b6e16f
1 измененных файлов: 20 добавлений и 14 удалений
  1. 20
    14
      src/freedombone-app-htmly

+ 20
- 14
src/freedombone-app-htmly Просмотреть файл

42
 HTMLY_SUBTITLE="Another ${PROJECT_NAME} Htmly"
42
 HTMLY_SUBTITLE="Another ${PROJECT_NAME} Htmly"
43
 
43
 
44
 htmly_variables=(HTMLY_REPO
44
 htmly_variables=(HTMLY_REPO
45
-                HTMLY_COMMIT
46
-                HTMLY_DOMAIN_NAME
47
-                HTMLY_CODE
48
-                HTMLY_TITLE
49
-                HTMLY_SUBTITLE
50
-                ONION_ONLY
51
-                DDNS_PROVIDER
52
-                MY_USERNAME)
45
+                 HTMLY_COMMIT
46
+                 HTMLY_DOMAIN_NAME
47
+                 HTMLY_CODE
48
+                 HTMLY_TITLE
49
+                 HTMLY_SUBTITLE
50
+                 ONION_ONLY
51
+                 DDNS_PROVIDER
52
+                 MY_USERNAME)
53
 
53
 
54
 function set_avatar_from_url {
54
 function set_avatar_from_url {
55
     AVATAR="$1"
55
     AVATAR="$1"
228
         temp_restore_dir=/root/temphtmly
228
         temp_restore_dir=/root/temphtmly
229
         restore_directory_from_usb $temp_restore_dir blog
229
         restore_directory_from_usb $temp_restore_dir blog
230
         restore_directory_from_usb $temp_restore_dir htmly
230
         restore_directory_from_usb $temp_restore_dir htmly
231
-        rm -rf /var/www/${HTMLY_DOMAIN_NAME}/htdocs
232
-        cp -r $temp_restore_dir/var/www/${HTMLY_DOMAIN_NAME}/htdocs /var/www/${HTMLY_DOMAIN_NAME}/
231
+        if [ -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs ]; then
232
+            rm -rf /var/www/${HTMLY_DOMAIN_NAME}/htdocs
233
+        fi
234
+        temp_source_dir=$(find ${temp_restore_dir} -name htdocs | sed 's/\.//g')
235
+        cp -r ${temp_restore_dir}${temp_source_dir} /var/www/${HTMLY_DOMAIN_NAME}/
233
         if [ ! "$?" = "0" ]; then
236
         if [ ! "$?" = "0" ]; then
234
             set_user_permissions
237
             set_user_permissions
235
             backup_unmount_drive
238
             backup_unmount_drive
236
             exit 593
239
             exit 593
237
         fi
240
         fi
238
-        rm -rf $temp_restore_dir
241
+        rm -rf ${temp_restore_dir}
239
         if [ ! -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content ]; then
242
         if [ ! -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content ]; then
240
             echo $"No content directory found after restoring htmly"
243
             echo $"No content directory found after restoring htmly"
241
             set_user_permissions
244
             set_user_permissions
285
         mkdir $temp_restore_dir
288
         mkdir $temp_restore_dir
286
         function_check restore_directory_from_friend
289
         function_check restore_directory_from_friend
287
         restore_directory_from_friend $temp_restore_dir htmly
290
         restore_directory_from_friend $temp_restore_dir htmly
288
-        rm -rf /var/www/${HTMLY_DOMAIN_NAME}/htdocs
289
-        cp -r $temp_restore_dir/var/www/${HTMLY_DOMAIN_NAME}/htdocs /var/www/${HTMLY_DOMAIN_NAME}/
291
+        if [ -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs ]; then
292
+            rm -rf /var/www/${HTMLY_DOMAIN_NAME}/htdocs
293
+        fi
294
+        temp_source_dir=$(find ${temp_restore_dir} -name htdocs | sed 's/\.//g')
295
+        cp -r ${temp_restore_dir}${temp_source_dir} /var/www/${HTMLY_DOMAIN_NAME}/
290
         if [ ! "$?" = "0" ]; then
296
         if [ ! "$?" = "0" ]; then
291
             exit 593
297
             exit 593
292
         fi
298
         fi
293
-        rm -rf $temp_restore_dir
299
+        rm -rf ${temp_restore_dir}
294
         if [ ! -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content ]; then
300
         if [ ! -d /var/www/${HTMLY_DOMAIN_NAME}/htdocs/content ]; then
295
             echo $"No content directory found after restoring htmly"
301
             echo $"No content directory found after restoring htmly"
296
             exit 287
302
             exit 287