mirror of
https://github.com/smittix/intercept.git
synced 2026-07-08 01:28:13 -07:00
Make rtlamr optional with interactive install prompt
- Add check_optional() function for non-critical tools - Change rtlamr from required to optional tool - Add install_rtlamr_from_source() that auto-installs Go and compiles rtlamr - Prompt user during setup whether to install rtlamr - Fixes setup failure for users who don't need utility meter monitoring
This commit is contained in:
@@ -128,6 +128,17 @@ check_required() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_optional() {
|
||||||
|
local label="$1"; shift
|
||||||
|
local desc="$1"; shift
|
||||||
|
|
||||||
|
if have_any "$@"; then
|
||||||
|
ok "${label} - ${desc}"
|
||||||
|
else
|
||||||
|
warn "${label} - ${desc} (missing, optional)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
check_tools() {
|
check_tools() {
|
||||||
info "Checking required tools..."
|
info "Checking required tools..."
|
||||||
missing_required=()
|
missing_required=()
|
||||||
@@ -139,7 +150,7 @@ check_tools() {
|
|||||||
check_required "rtl_tcp" "RTL-SDR TCP server" rtl_tcp
|
check_required "rtl_tcp" "RTL-SDR TCP server" rtl_tcp
|
||||||
check_required "multimon-ng" "Pager decoder" multimon-ng
|
check_required "multimon-ng" "Pager decoder" multimon-ng
|
||||||
check_required "rtl_433" "433MHz sensor decoder" rtl_433 rtl433
|
check_required "rtl_433" "433MHz sensor decoder" rtl_433 rtl433
|
||||||
check_required "rtlamr" "Utility meter decoder" rtlamr
|
check_optional "rtlamr" "Utility meter decoder (requires Go)" rtlamr
|
||||||
check_required "dump1090" "ADS-B decoder" dump1090
|
check_required "dump1090" "ADS-B decoder" dump1090
|
||||||
check_required "acarsdec" "ACARS decoder" acarsdec
|
check_required "acarsdec" "ACARS decoder" acarsdec
|
||||||
|
|
||||||
@@ -276,6 +287,49 @@ brew_install() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
install_rtlamr_from_source() {
|
||||||
|
info "Installing rtlamr from source (requires Go)..."
|
||||||
|
|
||||||
|
# Check if Go is installed, install if needed
|
||||||
|
if ! cmd_exists go; then
|
||||||
|
if [[ "$OS" == "macos" ]]; then
|
||||||
|
info "Installing Go via Homebrew..."
|
||||||
|
brew_install go || { warn "Failed to install Go. Cannot install rtlamr."; return 1; }
|
||||||
|
else
|
||||||
|
info "Installing Go via apt..."
|
||||||
|
$SUDO apt-get install -y golang >/dev/null 2>&1 || { warn "Failed to install Go. Cannot install rtlamr."; return 1; }
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set up Go environment
|
||||||
|
export GOPATH="${GOPATH:-$HOME/go}"
|
||||||
|
export PATH="$GOPATH/bin:$PATH"
|
||||||
|
mkdir -p "$GOPATH/bin"
|
||||||
|
|
||||||
|
info "Building rtlamr..."
|
||||||
|
if go install github.com/bemasher/rtlamr@latest 2>/dev/null; then
|
||||||
|
# Link to system path
|
||||||
|
if [[ -f "$GOPATH/bin/rtlamr" ]]; then
|
||||||
|
if [[ "$OS" == "macos" ]]; then
|
||||||
|
if [[ -w /usr/local/bin ]]; then
|
||||||
|
ln -sf "$GOPATH/bin/rtlamr" /usr/local/bin/rtlamr
|
||||||
|
else
|
||||||
|
sudo ln -sf "$GOPATH/bin/rtlamr" /usr/local/bin/rtlamr
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
$SUDO ln -sf "$GOPATH/bin/rtlamr" /usr/local/bin/rtlamr
|
||||||
|
fi
|
||||||
|
ok "rtlamr installed successfully"
|
||||||
|
else
|
||||||
|
warn "rtlamr binary not found after build"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Failed to build rtlamr"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
install_multimon_ng_from_source_macos() {
|
install_multimon_ng_from_source_macos() {
|
||||||
info "multimon-ng not available via Homebrew. Building from source..."
|
info "multimon-ng not available via Homebrew. Building from source..."
|
||||||
|
|
||||||
@@ -334,19 +388,16 @@ install_macos_packages() {
|
|||||||
progress "Installing rtl_433"
|
progress "Installing rtl_433"
|
||||||
brew_install rtl_433
|
brew_install rtl_433
|
||||||
|
|
||||||
progress "Installing rtlamr"
|
progress "Installing rtlamr (optional)"
|
||||||
# rtlamr needs to be installed via go or binary
|
# rtlamr is optional - used for utility meter monitoring
|
||||||
if ! cmd_exists rtlamr; then
|
if ! cmd_exists rtlamr; then
|
||||||
if [[ -f "/home/rose/Compiled/rtlamr/rtlamr" ]]; then
|
echo
|
||||||
info "Found rtlamr binary, linking to /usr/local/bin..."
|
info "rtlamr is used for utility meter monitoring (electric/gas/water meters)."
|
||||||
if [[ -w /usr/local/bin ]]; then
|
read -r -p "Do you want to install rtlamr? [y/N] " install_rtlamr
|
||||||
ln -sf /home/rose/Compiled/rtlamr/rtlamr /usr/local/bin/rtlamr
|
if [[ "$install_rtlamr" =~ ^[Yy]$ ]]; then
|
||||||
else
|
install_rtlamr_from_source
|
||||||
sudo ln -sf /home/rose/Compiled/rtlamr/rtlamr /usr/local/bin/rtlamr
|
|
||||||
fi
|
|
||||||
ok "rtlamr linked successfully"
|
|
||||||
else
|
else
|
||||||
warn "rtlamr not found. Download from https://github.com/bemasher/rtlamr"
|
warn "Skipping rtlamr installation. You can install it later if needed."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
ok "rtlamr already installed"
|
ok "rtlamr already installed"
|
||||||
@@ -622,15 +673,16 @@ install_debian_packages() {
|
|||||||
progress "Installing rtl_433"
|
progress "Installing rtl_433"
|
||||||
apt_try_install_any rtl-433 rtl433 || warn "rtl-433 not available"
|
apt_try_install_any rtl-433 rtl433 || warn "rtl-433 not available"
|
||||||
|
|
||||||
progress "Installing rtlamr"
|
progress "Installing rtlamr (optional)"
|
||||||
# rtlamr needs to be installed via go or binary
|
# rtlamr is optional - used for utility meter monitoring
|
||||||
if ! cmd_exists rtlamr; then
|
if ! cmd_exists rtlamr; then
|
||||||
if [[ -f "/home/rose/Compiled/rtlamr/rtlamr" ]]; then
|
echo
|
||||||
info "Found rtlamr binary, installing to /usr/local/bin..."
|
info "rtlamr is used for utility meter monitoring (electric/gas/water meters)."
|
||||||
$SUDO install -m 0755 /home/rose/Compiled/rtlamr/rtlamr /usr/local/bin/rtlamr
|
read -r -p "Do you want to install rtlamr? [y/N] " install_rtlamr
|
||||||
ok "rtlamr installed successfully"
|
if [[ "$install_rtlamr" =~ ^[Yy]$ ]]; then
|
||||||
|
install_rtlamr_from_source
|
||||||
else
|
else
|
||||||
warn "rtlamr not found. Download from https://github.com/bemasher/rtlamr"
|
warn "Skipping rtlamr installation. You can install it later if needed."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
ok "rtlamr already installed"
|
ok "rtlamr already installed"
|
||||||
|
|||||||
Reference in New Issue
Block a user