Move remote gogs backup to app script

This commit is contained in:
Bob Mottram 2016-07-09 21:26:27 +01:00
parent eaa7baba88
commit ee157c9253
2 changed files with 36 additions and 28 deletions

View File

@ -38,7 +38,7 @@ GIT_ADMIN_PASSWORD=
GOGS_COMMIT='3fb4f7f4980b4339fd9ef6a3ba5b0acab83d264d'
function reconfigure_gogs {
echo -n ''
echo -n ''
}
function upgrade_gogs {
@ -146,7 +146,41 @@ function restore_local_gogs {
}
function backup_remote_gogs {
echo -n ''
export GVM_ROOT=/home/git/gvm
if [ -d $GVM_ROOT/bin ]; then
cd $GVM_ROOT/bin
[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
gvm use go${GO_VERSION} --default
systemctl set-environment GOPATH=$GOPATH
fi
if [ -d $GOPATH/src/github.com/gogits ]; then
GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}')
function_check suspend_site
suspend_site ${GIT_DOMAIN_NAME}
function_check backup_database_to_friend
backup_database_to_friend gogs
echo $"Obtaining Gogs settings backup"
function_check backup_directory_to_friend
backup_directory_to_friend $GOPATH/src/github.com/gogits/gogs/custom gogs
echo $"Obtaining Gogs repos backup"
mv /home/git/gogs-repositories/*.git /home/git/gogs-repositories/bob
backup_directory_to_friend /home/git/gogs-repositories gogsrepos
echo $"Obtaining Gogs authorized_keys backup"
backup_directory_to_friend /home/git/.ssh gogsssh
function_check restart_site
restart_site
echo $"Gogs backup complete"
fi
}
function restore_remote_gogs {

View File

@ -244,31 +244,6 @@ function backup_tor {
fi
}
function backup_gogs {
export GVM_ROOT=/home/git/gvm
if [ -d $GVM_ROOT/bin ]; then
cd $GVM_ROOT/bin
[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
gvm use go${GO_VERSION} --default
systemctl set-environment GOPATH=$GOPATH
fi
if [ -d $GOPATH/src/github.com/gogits ]; then
GIT_DOMAIN_NAME=$(cat $COMPLETION_FILE | grep "Gogs domain" | awk -F ':' '{print $2}')
suspend_site ${GIT_DOMAIN_NAME}
backup_database_to_friend gogs
backup_directory_to_friend /root/tempgogsdata gogsdata
echo $"Obtaining Gogs settings backup"
backup_directory_to_friend $GOPATH/src/github.com/gogits/gogs/custom gogs
echo $"Obtaining Gogs repos backup"
mv /home/git/gogs-repositories/*.git /home/git/gogs-repositories/bob
backup_directory_to_friend /home/git/gogs-repositories gogsrepos
echo $"Obtaining Gogs authorized_keys backup"
backup_directory_to_friend /home/git/.ssh gogsssh
restart_site
fi
}
function backup_wiki {
if [ -d /etc/dokuwiki ]; then
echo $"Backing up wiki"
@ -514,7 +489,6 @@ if [[ $TEST_MODE == "no" ]]; then
backup_admin_readme
backup_mariadb
backup_gogs
backup_wiki
backup_blog
backup_certs