fix gitea script

This commit is contained in:
EV21 committed 2022-03-04 14:40:50 +01:00
1 parent 447dcd9599
commit 5b2f3ffce6
2 files changed
+19 -14

No files matched your search

+1
View File
@@ -0,0 +1 @@
/debug
+18 -14
View File
@@ -19,19 +19,24 @@ function install_gitea
echo "Please set your $APP_NAME login credentials." echo "Please set your $APP_NAME login credentials."
read -r -p "$APP_NAME admin user: " ADMIN_USER read -r -p "$APP_NAME admin user: " ADMIN_USER
read -r -p "$APP_NAME admin password: " ADMIN_PASS 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 verify_file
mkdir --parents ~/gitea/custom/conf/ 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" 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 ln --symbolic --verbose ~/.ssh ~/gitea/.ssh
create_app_ini create_app_ini
mysql --verbose --execute="CREATE DATABASE ${USER}_gitea" mysql --verbose --execute="CREATE DATABASE ${USER}_gitea"
echo "The database initialisation may take a while ..."
$GITEA_BIN_LOCATION migrate
create_gitea_daemon_config create_gitea_daemon_config
supervisorctl reread supervisorctl reread
supervisorctl update supervisorctl update
supervisorctl status supervisorctl status
sleep 5
supervisorctl status
$GITEA_BIN_LOCATION admin user create \ $GITEA_BIN_LOCATION admin user create \
--username "${ADMIN_USER}" \ --username "${ADMIN_USER}" \
--password "${ADMIN_PASS}" \ --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 | SIGNATURE_FILE_URL=$(jq --raw-output '.assets[].browser_download_url' "$TMP_LOCATION"/github_api_response.json |
grep "linux-amd64.asc") grep "linux-amd64.asc")
rm "$TMP_LOCATION"/github_api_response.json 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 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 | SIGNATURE_FILE_URL=$(jq --raw-output '.assets[].browser_download_url' $TMP_LOCATION/github_api_response.json |
grep "linux-amd64.asc") grep "linux-amd64.asc")
rm $TMP_LOCATION/github_api_response.json 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 function verify_file
@@ -191,17 +196,16 @@ function verify_file
function do_update_procedure 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 verify_file
systemctl stop gitea supervisorctl stop gitea
mv $TMP_LOCATION/gitea "$GITEA_LOCATION" mv --verbose $TMP_LOCATION/gitea "$GITEA_LOCATION"
chmod u+x --verbose "$GITEA_LOCATION" chmod u+x --verbose "$GITEA_LOCATION"
echo "Start gitea for upgrade" echo "Start gitea migration"
systemctl start gitea $GITEA_LOCATION migrate
echo "Waiting for 10 seconds…" supervisorctl start gitea
sleep 10 sleep 5
echo "Restart gitea" supervisorctl status gitea
systemctl restart gitea
} }
## this is a helper function to compare two versions as a "lower than" operator ## this is a helper function to compare two versions as a "lower than" operator