diff --git a/ct/zoraxy.sh b/ct/zoraxy.sh index d0b633ef7..78db18403 100644 --- a/ct/zoraxy.sh +++ b/ct/zoraxy.sh @@ -27,17 +27,21 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - RELEASE=$(curl -fsSL https://api.github.com/repos/tobychui/zoraxy/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') - if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then - msg_info "Updating $APP to ${RELEASE}" + + RELEASE=$(curl -fsSL https://api.github.com/repos/tobychui/zoraxy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [[ ! -f ~/.zoraxy ]] || [[ "${RELEASE}" != "$(cat ~/.zoraxy)" ]]; then + msg_info "Stopping service" systemctl stop zoraxy - curl -fsSL "https://github.com/tobychui/zoraxy/releases/download/${RELEASE}/zoraxy_linux_amd64" -o $(basename "https://github.com/tobychui/zoraxy/releases/download/${RELEASE}/zoraxy_linux_amd64") + msg_ok "Service stopped" + rm -rf /opt/zoraxy/zoraxy - mv zoraxy_linux_amd64 /opt/zoraxy/zoraxy - chmod +x /opt/zoraxy/zoraxy + fetch_and_deploy_gh_release "zoraxy" "tobychui/zoraxy" "singlefile" "latest" "/opt/zoraxy" "zoraxy_linux_amd64" + + msg_info "Starting service" systemctl start zoraxy - echo "${RELEASE}" >/opt/${APP}_version.txt - msg_ok "Updated $APP" + msg_ok "Service started" + + msg_ok "Updated successfully" else msg_ok "No update required. ${APP} is already at ${RELEASE}" fi diff --git a/frontend/public/json/zoraxy.json b/frontend/public/json/zoraxy.json index 1f2a2a133..6436402e6 100644 --- a/frontend/public/json/zoraxy.json +++ b/frontend/public/json/zoraxy.json @@ -1,35 +1,35 @@ { - "name": "Zoraxy", - "slug": "zoraxy", - "categories": [ - 4 - ], - "date_created": "2024-05-02", - "type": "ct", - "updateable": true, - "privileged": false, - "interface_port": 8000, - "documentation": null, - "website": "https://zoraxy.aroz.org/", - "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/zoraxy.webp", - "config_path": "", - "description": "Zoraxy is an all in one homelab network routing solution.", - "install_methods": [ - { - "type": "default", - "script": "ct/zoraxy.sh", - "resources": { - "cpu": 2, - "ram": 2048, - "hdd": 6, - "os": "debian", - "version": "12" - } - } - ], - "default_credentials": { - "username": null, - "password": null - }, - "notes": [] + "name": "Zoraxy", + "slug": "zoraxy", + "categories": [ + 4 + ], + "date_created": "2024-05-02", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 8000, + "documentation": "https://github.com/tobychui/zoraxy/wiki", + "website": "https://zoraxy.aroz.org/", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/zoraxy.webp", + "config_path": "", + "description": "Zoraxy is an all in one homelab network routing solution.", + "install_methods": [ + { + "type": "default", + "script": "ct/zoraxy.sh", + "resources": { + "cpu": 2, + "ram": 2048, + "hdd": 6, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [] } diff --git a/install/zoraxy-install.sh b/install/zoraxy-install.sh index 2a34e158f..5a43251de 100644 --- a/install/zoraxy-install.sh +++ b/install/zoraxy-install.sh @@ -13,15 +13,8 @@ setting_up_container network_check update_os -msg_info "Installing Zoraxy (Patience)" -RELEASE=$(curl -fsSL https://api.github.com/repos/tobychui/zoraxy/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') -curl -fsSL "https://github.com/tobychui/zoraxy/releases/download/${RELEASE}/zoraxy_linux_amd64" -o zoraxy_linux_amd64 -mkdir -p /opt/zoraxy -mv zoraxy_linux_amd64 /opt/zoraxy/zoraxy -chmod +x /opt/zoraxy/zoraxy +fetch_and_deploy_gh_release "zoraxy" "tobychui/zoraxy" "singlefile" "latest" "/opt/zoraxy" "zoraxy_linux_amd64" ln -s /opt/zoraxy/zoraxy /usr/local/bin/zoraxy -echo "${RELEASE}" >/opt/${APPLICATION}_version.txt -msg_ok "Installed Zoraxy" msg_info "Creating Service" cat </etc/systemd/system/zoraxy.service