#!/usr/bin/env bash source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) # Copyright (c) 2021-2025 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Source: https://github.com/huntarr/huntarr APP="Huntarr" var_tags="${var_tags:-arr}" var_cpu="${var_cpu:-2}" var_ram="${var_ram:-2048}" var_disk="${var_disk:-4}" var_os="${var_os:-debian}" var_version="${var_version:-12}" var_unprivileged="${var_unprivileged:-1}" header_info "$APP" variables color catch_errors function update_script() { header_info check_container_storage check_container_resources if [[ ! -d /var/lib/huntarr/ ]]; then msg_error "No ${APP} Installation Found!" exit fi msg_info "Updating $APP LXC" temp_file="$(mktemp)" rm -rf /opt/huntarr # If Huntarr publishes releases with version tags: RELEASE=$(curl -fsSL https://api.github.com/repos/huntarr/huntarr/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') curl -fsSL "https://github.com/huntarr/huntarr/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file" $STD tar -xvzf "$temp_file" $STD mv huntarr-${RELEASE} /opt/huntarr # Build process still needed for source-based installation cd /opt/huntarr $STD npm install $STD npm run build $STD chown -R huntarr:huntarr /opt/huntarr $STD chmod 775 /opt/huntarr $STD systemctl restart huntarr msg_ok "Updated $APP to version ${RELEASE}" msg_info "Cleaning up" rm -rf "$temp_file" msg_ok "Cleaned up" exit } start build_container description msg_info "Installing Dependencies" $STD apt-get update $STD apt-get -y install curl wget gnupg git openjdk-17-jdk nodejs npm msg_ok "Installed Dependencies" msg_info "Creating Huntarr user" $STD useradd -r -d /var/lib/huntarr -s /bin/bash huntarr msg_ok "Created Huntarr user" msg_info "Setting up directories" $STD mkdir -p /opt/huntarr $STD mkdir -p /var/lib/huntarr $STD chown -R huntarr:huntarr /var/lib/huntarr msg_ok "Set up directories" msg_info "Installing $APP" $STD git clone https://github.com/huntarr/huntarr.git /opt/huntarr cd /opt/huntarr $STD git checkout "v${var_huntarr_version}" $STD npm install $STD npm run build $STD chown -R huntarr:huntarr /opt/huntarr msg_ok "Installed $APP" msg_info "Creating Service" cat < /etc/systemd/system/huntarr.service [Unit] Description=Huntarr Service After=network.target [Service] WorkingDirectory=/opt/huntarr ExecStart=/usr/bin/npm start Restart=on-failure User=huntarr Group=huntarr Environment=HOME=/var/lib/huntarr [Install] WantedBy=multi-user.target EOF $STD systemctl daemon-reload $STD systemctl enable huntarr $STD systemctl start huntarr msg_ok "Created Service" # Determine the port Huntarr is using (assuming default 3000) HUNTARR_PORT=3000 msg_ok "Completed Successfully!\n" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}" echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:${HUNTARR_PORT}${CL}"