Create gogs database before restoring from backup
This commit is contained in:
parent
bcaf4f07fa
commit
2acf8f67ce
|
@ -37,6 +37,32 @@ GIT_DOMAIN_REPO="https://github.com/gogits/gogs"
|
|||
GIT_ADMIN_PASSWORD=
|
||||
GOGS_COMMIT='3fb4f7f4980b4339fd9ef6a3ba5b0acab83d264d'
|
||||
|
||||
function get_mariadb_git_admin_password {
|
||||
if [ -f /home/$MY_USERNAME/README ]; then
|
||||
if grep -q "Gogs admin user password" /home/$MY_USERNAME/README; then
|
||||
GIT_ADMIN_PASSWORD=$(cat /home/$MY_USERNAME/README | grep "Gogs admin user password" | awk -F ':' '{print $2}' | sed 's/^ *//')
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function gogs_create_database {
|
||||
function_check get_mariadb_git_admin_password
|
||||
get_mariadb_git_admin_password
|
||||
if [ ! $GIT_ADMIN_PASSWORD ]; then
|
||||
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
||||
GIT_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
||||
else
|
||||
GIT_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
|
||||
fi
|
||||
fi
|
||||
if [ ! $GIT_ADMIN_PASSWORD ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
function_check create_database
|
||||
create_database gogs "$GOGS_ADMIN_PASSWORD"
|
||||
}
|
||||
|
||||
function reconfigure_gogs {
|
||||
echo -n ''
|
||||
}
|
||||
|
@ -96,6 +122,9 @@ function restore_local_gogs {
|
|||
fi
|
||||
|
||||
if [ ${#GIT_DOMAIN_NAME} -gt 2 ]; then
|
||||
function_check gogs_create_database
|
||||
gogs_create_database
|
||||
|
||||
function_check restore_database
|
||||
restore_database gogs ${GIT_DOMAIN_NAME}
|
||||
temp_restore_dir=/root/tempgogs
|
||||
|
@ -194,6 +223,10 @@ function restore_remote_gogs {
|
|||
|
||||
if grep -q "Gogs domain" $COMPLETION_FILE; then
|
||||
GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}')
|
||||
|
||||
function_check gogs_create_database
|
||||
gogs_create_database
|
||||
|
||||
function_check restore_database_from_friend
|
||||
restore_database_from_friend gogs $GIT_DOMAIN_NAME
|
||||
if [ -d $SERVER_DIRECTORY/backup/gogs ]; then
|
||||
|
@ -346,14 +379,12 @@ function install_gogs {
|
|||
function_check get_mariadb_password
|
||||
get_mariadb_password
|
||||
|
||||
function_check get_mariadb_git_admin_password
|
||||
get_mariadb_git_admin_password
|
||||
if [ ! $GIT_ADMIN_PASSWORD ]; then
|
||||
if [ -f $IMAGE_PASSWORD_FILE ]; then
|
||||
GIT_ADMIN_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
|
||||
else
|
||||
GIT_ADMIN_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
|
||||
fi
|
||||
function_check
|
||||
gogs_create_database
|
||||
|
||||
if [ ! -f $GOPATH/src/github.com/gogits/gogs/scripts/mysql.sql ]; then
|
||||
echo $'MySql template for Gogs was not found'
|
||||
exit 72528
|
||||
fi
|
||||
|
||||
if ! grep -q $"Gogs admin user password" /home/$MY_USERNAME/README; then
|
||||
|
@ -385,12 +416,6 @@ function install_gogs {
|
|||
chmod 600 /home/$MY_USERNAME/README
|
||||
fi
|
||||
|
||||
function_check create_database
|
||||
create_database gogs "$GOGS_ADMIN_PASSWORD"
|
||||
if [ ! -f $GOPATH/src/github.com/gogits/gogs/scripts/mysql.sql ]; then
|
||||
echo $'MySql template for Gogs was not found'
|
||||
exit 72528
|
||||
fi
|
||||
function_check initialise_database
|
||||
initialise_database gogs $GOPATH/src/github.com/gogits/gogs/scripts/mysql.sql
|
||||
|
||||
|
|
|
@ -132,14 +132,6 @@ function get_mariadb_webmail_admin_password {
|
|||
fi
|
||||
}
|
||||
|
||||
function get_mariadb_git_admin_password {
|
||||
if [ -f /home/$MY_USERNAME/README ]; then
|
||||
if grep -q "Gogs admin user password" /home/$MY_USERNAME/README; then
|
||||
GIT_ADMIN_PASSWORD=$(cat /home/$MY_USERNAME/README | grep "Gogs admin user password" | awk -F ':' '{print $2}' | sed 's/^ *//')
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function install_mariadb {
|
||||
if grep -Fxq "install_mariadb" $COMPLETION_FILE; then
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue