diff --git a/src/freedombone-app-gogs b/src/freedombone-app-gogs index eaa4c470..e1c7114d 100755 --- a/src/freedombone-app-gogs +++ b/src/freedombone-app-gogs @@ -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 { diff --git a/src/freedombone-backup-remote b/src/freedombone-backup-remote index 3d7edead..6ff91952 100755 --- a/src/freedombone-backup-remote +++ b/src/freedombone-backup-remote @@ -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