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:
11
setup.sh
11
setup.sh
@@ -307,12 +307,10 @@ 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"; }
|
|
||||||
trap cleanup EXIT
|
|
||||||
|
|
||||||
info "Cloning FlightAware dump1090..."
|
info "Cloning FlightAware dump1090..."
|
||||||
git clone --depth 1 https://github.com/flightaware/dump1090.git "$tmp_dir/dump1090" >/dev/null 2>&1 \
|
git clone --depth 1 https://github.com/flightaware/dump1090.git "$tmp_dir/dump1090" >/dev/null 2>&1 \
|
||||||
@@ -323,7 +321,7 @@ install_dump1090_from_source_debian() {
|
|||||||
if make BLADERF=no RTLSDR=yes >/dev/null 2>&1; then
|
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 (FlightAware)."
|
||||||
return 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
warn "FlightAware build failed. Falling back to antirez/dump1090..."
|
warn "FlightAware build failed. Falling back to antirez/dump1090..."
|
||||||
@@ -337,6 +335,7 @@ install_dump1090_from_source_debian() {
|
|||||||
|
|
||||||
$SUDO install -m 0755 dump1090 /usr/local/bin/dump1090
|
$SUDO install -m 0755 dump1090 /usr/local/bin/dump1090
|
||||||
ok "dump1090 installed successfully (antirez)."
|
ok "dump1090 installed successfully (antirez)."
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_udev_rules_debian() {
|
setup_udev_rules_debian() {
|
||||||
|
|||||||
Reference in New Issue
Block a user