Browse Source

Set database password on gogs restore

Bob Mottram 7 years ago
parent
commit
f863c21860
1 changed files with 13 additions and 1 deletions
  1. 13
    1
      src/freedombone-app-gogs

+ 13
- 1
src/freedombone-app-gogs View File

13
 # License
13
 # License
14
 # =======
14
 # =======
15
 #
15
 #
16
-# Copyright (C) 2014-2016 Bob Mottram <bob@freedombone.net>
16
+# Copyright (C) 2014-2017 Bob Mottram <bob@freedombone.net>
17
 #
17
 #
18
 # This program is free software: you can redistribute it and/or modify
18
 # This program is free software: you can redistribute it and/or modify
19
 # it under the terms of the GNU Affero General Public License as published by
19
 # it under the terms of the GNU Affero General Public License as published by
279
             rm -rf ${temp_restore_dir}ssh
279
             rm -rf ${temp_restore_dir}ssh
280
             chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
280
             chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
281
         fi
281
         fi
282
+
283
+        GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
284
+        GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
285
+        MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
286
+        sed -i "s|PASSWD =.*|PASSWD = $MARIADB_PASSWORD|g" ${GOGS_CONFIG_FILE}
287
+        MARIADB_PASSWORD=
282
     fi
288
     fi
283
 }
289
 }
284
 
290
 
349
             chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
355
             chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
350
             echo $"Restore of Gogs complete"
356
             echo $"Restore of Gogs complete"
351
         fi
357
         fi
358
+
359
+        GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
360
+        GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
361
+        MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
362
+        sed -i "s|PASSWD =.*|PASSWD = $MARIADB_PASSWORD|g" ${GOGS_CONFIG_FILE}
363
+        MARIADB_PASSWORD=
352
     fi
364
     fi
353
 }
365
 }
354
 
366