From a3f28b1c4f72c944f5775a6de2524c06247fdf1b Mon Sep 17 00:00:00 2001 From: 12e70ig <12e70ig@gmail.com> Date: Wed, 7 May 2025 00:49:01 +0200 Subject: [PATCH] try api validation --- ct/debian.sh | 42 ++++++++++++++++++++++++++++++++++++++ install/debian-install.sh | 42 ++++++++++++++++++++++++++++++++++++++ install/huntarr-install.sh | 36 +++++++++++++++++++++++++++----- 3 files changed, 115 insertions(+), 5 deletions(-) create mode 100644 ct/debian.sh create mode 100644 install/debian-install.sh diff --git a/ct/debian.sh b/ct/debian.sh new file mode 100644 index 0000000..ebf6224 --- /dev/null +++ b/ct/debian.sh @@ -0,0 +1,42 @@ +#!/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://www.debian.org/ + +APP="Debian" +var_tags="${var_tags:-os}" +var_cpu="${var_cpu:-1}" +var_ram="${var_ram:-512}" +var_disk="${var_disk:-2}" +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 ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + msg_info "Updating $APP LXC" + $STD apt-get update + $STD apt-get -y upgrade + msg_ok "Updated $APP LXC" + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" \ No newline at end of file diff --git a/install/debian-install.sh b/install/debian-install.sh new file mode 100644 index 0000000..4d09d3e --- /dev/null +++ b/install/debian-install.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://git.bila.li/Proxmox/proxmox-ve-install-scripts/raw/branch/dev/misc/build.func) +# Copyright (c) 2021-2025 tteck +# Author: tteck (tteckster) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://www.debian.org/ + +APP="Debian" +var_tags="${var_tags:-os}" +var_cpu="${var_cpu:-1}" +var_ram="${var_ram:-512}" +var_disk="${var_disk:-2}" +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 ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + msg_info "Updating $APP LXC" + $STD apt-get update + $STD apt-get -y upgrade + msg_ok "Updated $APP LXC" + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" \ No newline at end of file diff --git a/install/huntarr-install.sh b/install/huntarr-install.sh index fdefdbf..96ce7ff 100644 --- a/install/huntarr-install.sh +++ b/install/huntarr-install.sh @@ -34,22 +34,48 @@ $STD tar -xzf "$temp_file" -C /opt/huntarr --strip-components=1 # Check if package.json exists if [ ! -f "/opt/huntarr/package.json" ]; then msg_info "Looking for package.json in subdirectories" - # Try to find package.json in subdirectories - PACKAGE_DIR=$(find /opt/huntarr -name package.json -type f -print -quit | xargs dirname) + # Use find with better subdirectory exploration - search deeper + PACKAGE_FILES=$(find /opt/huntarr -name package.json -type f -print -quit) - if [ -n "$PACKAGE_DIR" ]; then + if [ -n "$PACKAGE_FILES" ]; then + # Only use dirname when we actually found the file + PACKAGE_DIR=$(dirname "$PACKAGE_FILES") msg_info "Found package.json in $PACKAGE_DIR" # Create symlinks or copy files to right locations cp -R "$PACKAGE_DIR"/* /opt/huntarr/ cd /opt/huntarr else + # First approach failed, try the backup repository immediately msg_error "Could not find package.json in the extracted files" - # Attempt to use a specific version that's known to work - msg_info "Trying alternate repository or specific version" + msg_info "Trying backup repository directly" + + # Clean up and try alternate repository rm -rf /opt/huntarr $STD mkdir -p /opt/huntarr + + # Try the known working repository $STD curl -fsSL "https://github.com/huntarr/huntarr/archive/refs/heads/master.tar.gz" -o "$temp_file" $STD tar -xzf "$temp_file" -C /opt/huntarr --strip-components=1 + + # Verify if this worked by listing files + ls -la /opt/huntarr + + # If still no package.json, try to look more deeply + if [ ! -f "/opt/huntarr/package.json" ]; then + msg_info "Exploring repository structure" + # Find any package.json files in any subdirectory + DEEP_PACKAGE=$(find /opt/huntarr -name package.json -type f | head -n 1) + + if [ -n "$DEEP_PACKAGE" ]; then + DEEP_DIR=$(dirname "$DEEP_PACKAGE") + msg_info "Found package.json in $DEEP_DIR" + # Copy the directory containing package.json to root + cp -R "$DEEP_DIR"/* /opt/huntarr/ + else + msg_error "Failed to find package.json anywhere in the repository" + exit 1 + fi + fi cd /opt/huntarr fi else