From 158eee45bad8db30934c9a613f9b01ae1271dc74 Mon Sep 17 00:00:00 2001 From: Tobias <96661824+CrazyWolf13@users.noreply.github.com> Date: Fri, 21 Nov 2025 14:02:46 +0100 Subject: [PATCH] Update qbittorrent-exporter.sh --- tools/addon/qbittorrent-exporter.sh | 76 ++++++++++++++--------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/tools/addon/qbittorrent-exporter.sh b/tools/addon/qbittorrent-exporter.sh index c6be09605..98ccf8a7d 100644 --- a/tools/addon/qbittorrent-exporter.sh +++ b/tools/addon/qbittorrent-exporter.sh @@ -29,6 +29,44 @@ else echo -e "${CROSS} Unsupported OS detected. Exiting." exit 1 fi + +# Existing installation +if [[ -f "$INSTALL_PATH" ]]; then + echo -e "${YW}⚠️ qbittorrent-exporter is already installed.${CL}" + echo -n "Uninstall ${APP}? (y/N): " + read -r uninstall_prompt + if [[ "${uninstall_prompt,,}" =~ ^(y|yes)$ ]]; then + msg_info "Uninstalling qbittorrent-exporter" + if [[ "$OS" == "Debian" ]]; then + systemctl disable --now qbittorrent-exporter.service &>/dev/null + rm -f "$SERVICE_PATH" + else + rc-service qbittorrent-exporter stop &>/dev/null + rc-update del qbittorrent-exporter &>/dev/null + rm -f "$SERVICE_PATH" + fi + rm -f "$INSTALL_PATH" "$CONFIG_PATH" ~/.qbittorrent-exporter + msg_ok "${APP} has been uninstalled." + exit 0 + fi + + echo -n "Update qbittorrent-exporter? (y/N): " + read -r update_prompt + if [[ "${update_prompt,,}" =~ ^(y|yes)$ ]]; then + if check_for_gh_release "qbittorrent-exporter" "martabal/qbittorrent-exporter"; then + fetch_and_deploy_gh_release "qbittorrent-exporter" "martabal/qbittorrent-exporter" + setup_go + msg_info "Updating qbittorrent-exporter" + cd /opt/qbittorrent-exporter/src + /usr/local/bin/go build -o ./qbittorrent-exporter + msg_ok "Updated Successfully!" + fi + exit 0 + else + echo -e "${YW}⚠️ Update skipped. Exiting.${CL}" + exit 0 + fi +fi echo -e "${YW}⚠️ qbittorrent-exporter is not installed.${CL}" echo -n "Enter URL of qbittorrent example: (http://192.168.1.10:8080): " @@ -107,42 +145,4 @@ EOF fi msg_ok "Service created successfully" -# Existing installation -if [[ -f "$INSTALL_PATH" ]]; then - echo -e "${YW}⚠️ qbittorrent-exporter is already installed.${CL}" - echo -n "Uninstall ${APP}? (y/N): " - read -r uninstall_prompt - if [[ "${uninstall_prompt,,}" =~ ^(y|yes)$ ]]; then - msg_info "Uninstalling qbittorrent-exporter" - if [[ "$OS" == "Debian" ]]; then - systemctl disable --now qbittorrent-exporter.service &>/dev/null - rm -f "$SERVICE_PATH" - else - rc-service qbittorrent-exporter stop &>/dev/null - rc-update del qbittorrent-exporter &>/dev/null - rm -f "$SERVICE_PATH" - fi - rm -f "$INSTALL_PATH" "$CONFIG_PATH" ~/.qbittorrent-exporter - msg_ok "${APP} has been uninstalled." - exit 0 - fi - - echo -n "Update qbittorrent-exporter? (y/N): " - read -r update_prompt - if [[ "${update_prompt,,}" =~ ^(y|yes)$ ]]; then - if check_for_gh_release "qbittorrent-exporter" "martabal/qbittorrent-exporter"; then - fetch_and_deploy_gh_release "qbittorrent-exporter" "martabal/qbittorrent-exporter" - setup_go - msg_info "Updating qbittorrent-exporter" - cd /opt/qbittorrent-exporter/src - /usr/local/bin/go build -o ./qbittorrent-exporter - msg_ok "Updated Successfully!" - fi - exit 0 - else - echo -e "${YW}⚠️ Update skipped. Exiting.${CL}" - exit 0 - fi -fi - echo -e "${CM} ${GN}${APP} is reachable at: ${BL}http://$CURRENT_IP:8090/metrics${CL}"