From 5b2f3ffce6dd2be2c68c4f8f55566a794071ace1 Mon Sep 17 00:00:00 2001 From: Eduard Veit Date: Fri, 4 Mar 2022 14:40:50 +0100 Subject: [PATCH] fix gitea script --- .gitignore | 1 + uberspace-gitea-installer.sh | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..56fd0e8 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/debug \ No newline at end of file diff --git a/uberspace-gitea-installer.sh b/uberspace-gitea-installer.sh index 8cece80..00ec1bc 100644 --- a/uberspace-gitea-installer.sh +++ b/uberspace-gitea-installer.sh @@ -19,19 +19,24 @@ function install_gitea echo "Please set your $APP_NAME login credentials." read -r -p "$APP_NAME admin user: " ADMIN_USER read -r -p "$APP_NAME admin password: " ADMIN_PASS - wget --quiet --show-progress --output-document "$TMP_LOCATION"/gitea "$DOWNLOAD_URL" + wget --quiet --progress=bar:force --output-document "$TMP_LOCATION"/gitea "$DOWNLOAD_URL" verify_file mkdir --parents ~/gitea/custom/conf/ - mv "$TMP_LOCATION"/gitea "$GITEA_BIN_LOCATION" + mv --verbose "$TMP_LOCATION"/gitea "$GITEA_BIN_LOCATION" chmod u+x --verbose "$GITEA_BIN_LOCATION" - ln --symbolic --verbose "$GITEA_BIN_LOCATION" ~/bin/gitea + #ln --symbolic --verbose "$GITEA_BIN_LOCATION" ~/bin/gitea + ## gitea does not use its real path, maybe use a wrapper for this ln --symbolic --verbose ~/.ssh ~/gitea/.ssh create_app_ini mysql --verbose --execute="CREATE DATABASE ${USER}_gitea" + echo "The database initialisation may take a while ..." + $GITEA_BIN_LOCATION migrate create_gitea_daemon_config supervisorctl reread supervisorctl update supervisorctl status + sleep 5 + supervisorctl status $GITEA_BIN_LOCATION admin user create \ --username "${ADMIN_USER}" \ --password "${ADMIN_PASS}" \ @@ -111,7 +116,7 @@ function get_signature_file SIGNATURE_FILE_URL=$(jq --raw-output '.assets[].browser_download_url' "$TMP_LOCATION"/github_api_response.json | grep "linux-amd64.asc") rm "$TMP_LOCATION"/github_api_response.json - wget --quiet --show-progress --output-document "$TMP_LOCATION"/gitea.asc "$SIGNATURE_FILE_URL" + wget --quiet --progress=bar:force --output-document "$TMP_LOCATION"/gitea.asc "$SIGNATURE_FILE_URL" } function verify_file @@ -167,7 +172,7 @@ function get_signature_file SIGNATURE_FILE_URL=$(jq --raw-output '.assets[].browser_download_url' $TMP_LOCATION/github_api_response.json | grep "linux-amd64.asc") rm $TMP_LOCATION/github_api_response.json - wget --output-document $TMP_LOCATION/gitea.asc "$SIGNATURE_FILE_URL" + wget --quiet --progress=bar:force --output-document $TMP_LOCATION/gitea.asc "$SIGNATURE_FILE_URL" } function verify_file @@ -191,17 +196,16 @@ function verify_file function do_update_procedure { - wget --output-document $TMP_LOCATION/gitea "$DOWNLOAD_URL" + wget --quiet --progress=bar:force --output-document $TMP_LOCATION/gitea "$DOWNLOAD_URL" verify_file - systemctl stop gitea - mv $TMP_LOCATION/gitea "$GITEA_LOCATION" + supervisorctl stop gitea + mv --verbose $TMP_LOCATION/gitea "$GITEA_LOCATION" chmod u+x --verbose "$GITEA_LOCATION" - echo "Start gitea for upgrade" - systemctl start gitea - echo "Waiting for 10 seconds…" - sleep 10 - echo "Restart gitea" - systemctl restart gitea + echo "Start gitea migration" + $GITEA_LOCATION migrate + supervisorctl start gitea + sleep 5 + supervisorctl status gitea } ## this is a helper function to compare two versions as a "lower than" operator