Update huntarr.sh, huntarr-install.sh, huntarr.json

This commit is contained in:
bilulib 2025-05-17 03:37:01 +02:00
parent 20c2724403
commit 9b4e8f4236
3 changed files with 28 additions and 40 deletions

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: BiluliB # Author: BiluliB
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
@ -30,23 +30,11 @@ function update_script() {
fi fi
RELEASE=$(curl -fsSL https://api.github.com/repos/plexguide/Huntarr.io/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}') RELEASE=$(curl -fsSL https://api.github.com/repos/plexguide/Huntarr.io/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')
if [[ "${RELEASE}" != "$(cat /opt/huntarr_version.txt 2>/dev/null)" ]] || [[ ! -f /opt/huntarr_version.txt ]]; then if [[ "${RELEASE}" != "$(cat /opt/"${APP}"_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
msg_info "Stopping $APP" msg_info "Stopping $APP"
systemctl stop huntarr systemctl stop huntarr
msg_ok "Stopped $APP" msg_ok "Stopped $APP"
msg_info "Checking system dependencies"
$STD apt-get update
$STD apt-get install -y \
curl \
tar \
unzip \
jq \
python3 \
python3-pip \
python3-venv
msg_ok "System dependencies updated"
msg_info "Creating Backup" msg_info "Creating Backup"
if ls /opt/${APP}_backup_*.tar.gz &>/dev/null; then if ls /opt/${APP}_backup_*.tar.gz &>/dev/null; then
rm -f /opt/${APP}_backup_*.tar.gz rm -f /opt/${APP}_backup_*.tar.gz
@ -68,15 +56,19 @@ function update_script() {
if [[ "$CURRENT_CHECKSUM" != "$STORED_CHECKSUM" ]]; then if [[ "$CURRENT_CHECKSUM" != "$STORED_CHECKSUM" ]]; then
msg_info "Requirements have changed. Performing full upgrade." msg_info "Requirements have changed. Performing full upgrade."
/opt/huntarr/venv/bin/pip install --upgrade -r requirements.txt uv pip install -r requirements.txt --python /opt/huntarr/venv/bin/python
else else
msg_info "Requirements unchanged. Verifying installation." msg_info "Requirements unchanged. Verifying installation."
/opt/huntarr/venv/bin/pip install -r requirements.txt uv pip install -r requirements.txt --python /opt/huntarr/venv/bin/python
fi fi
else else
/opt/huntarr/venv/bin/pip install --upgrade -r requirements.txt if ! command -v uv &>/dev/null; then
msg_info "Installing UV package manager"
curl -LsSf https://astral.sh/uv/install.sh | sh
msg_ok "UV package manager installed"
fi
uv pip install -r requirements.txt --python /opt/huntarr/venv/bin/python
fi fi
md5sum requirements.txt | awk '{print $1}' >.requirements_checksum md5sum requirements.txt | awk '{print $1}' >.requirements_checksum
msg_ok "Updated Python dependencies" msg_ok "Updated Python dependencies"
msg_ok "Updated $APP to v${RELEASE}" msg_ok "Updated $APP to v${RELEASE}"
@ -92,6 +84,8 @@ function update_script() {
echo "${RELEASE}" >/opt/huntarr_version.txt echo "${RELEASE}" >/opt/huntarr_version.txt
msg_ok "Update Successful" msg_ok "Update Successful"
else
msg_ok "No update required. ${APP} is already at v${RELEASE}"
fi fi
exit exit
} }

View File

@ -2,7 +2,7 @@
"name": "Huntarr", "name": "Huntarr",
"slug": "huntarr", "slug": "huntarr",
"categories": [ "categories": [
0 14
], ],
"date_created": "2025-05-12", "date_created": "2025-05-12",
"type": "ct", "type": "ct",

View File

@ -17,33 +17,27 @@ APPLICATION="huntarr"
REPO_NAME="Huntarr.io" REPO_NAME="Huntarr.io"
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt-get install -y jq
msg_ok "Installed Dependencies"
msg_info "Installing Python"
$STD apt-get install -y \ $STD apt-get install -y \
curl \
tar \
unzip \
jq \
python3 \ python3 \
python3-pip \
python3-venv python3-venv
msg_ok "Installed System Dependencies" $STD bash -c "curl -LsSf https://astral.sh/uv/install.sh | sh"
export PATH="/root/.local/bin:$HOME/.cargo/bin:$PATH"
command -v uv &>/dev/null
msg_ok "Installed Python"
msg_info "Setup ${APPLICATION}" msg_info "Setting Up ${APPLICATION}"
RELEASE=$(curl -fsSL https://api.github.com/repos/plexguide/Huntarr.io/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') RELEASE=$(curl -fsSL https://api.github.com/repos/plexguide/Huntarr.io/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
curl -fsSL -o "${RELEASE}.zip" "https://github.com/plexguide/Huntarr.io/archive/refs/tags/${RELEASE}.zip" $STD curl -fsSL -o "${RELEASE}.zip" "https://github.com/plexguide/Huntarr.io/archive/refs/tags/${RELEASE}.zip"
unzip -q "${RELEASE}.zip" $STD unzip -q "${RELEASE}.zip"
mv "${REPO_NAME}-${RELEASE}/" "/opt/${APPLICATION}" $STD mv "${REPO_NAME}-${RELEASE}/" "/opt/${APPLICATION}"
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
msg_ok "Setup ${APPLICATION}" $STD uv venv /opt/${APPLICATION}/venv
$STD uv pip install --python /opt/${APPLICATION}/venv/bin/python -r /opt/${APPLICATION}/requirements.txt
msg_info "Setting up Python Environment" msg_ok "Setup ${APPLICATION} Complete"
$STD python3 -m venv /opt/${APPLICATION}/venv
msg_ok "Created Python Virtual Environment"
msg_info "Installing Python Dependencies"
$STD /opt/${APPLICATION}/venv/bin/pip install --upgrade pip
$STD /opt/${APPLICATION}/venv/bin/pip install -r /opt/${APPLICATION}/requirements.txt
msg_ok "Installed Python Dependencies"
msg_info "Creating Service" msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/${APPLICATION}.service cat <<EOF >/etc/systemd/system/${APPLICATION}.service