diff --git a/ct/watcharr.sh b/ct/watcharr.sh index bfae65aeba..a4d0d8eaf3 100644 --- a/ct/watcharr.sh +++ b/ct/watcharr.sh @@ -27,22 +27,20 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi + RELEASE=$(curl -fsSL https://api.github.com/repos/sbondCo/Watcharr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') - if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + if [[ "${RELEASE}" != "$(cat ~/.watcharr)" ]] || [[ ! -f ~/.watcharr ]]; then msg_info "Updating $APP" msg_info "Stopping $APP" systemctl stop watcharr msg_ok "Stopped $APP" - msg_info "Updating $APP to v${RELEASE}" - temp_file=$(mktemp) - temp_folder=$(mktemp -d) - curl -fsSL "https://github.com/sbondCo/Watcharr/archive/refs/tags/v${RELEASE}.tar.gz" -o ""$temp_file"" - tar -xzf "$temp_file" -C "$temp_folder" rm -f /opt/watcharr/server/watcharr rm -rf /opt/watcharr/server/ui - cp -rf ${temp_folder}/Watcharr-${RELEASE}/* /opt/watcharr + fetch_and_deploy_gh_release "watcharr" "sbondCo/Watcharr" "tarball" + + msg_info "Updating $APP to v${RELEASE}" cd /opt/watcharr export GOOS=linux $STD npm i @@ -57,12 +55,6 @@ function update_script() { systemctl start watcharr msg_ok "Started $APP" - msg_info "Cleaning Up" - rm -f ${temp_file} - rm -rf ${temp_folder} - msg_ok "Cleanup Completed" - - echo "${RELEASE}" >/opt/${APP}_version.txt msg_ok "Update Successful" else msg_ok "No update required. ${APP} is already at v${RELEASE}" diff --git a/install/watcharr-install.sh b/install/watcharr-install.sh index 7e2b4c15d0..521dfb3bb5 100644 --- a/install/watcharr-install.sh +++ b/install/watcharr-install.sh @@ -14,19 +14,14 @@ network_check update_os msg_info "Installing Dependencies" -$STD apt-get install -y \ - gcc +$STD apt-get install -y gcc msg_ok "Installed Dependencies" setup_go NODE_VERSION="22" setup_nodejs +fetch_and_deploy_gh_release "watcharr" "sbondCo/Watcharr" "tarball" msg_info "Setup Watcharr" -temp_file=$(mktemp) -RELEASE=$(curl -fsSL https://api.github.com/repos/sbondCo/Watcharr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') -curl -fsSL "https://github.com/sbondCo/Watcharr/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file" -tar -xzf "$temp_file" -mv Watcharr-${RELEASE}/ /opt/watcharr cd /opt/watcharr $STD npm i $STD npm run build @@ -35,14 +30,6 @@ cd server export CGO_ENABLED=1 GOOS=linux go mod download go build -o ./watcharr -cat </opt/start.sh -#! /bin/bash -source ~/.bashrc -cd /opt/watcharr/server -./watcharr -EOF -chmod +x /opt/start.sh -echo "${RELEASE}" >/opt/${APPLICATION}_version.txt msg_ok "Setup Watcharr" msg_info "Creating Service" @@ -53,7 +40,7 @@ After=network.target [Service] WorkingDirectory=/opt/watcharr/server -ExecStart=/opt/start.sh +ExecStart=/opt/watcharr/server/watcharr Restart=always User=root @@ -67,7 +54,6 @@ motd_ssh customize msg_info "Cleaning up" -rm -f "$temp_file" $STD apt-get -y autoremove $STD apt-get -y autoclean msg_ok "Cleaned"