Parcourir la source

Restart gogs after restore

Bob Mottram il y a 7 ans
Parent
révision
3f5a1bfdd8
1 fichiers modifiés avec 17 ajouts et 9 suppressions
  1. 17
    9
      src/freedombone-app-gogs

+ 17
- 9
src/freedombone-app-gogs Voir le fichier

@@ -261,15 +261,22 @@ function restore_local_gogs {
261 261
         function_check gogs_create_database
262 262
         gogs_create_database
263 263
 
264
+        GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
265
+        GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
266
+
264 267
         function_check restore_database
265 268
         restore_database gogs ${GIT_DOMAIN_NAME}
266 269
         temp_restore_dir=/root/tempgogs
267 270
         if [ -d ${USB_MOUNT}/backup/gogs ]; then
268 271
             echo $"Restoring Gogs settings"
269
-            if [ ! -d /home/${GOGS_USERNAME}/custom/conf ]; then
270
-                mkdir -p /home/${GOGS_USERNAME}/custom/conf
272
+            if [ ! -d $GOGS_CONFIG_PATH ]; then
273
+                mkdir -p $GOGS_CONFIG_PATH
274
+            fi
275
+            if [ -d /root/tempgogs/home/${GOGS_USERNAME}/custom ]; then
276
+                cp -r /root/tempgogs/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom/
277
+            else
278
+                cp -r /root/tempgogs/* /home/${GOGS_USERNAME}/custom/
271 279
             fi
272
-            cp -r ${temp_restore_dir}/conf/* /home/${GOGS_USERNAME}/custom/conf/
273 280
             if [ ! "$?" = "0" ]; then
274 281
                 function_check set_user_permissions
275 282
                 set_user_permissions
@@ -319,11 +326,10 @@ function restore_local_gogs {
319 326
             chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
320 327
         fi
321 328
 
322
-        GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
323
-        GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
324 329
         MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
325 330
         sed -i "s|PASSWD =.*|PASSWD = $MARIADB_PASSWORD|g" ${GOGS_CONFIG_FILE}
326 331
         MARIADB_PASSWORD=
332
+        systemctl restart gogs
327 333
     fi
328 334
 }
329 335
 
@@ -363,11 +369,14 @@ function restore_remote_gogs {
363 369
         function_check gogs_create_database
364 370
         gogs_create_database
365 371
 
372
+        GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
373
+        GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
374
+
366 375
         function_check restore_database_from_friend
367 376
         restore_database_from_friend gogs ${GIT_DOMAIN_NAME}
368 377
         if [ -d ${SERVER_DIRECTORY}/backup/gogs ]; then
369
-            if [ ! -d /home/${GOGS_USERNAME}/custom ]; then
370
-                mkdir -p /home/${GOGS_USERNAME}/custom
378
+            if [ ! -d $GOGS_CONFIG_PATH ]; then
379
+                mkdir -p $GOGS_CONFIG_PATH
371 380
             fi
372 381
             if [ -d /root/tempgogs/home/${GOGS_USERNAME}/custom ]; then
373 382
                 cp -r /root/tempgogs/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom/
@@ -410,11 +419,10 @@ function restore_remote_gogs {
410 419
             echo $"Restore of Gogs complete"
411 420
         fi
412 421
 
413
-        GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
414
-        GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
415 422
         MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
416 423
         sed -i "s|PASSWD =.*|PASSWD = $MARIADB_PASSWORD|g" ${GOGS_CONFIG_FILE}
417 424
         MARIADB_PASSWORD=
425
+        systemctl restart gogs
418 426
     fi
419 427
 }
420 428