добавил распаковку и установку torchsig в скрипте

main
Sergey Revyakin 1 month ago
parent 69d6ae19bd
commit 5624b3065f

@ -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

Loading…
Cancel
Save