|
|
|
@ -7,6 +7,10 @@ SYSTEMD_TARGET_DIR="/etc/systemd/system"
|
|
|
|
RUN_USER="${SUDO_USER:-${USER}}"
|
|
|
|
RUN_USER="${SUDO_USER:-${USER}}"
|
|
|
|
RUN_GROUP="$(id -gn "${RUN_USER}")"
|
|
|
|
RUN_GROUP="$(id -gn "${RUN_USER}")"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SOURCE_ARCHIVES=(
|
|
|
|
|
|
|
|
"torchsig.tar.gz:torchsig:pyproject.toml"
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
SDR_UNITS=(
|
|
|
|
SDR_UNITS=(
|
|
|
|
dronedetector-sdr-433.service
|
|
|
|
dronedetector-sdr-433.service
|
|
|
|
dronedetector-sdr-750.service
|
|
|
|
dronedetector-sdr-750.service
|
|
|
|
@ -59,6 +63,35 @@ require_root() {
|
|
|
|
fi
|
|
|
|
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() {
|
|
|
|
preflight() {
|
|
|
|
log "Preflight checks"
|
|
|
|
log "Preflight checks"
|
|
|
|
[[ -f "${PROJECT_ROOT}/.env" ]] || die "Missing ${PROJECT_ROOT}/.env"
|
|
|
|
[[ -f "${PROJECT_ROOT}/.env" ]] || die "Missing ${PROJECT_ROOT}/.env"
|
|
|
|
@ -233,6 +266,7 @@ main() {
|
|
|
|
log "Project root: ${PROJECT_ROOT}"
|
|
|
|
log "Project root: ${PROJECT_ROOT}"
|
|
|
|
log "Runtime user: ${RUN_USER}:${RUN_GROUP}"
|
|
|
|
log "Runtime user: ${RUN_USER}:${RUN_GROUP}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extract_local_source_archives
|
|
|
|
preflight
|
|
|
|
preflight
|
|
|
|
install_host_non_python_deps
|
|
|
|
install_host_non_python_deps
|
|
|
|
setup_sdr_python_env
|
|
|
|
setup_sdr_python_env
|
|
|
|
|