From 5624b3065f11241980acfa94b36cd2e2a48a1362 Mon Sep 17 00:00:00 2001 From: Sergey Revyakin Date: Wed, 1 Apr 2026 17:54:56 +0700 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=80=D0=B0=D1=81=D0=BF=D0=B0=D0=BA=D0=BE=D0=B2=D0=BA=D1=83=20?= =?UTF-8?q?=D0=B8=20=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D1=83?= =?UTF-8?q?=20torchsig=20=D0=B2=20=D1=81=D0=BA=D1=80=D0=B8=D0=BF=D1=82?= =?UTF-8?q?=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install_all.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/install_all.sh b/install_all.sh index eef0613..8406649 100755 --- a/install_all.sh +++ b/install_all.sh @@ -7,6 +7,10 @@ SYSTEMD_TARGET_DIR="/etc/systemd/system" RUN_USER="${SUDO_USER:-${USER}}" RUN_GROUP="$(id -gn "${RUN_USER}")" +SOURCE_ARCHIVES=( + "torchsig.tar.gz:torchsig:pyproject.toml" +) + SDR_UNITS=( dronedetector-sdr-433.service dronedetector-sdr-750.service @@ -59,6 +63,35 @@ require_root() { fi } +extract_local_source_archives() { + local spec archive_rel target_rel sentinel_rel + local archive_path target_path sentinel_path + + for spec in "${SOURCE_ARCHIVES[@]}"; do + IFS=':' read -r archive_rel target_rel sentinel_rel <<< "$spec" + archive_path="${PROJECT_ROOT}/${archive_rel}" + target_path="${PROJECT_ROOT}/${target_rel}" + sentinel_path="${target_path}/${sentinel_rel}" + + if [[ -f "${sentinel_path}" ]]; then + log "Vendored source already available: ${target_rel}" + continue + fi + + if [[ -e "${target_path}" ]]; then + die "Found ${target_path}, but ${sentinel_rel} is missing. Remove or repair this directory, then rerun the installer." + fi + + [[ -f "${archive_path}" ]] || die "Missing vendored source ${target_path} and archive ${archive_path}" + command -v tar >/dev/null 2>&1 || die "tar is required to unpack ${archive_rel}" + + log "Extracting ${archive_rel} -> ${target_rel}" + tar -xzf "${archive_path}" -C "${PROJECT_ROOT}" + [[ -f "${sentinel_path}" ]] || die "Archive ${archive_path} did not unpack expected file ${sentinel_path}" + chown -R "${RUN_USER}:${RUN_GROUP}" "${target_path}" + done +} + preflight() { log "Preflight checks" [[ -f "${PROJECT_ROOT}/.env" ]] || die "Missing ${PROJECT_ROOT}/.env" @@ -233,6 +266,7 @@ main() { log "Project root: ${PROJECT_ROOT}" log "Runtime user: ${RUN_USER}:${RUN_GROUP}" + extract_local_source_archives preflight install_host_non_python_deps setup_sdr_python_env