mirror of
https://github.com/smittix/intercept.git
synced 2026-05-28 02:34:45 -07:00
Fix unbound variable error in dump1090 build
Wrap build in subshell to isolate EXIT trap, preventing orig_dir unbound variable error at script exit. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
51
setup.sh
51
setup.sh
@@ -307,36 +307,35 @@ install_dump1090_from_source_debian() {
|
|||||||
librtlsdr-dev libusb-1.0-0-dev \
|
librtlsdr-dev libusb-1.0-0-dev \
|
||||||
libncurses-dev tcl-dev python3-dev
|
libncurses-dev tcl-dev python3-dev
|
||||||
|
|
||||||
local orig_dir tmp_dir
|
# Run in subshell to isolate EXIT trap
|
||||||
orig_dir="$(pwd)"
|
(
|
||||||
tmp_dir="$(mktemp -d)"
|
tmp_dir="$(mktemp -d)"
|
||||||
|
trap 'rm -rf "$tmp_dir"' EXIT
|
||||||
|
|
||||||
cleanup() { cd "$orig_dir" >/dev/null 2>&1 || true; rm -rf "$tmp_dir"; }
|
info "Cloning FlightAware dump1090..."
|
||||||
trap cleanup EXIT
|
git clone --depth 1 https://github.com/flightaware/dump1090.git "$tmp_dir/dump1090" >/dev/null 2>&1 \
|
||||||
|
|| { fail "Failed to clone FlightAware dump1090"; exit 1; }
|
||||||
|
|
||||||
info "Cloning FlightAware dump1090..."
|
cd "$tmp_dir/dump1090"
|
||||||
git clone --depth 1 https://github.com/flightaware/dump1090.git "$tmp_dir/dump1090" >/dev/null 2>&1 \
|
info "Compiling FlightAware dump1090..."
|
||||||
|| { fail "Failed to clone FlightAware dump1090"; exit 1; }
|
if make BLADERF=no RTLSDR=yes >/dev/null 2>&1; then
|
||||||
|
$SUDO install -m 0755 dump1090 /usr/local/bin/dump1090
|
||||||
|
ok "dump1090 installed successfully (FlightAware)."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
warn "FlightAware build failed. Falling back to antirez/dump1090..."
|
||||||
|
rm -rf "$tmp_dir/dump1090"
|
||||||
|
git clone --depth 1 https://github.com/antirez/dump1090.git "$tmp_dir/dump1090" >/dev/null 2>&1 \
|
||||||
|
|| { fail "Failed to clone antirez dump1090"; exit 1; }
|
||||||
|
|
||||||
|
cd "$tmp_dir/dump1090"
|
||||||
|
info "Compiling antirez dump1090..."
|
||||||
|
make >/dev/null 2>&1 || { fail "Failed to build dump1090 from source (required)."; exit 1; }
|
||||||
|
|
||||||
cd "$tmp_dir/dump1090"
|
|
||||||
info "Compiling FlightAware dump1090..."
|
|
||||||
if make BLADERF=no RTLSDR=yes >/dev/null 2>&1; then
|
|
||||||
$SUDO install -m 0755 dump1090 /usr/local/bin/dump1090
|
$SUDO install -m 0755 dump1090 /usr/local/bin/dump1090
|
||||||
ok "dump1090 installed successfully (FlightAware)."
|
ok "dump1090 installed successfully (antirez)."
|
||||||
return 0
|
)
|
||||||
fi
|
|
||||||
|
|
||||||
warn "FlightAware build failed. Falling back to antirez/dump1090..."
|
|
||||||
rm -rf "$tmp_dir/dump1090"
|
|
||||||
git clone --depth 1 https://github.com/antirez/dump1090.git "$tmp_dir/dump1090" >/dev/null 2>&1 \
|
|
||||||
|| { fail "Failed to clone antirez dump1090"; exit 1; }
|
|
||||||
|
|
||||||
cd "$tmp_dir/dump1090"
|
|
||||||
info "Compiling antirez dump1090..."
|
|
||||||
make >/dev/null 2>&1 || { fail "Failed to build dump1090 from source (required)."; exit 1; }
|
|
||||||
|
|
||||||
$SUDO install -m 0755 dump1090 /usr/local/bin/dump1090
|
|
||||||
ok "dump1090 installed successfully (antirez)."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_udev_rules_debian() {
|
setup_udev_rules_debian() {
|
||||||
|
|||||||
Reference in New Issue
Block a user