|
@@ -34,7 +34,7 @@ IN_DEFAULT_INSTALL=0
|
34
|
34
|
SHOW_ON_ABOUT=1
|
35
|
35
|
|
36
|
36
|
GOGS_USERNAME='gogs'
|
37
|
|
-GOGS_VERSION='0.11.4'
|
|
37
|
+GOGS_VERSION='0.11.29'
|
38
|
38
|
|
39
|
39
|
GIT_DOMAIN_NAME=
|
40
|
40
|
GIT_CODE=
|
|
@@ -158,9 +158,17 @@ function upgrade_gogs {
|
158
|
158
|
return
|
159
|
159
|
fi
|
160
|
160
|
|
161
|
|
- GOGS_CONFIG_FILE=/home/${GOGS_USERNAME}/custom/conf/app.ini
|
|
161
|
+ GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
|
|
162
|
+ GOGS_CONFIG_FILE=$GOGS_CONFIG_PATH/app.ini
|
162
|
163
|
cp $GOGS_CONFIG_FILE $INSTALL_DIR/gogs_config.ini
|
163
|
164
|
|
|
165
|
+ if [ -d $INSTALL_DIR/gogs-repositories ]; then
|
|
166
|
+ rm -rf $INSTALL_DIR/gogs-repositories
|
|
167
|
+ fi
|
|
168
|
+ if [ -d /home/${GOGS_USERNAME}/gogs-repositories ]; then
|
|
169
|
+ mv /home/${GOGS_USERNAME}/gogs-repositories $INSTALL_DIR
|
|
170
|
+ fi
|
|
171
|
+
|
164
|
172
|
gogs_parameters
|
165
|
173
|
echo "gogs binary upgrade: ${GOGS_BIN}"
|
166
|
174
|
|
|
@@ -199,8 +207,23 @@ function upgrade_gogs {
|
199
|
207
|
rm ${GOGS_FILE}
|
200
|
208
|
fi
|
201
|
209
|
|
|
210
|
+ if [ ! -d ${GOGS_CONFIG_PATH} ]; then
|
|
211
|
+ mkdir -p ${GOGS_CONFIG_PATH}
|
|
212
|
+ fi
|
|
213
|
+
|
202
|
214
|
cp $INSTALL_DIR/gogs_config.ini $GOGS_CONFIG_FILE
|
|
215
|
+ if [ ! -f $GOGS_CONFIG_FILE ]; then
|
|
216
|
+ echo $'Gogs ini file not upgraded'
|
|
217
|
+ exit 873535
|
|
218
|
+ fi
|
203
|
219
|
rm $INSTALL_DIR/gogs_config.ini
|
|
220
|
+ if [ -d /home/${GOGS_USERNAME}/gogs-repositories ]; then
|
|
221
|
+ rm -rf /home/${GOGS_USERNAME}/gogs-repositories
|
|
222
|
+ fi
|
|
223
|
+ if [ -d $INSTALL_DIR/gogs-repositories ]; then
|
|
224
|
+ mv $INSTALL_DIR/gogs-repositories /home/${GOGS_USERNAME}/gogs-repositories
|
|
225
|
+ fi
|
|
226
|
+ chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
|
204
|
227
|
|
205
|
228
|
sed -i "s|gogs version.*|gogs version:$GOGS_VERSION|g" ${COMPLETION_FILE}
|
206
|
229
|
systemctl restart mariadb
|
|
@@ -233,26 +256,26 @@ function restore_local_gogs {
|
233
|
256
|
if ! grep -q "gogs domain" ${COMPLETION_FILE}; then
|
234
|
257
|
return
|
235
|
258
|
fi
|
236
|
|
- if [ ! -d /home/${GOGS_USERNAME}/gogs-repositories ]; then
|
237
|
|
- return
|
238
|
|
- fi
|
239
|
259
|
|
240
|
260
|
if [ ${#GIT_DOMAIN_NAME} -gt 2 ]; then
|
241
|
261
|
function_check gogs_create_database
|
242
|
262
|
gogs_create_database
|
243
|
263
|
|
|
264
|
+ GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
|
|
265
|
+ GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
|
|
266
|
+
|
244
|
267
|
function_check restore_database
|
245
|
268
|
restore_database gogs ${GIT_DOMAIN_NAME}
|
246
|
269
|
temp_restore_dir=/root/tempgogs
|
247
|
270
|
if [ -d ${USB_MOUNT}/backup/gogs ]; then
|
248
|
271
|
echo $"Restoring Gogs settings"
|
249
|
|
- if [ ! -d /home/${GOGS_USERNAME}/custom ]; then
|
250
|
|
- mkdir -p /home/${GOGS_USERNAME}/custom
|
|
272
|
+ if [ ! -d $GOGS_CONFIG_PATH ]; then
|
|
273
|
+ mkdir -p $GOGS_CONFIG_PATH
|
251
|
274
|
fi
|
252
|
|
- if [ ! -d ${temp_restore_dir}/home/${GOGS_USERNAME}/custom ]; then
|
253
|
|
- cp -r ${temp_restore_dir}/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom
|
|
275
|
+ if [ -d /root/tempgogs/home/${GOGS_USERNAME}/custom ]; then
|
|
276
|
+ cp -r /root/tempgogs/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom/
|
254
|
277
|
else
|
255
|
|
- cp -r ${temp_restore_dir}/* /home/${GOGS_USERNAME}/custom/
|
|
278
|
+ cp -r /root/tempgogs/* /home/${GOGS_USERNAME}/custom/
|
256
|
279
|
fi
|
257
|
280
|
if [ ! "$?" = "0" ]; then
|
258
|
281
|
function_check set_user_permissions
|
|
@@ -264,10 +287,13 @@ function restore_local_gogs {
|
264
|
287
|
echo $"Restoring Gogs repos"
|
265
|
288
|
function_check restore_directory_from_usb
|
266
|
289
|
restore_directory_from_usb ${temp_restore_dir}repos gogsrepos
|
267
|
|
- if [ ! -d ${temp_restore_dir}repos/home/${GOGS_USERNAME}/gogs-repositories ]; then
|
|
290
|
+ if [ ! -d /home/${GOGS_USERNAME}/gogs-repositories ]; then
|
|
291
|
+ mkdir /home/${GOGS_USERNAME}/gogs-repositories
|
|
292
|
+ fi
|
|
293
|
+ if [ -d ${temp_restore_dir}repos/home/${GOGS_USERNAME}/gogs-repositories ]; then
|
268
|
294
|
cp -r ${temp_restore_dir}repos/home/${GOGS_USERNAME}/gogs-repositories/* /home/${GOGS_USERNAME}/gogs-repositories/
|
269
|
295
|
else
|
270
|
|
- cp -r ${temp_restore_dir}/* /home/${GOGS_USERNAME}/gogs-repositories/
|
|
296
|
+ cp -r ${temp_restore_dir}repos/* /home/${GOGS_USERNAME}/gogs-repositories/
|
271
|
297
|
fi
|
272
|
298
|
if [ ! "$?" = "0" ]; then
|
273
|
299
|
function_check set_user_permissions
|
|
@@ -300,11 +326,10 @@ function restore_local_gogs {
|
300
|
326
|
chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
|
301
|
327
|
fi
|
302
|
328
|
|
303
|
|
- GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
|
304
|
|
- GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
|
305
|
329
|
MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
|
306
|
330
|
sed -i "s|PASSWD =.*|PASSWD = $MARIADB_PASSWORD|g" ${GOGS_CONFIG_FILE}
|
307
|
331
|
MARIADB_PASSWORD=
|
|
332
|
+ systemctl restart gogs
|
308
|
333
|
fi
|
309
|
334
|
}
|
310
|
335
|
|
|
@@ -344,11 +369,14 @@ function restore_remote_gogs {
|
344
|
369
|
function_check gogs_create_database
|
345
|
370
|
gogs_create_database
|
346
|
371
|
|
|
372
|
+ GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
|
|
373
|
+ GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
|
|
374
|
+
|
347
|
375
|
function_check restore_database_from_friend
|
348
|
376
|
restore_database_from_friend gogs ${GIT_DOMAIN_NAME}
|
349
|
377
|
if [ -d ${SERVER_DIRECTORY}/backup/gogs ]; then
|
350
|
|
- if [ ! -d /home/${GOGS_USERNAME}/custom ]; then
|
351
|
|
- mkdir -p /home/${GOGS_USERNAME}/custom
|
|
378
|
+ if [ ! -d $GOGS_CONFIG_PATH ]; then
|
|
379
|
+ mkdir -p $GOGS_CONFIG_PATH
|
352
|
380
|
fi
|
353
|
381
|
if [ -d /root/tempgogs/home/${GOGS_USERNAME}/custom ]; then
|
354
|
382
|
cp -r /root/tempgogs/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom/
|
|
@@ -360,6 +388,9 @@ function restore_remote_gogs {
|
360
|
388
|
fi
|
361
|
389
|
echo $"Restoring Gogs repos"
|
362
|
390
|
restore_directory_from_friend /root/tempgogsrepos gogsrepos
|
|
391
|
+ if [ ! -d /home/${GOGS_USERNAME}/gogs-repositories ]; then
|
|
392
|
+ mkdir /home/${GOGS_USERNAME}/gogs-repositories
|
|
393
|
+ fi
|
363
|
394
|
if [ -d /root/tempgogsrepos/home/${GOGS_USERNAME}/gogs-repositories ]; then
|
364
|
395
|
cp -r /root/tempgogsrepos/home/${GOGS_USERNAME}/gogs-repositories/* /home/${GOGS_USERNAME}/gogs-repositories/
|
365
|
396
|
else
|
|
@@ -388,11 +419,10 @@ function restore_remote_gogs {
|
388
|
419
|
echo $"Restore of Gogs complete"
|
389
|
420
|
fi
|
390
|
421
|
|
391
|
|
- GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
|
392
|
|
- GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
|
393
|
422
|
MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
|
394
|
423
|
sed -i "s|PASSWD =.*|PASSWD = $MARIADB_PASSWORD|g" ${GOGS_CONFIG_FILE}
|
395
|
424
|
MARIADB_PASSWORD=
|
|
425
|
+ systemctl restart gogs
|
396
|
426
|
fi
|
397
|
427
|
}
|
398
|
428
|
|