From 4ba64a03488610489094f710077f1dee88f73c9b Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Wed, 25 Jun 2025 14:15:41 +0200 Subject: [PATCH] Update convertx.sh --- ct/convertx.sh | 55 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/ct/convertx.sh b/ct/convertx.sh index 434c041f..4394102f 100644 --- a/ct/convertx.sh +++ b/ct/convertx.sh @@ -20,25 +20,44 @@ color catch_errors function update_script() { - header_info - check_container_storage - check_container_resources - if [[ ! -d /var ]]; then - msg_error "No ${APP} Installation Found!" - exit - fi - msg_info "Updating $APP LXC" - RELEASE=$(curl -fsSL https://api.github.com/repos/C4illin/ConvertX/releases/latest | jq -r .tag_name | sed 's/^v//') - curl -fsSL -o "/opt/convertx/ConvertX-${RELEASE}.tar.gz" "https://github.com/C4illin/ConvertX/archive/refs/tags/v${RELEASE}.tar.gz" - tar --strip-components=1 -xf "/opt/convertx/ConvertX-${RELEASE}.tar.gz" -C /opt/convertx - cd /opt/convertx - bun update - - $STD systemctl restart convertx - $STD apt-get update - $STD apt-get -y upgrade - msg_ok "Updated $APP LXC" + header_info + check_container_storage + check_container_resources + if [[ ! -d /var ]]; then + msg_error "No ${APP} Installation Found!" exit + fi + RELEASE=$(curl -fsSL https://api.github.com/repos/C4illin/ConvertX/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + if [[ "${RELEASE}" != "$(cat ~/.convertx 2>/dev/null)" ]] || [[ ! -f ~/.convertx ]]; then + msg_info "Stopping $APP" + systemctl stop convertx + msg_ok "Stopped $APP" + + msg_info "Move data-Folder" + if [[ -d /opt/convertx/data ]]; then + mv /opt/convertx/data /opt/data + fi + msg_ok "Moved data-Folder" + + fetch_and_deploy_gh_release "ConvertX" "C4illin/ConvertX" "tarball" "latest" "/opt/convertx" + + msg_info "Updating $APP to v${RELEASE}" + if [[ -d /opt/data ]]; then + mv /opt/data /opt/convertx/data + fi + cd /opt/convertx + $STD bun install + msg_ok "Updated $APP to v${RELEASE}" + + msg_info "Starting $APP" + systemctl start convertx + msg_ok "Started $APP" + + msg_ok "Update Successful" + else + msg_ok "No update required. ${APP} is already at v${RELEASE}" + fi + exit } start