From f0973ccddd9793114a900d727561c256b298921c Mon Sep 17 00:00:00 2001 From: bilulib Date: Mon, 12 May 2025 23:11:47 +0200 Subject: [PATCH] add dependincies update to the update function --- ct/huntarr.sh | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/ct/huntarr.sh b/ct/huntarr.sh index ef27838..d1a22a3 100644 --- a/ct/huntarr.sh +++ b/ct/huntarr.sh @@ -39,6 +39,19 @@ function update_script() { systemctl stop huntarr msg_ok "Stopped $APP" + # Update system dependencies + 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" + # Creating Backup - maintain only one backup file msg_info "Creating Backup" # Remove any existing backups @@ -57,8 +70,27 @@ function update_script() { cp -rf "/tmp/Huntarr.io-${RELEASE}"/* /opt/huntarr/ # Update Python dependencies + msg_info "Updating Python dependencies" cd /opt/huntarr || exit - /opt/huntarr/venv/bin/pip install -r requirements.txt + # Check if requirements changed with md5sum + if [[ -f "/opt/huntarr/.requirements_checksum" ]]; then + CURRENT_CHECKSUM=$(md5sum requirements.txt | awk '{print $1}') + STORED_CHECKSUM=$(cat .requirements_checksum) + + if [[ "$CURRENT_CHECKSUM" != "$STORED_CHECKSUM" ]]; then + msg_info "Requirements have changed. Performing full upgrade." + /opt/huntarr/venv/bin/pip install --upgrade -r requirements.txt + else + msg_info "Requirements unchanged. Verifying installation." + /opt/huntarr/venv/bin/pip install -r requirements.txt + fi + else + # First time update + /opt/huntarr/venv/bin/pip install --upgrade -r requirements.txt + fi + # Store new checksum + md5sum requirements.txt | awk '{print $1}' >.requirements_checksum + msg_ok "Updated Python dependencies" msg_ok "Updated $APP to v${RELEASE}" # Starting Services