Skip to content
Snippets Groups Projects
Commit 3f5a1bfd authored by Bob Mottram's avatar Bob Mottram
Browse files

Restart gogs after restore

parent 282d45cd
No related branches found
No related tags found
No related merge requests found
......@@ -261,15 +261,22 @@ function restore_local_gogs {
function_check gogs_create_database
gogs_create_database
GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
function_check restore_database
restore_database gogs ${GIT_DOMAIN_NAME}
temp_restore_dir=/root/tempgogs
if [ -d ${USB_MOUNT}/backup/gogs ]; then
echo $"Restoring Gogs settings"
if [ ! -d /home/${GOGS_USERNAME}/custom/conf ]; then
mkdir -p /home/${GOGS_USERNAME}/custom/conf
if [ ! -d $GOGS_CONFIG_PATH ]; then
mkdir -p $GOGS_CONFIG_PATH
fi
if [ -d /root/tempgogs/home/${GOGS_USERNAME}/custom ]; then
cp -r /root/tempgogs/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom/
else
cp -r /root/tempgogs/* /home/${GOGS_USERNAME}/custom/
fi
cp -r ${temp_restore_dir}/conf/* /home/${GOGS_USERNAME}/custom/conf/
if [ ! "$?" = "0" ]; then
function_check set_user_permissions
set_user_permissions
......@@ -319,11 +326,10 @@ function restore_local_gogs {
chown -R ${GOGS_USERNAME}:${GOGS_USERNAME} /home/${GOGS_USERNAME}
fi
GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
sed -i "s|PASSWD =.*|PASSWD = $MARIADB_PASSWORD|g" ${GOGS_CONFIG_FILE}
MARIADB_PASSWORD=
systemctl restart gogs
fi
}
......@@ -363,11 +369,14 @@ function restore_remote_gogs {
function_check gogs_create_database
gogs_create_database
GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
function_check restore_database_from_friend
restore_database_from_friend gogs ${GIT_DOMAIN_NAME}
if [ -d ${SERVER_DIRECTORY}/backup/gogs ]; then
if [ ! -d /home/${GOGS_USERNAME}/custom ]; then
mkdir -p /home/${GOGS_USERNAME}/custom
if [ ! -d $GOGS_CONFIG_PATH ]; then
mkdir -p $GOGS_CONFIG_PATH
fi
if [ -d /root/tempgogs/home/${GOGS_USERNAME}/custom ]; then
cp -r /root/tempgogs/home/${GOGS_USERNAME}/custom/* /home/${GOGS_USERNAME}/custom/
......@@ -410,11 +419,10 @@ function restore_remote_gogs {
echo $"Restore of Gogs complete"
fi
GOGS_CONFIG_PATH=/home/${GOGS_USERNAME}/custom/conf
GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
MARIADB_PASSWORD=$(${PROJECT_NAME}-pass -u root -a mariadb)
sed -i "s|PASSWD =.*|PASSWD = $MARIADB_PASSWORD|g" ${GOGS_CONFIG_FILE}
MARIADB_PASSWORD=
systemctl restart gogs
fi
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment