Fix environment detection and update gitea-mirror script

This commit is contained in:
Tobias 2025-11-12 11:39:47 +01:00 committed by GitHub
parent dde85c9a17
commit 5b1c9812ce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
# Copyright (c) 2021-2025 community-scripts ORG # Copyright (c) 2021-2025 community-scripts ORG
# Author: CrazyWolf13 # Author: CrazyWolf13
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
@ -13,7 +13,6 @@ var_disk="${var_disk:-6}"
var_os="${var_os:-debian}" var_os="${var_os:-debian}"
var_version="${var_version:-12}" var_version="${var_version:-12}"
var_unprivileged="${var_unprivileged:-1}" var_unprivileged="${var_unprivileged:-1}"
var_app_version="${var_app_version:-latest}"
header_info "$APP" header_info "$APP"
@ -48,10 +47,10 @@ function update_script() {
fi fi
if [[ ! -f /opt/gitea-mirror.env ]]; then if [[ ! -f /opt/gitea-mirror.env ]]; then
msg_info "Detected old Enviroment, updating files" msg_info "Detected old Enviroment, updating files"
APP_SECRET=$(openssl rand -base64 32) APP_SECRET=$(openssl rand -base64 32)
HOST_IP=$(hostname -I | awk '{print $1}') HOST_IP=$(hostname -I | awk '{print $1}')
cat <<EOF >/opt/gitea-mirror.env cat <<EOF >/opt/gitea-mirror.env
# See here for config options: https://github.com/RayLabsHQ/gitea-mirror/blob/main/docs/ENVIRONMENT_VARIABLES.md # See here for config options: https://github.com/RayLabsHQ/gitea-mirror/blob/main/docs/ENVIRONMENT_VARIABLES.md
NODE_ENV=production NODE_ENV=production
HOST=0.0.0.0 HOST=0.0.0.0
@ -78,7 +77,7 @@ WantedBy=multi-user.target
EOF EOF
systemctl daemon-reload systemctl daemon-reload
msg_ok "Old Enviroment fixed" msg_ok "Old Enviroment fixed"
fi fi
if check_for_gh_release "gitea-mirror" "RayLabsHQ/gitea-mirror"; then if check_for_gh_release "gitea-mirror" "RayLabsHQ/gitea-mirror"; then
msg_info "Stopping Services" msg_info "Stopping Services"
@ -98,7 +97,7 @@ fi
msg_ok "Installed Bun" msg_ok "Installed Bun"
rm -rf /opt/gitea-mirror rm -rf /opt/gitea-mirror
fetch_and_deploy_gh_release "gitea-mirror" "RayLabsHQ/gitea-mirror" "tarball" $var_app_version fetch_and_deploy_gh_release "gitea-mirror" "RayLabsHQ/gitea-mirror"
msg_info "Updating and rebuilding ${APP}" msg_info "Updating and rebuilding ${APP}"
cd /opt/gitea-mirror cd /opt/gitea-mirror
@ -116,7 +115,7 @@ fi
msg_info "Starting Service" msg_info "Starting Service"
systemctl start gitea-mirror systemctl start gitea-mirror
msg_ok "Service Started" msg_ok "Service Started"
msg_ok "Update Successfully" msg_ok "Updated successfully!"
fi fi
exit exit
} }