Device assignment debugging.

pull/607/head
jprochazka 2024-08-22 15:26:13 -04:00
rodzic 01fc770f6e
commit 9969bc6dc4
8 zmienionych plików z 104 dodań i 69 usunięć

1
.gitignore vendored
Wyświetl plik

@ -17,4 +17,5 @@ build/planefinder
build/package-archive
build/portal/graphs/__pycache__
build/readsb
build/vdlm2dec
logs

Wyświetl plik

@ -26,7 +26,7 @@ fi
## GATHER REQUIRED INFORMATION FROM THE USER
ask_for_device_assignments "acarsdec"
ask_for_device_assignments "dump1090-fa"
if [[ $? -ne 0 ]] ; then
log_alert_heading "INSTALLATION HALTED"
log_alert_message "Setup has been halted due to lack of required information"

Wyświetl plik

@ -26,7 +26,7 @@ fi
## GATHER REQUIRED INFORMATION FROM THE USER
ask_for_device_assignments "acarsdec"
ask_for_device_assignments "dump978-fa"
if [[ $? -ne 0 ]] ; then
log_alert_heading "INSTALLATION HALTED"
log_alert_message "Setup has been halted due to lack of required information"
@ -48,6 +48,7 @@ check_package libboost-program-options-dev
check_package libboost-regex-dev
check_package libboost-system-dev
check_package libsoapysdr-dev
check_package lighttpd
check_package soapysdr-module-rtlsdr

Wyświetl plik

@ -26,7 +26,7 @@ fi
## GATHER REQUIRED INFORMATION FROM THE USER
ask_for_device_assignments "acarsdec"
ask_for_device_assignments "dumpvdl2"
if [[ $? -ne 0 ]] ; then
log_alert_heading "INSTALLATION HALTED"
log_alert_message "Setup has been halted due to lack of required information"

36
bash/decoders/vdlm2dec.sh 100644 → 100755
Wyświetl plik

@ -48,6 +48,38 @@ if [[ $exit_status != 0 ]]; then
exit 1
fi
ask_for_device_assignments "vdlm2dec"
if [[ $? -ne 0 ]] ; then
log_alert_heading "INSTALLATION HALTED"
log_alert_message "Setup has been halted due to lack of required information"
echo ""
log_title_message "------------------------------------------------------------------------------"
log_title_heading "ACARSDEC decoder setup halted"
exit 1
fi
## CHECK FOR PREREQUISITE PACKAGES
check_package cmake
check_package libjansson-dev
check_package libsqlite3-dev
check_package libxml2-dev
check_package zlib1g-dev
case $RECEIVER_OS_DISTRIBUTION in
ubuntu)
distro_php_version=""
;;
debian)
if [[ "${RECEIVER_OS_CODE_NAME}" == "bookworm" ]]; then distro_php_version="8.2"; fi
if [[ "${RECEIVER_OS_CODE_NAME}" == "bullseye" ]]; then distro_php_version="7.4"; fi
;;
esac
check_package sqlite3
check_package php${distro_php_version}-sqlite3
## BLACKLIST UNWANTED RTL-SDR MODULES
@ -237,7 +269,7 @@ StartLimitBurst=10
WantedBy=multi-user.target
EOF
log_message "Enabling then starting the ACARSDEC service"
log_message "Enabling then starting the VDLM2DEC service"
sudo systemctl enable --now vdlm2dec.service
log_message "Enabling then starting the acarsserv service"
sudo systemctl enable --now acarsserv.service
@ -267,4 +299,4 @@ log_title_heading "VDLM2DEC decoder setup is complete"
echo ""
read -p "Press enter to continue..." discard
exit 0
exit 0

0
bash/extras/graphs1090.sh 100644 → 100755
Wyświetl plik

0
bash/extras/tar1090.sh 100644 → 100755
Wyświetl plik

Wyświetl plik

@ -182,9 +182,9 @@ function ask_for_device_assignments() {
if [[ -f /usr/local/bin/acarsdec ]]; then
log_message "The ACARSDEC decoder appears to be installed"
acars_decoder_installed="true"
acars_decoder="acarsdec"
RECEIVER_ACARS_DECODER_SOFTWARE="acarsdec"
fi
if [[ "${acars_decoder_installed}" == "true" && "${acars_decoder}" != "${decoder_being_installed}" ]]; then
if [[ "${acars_decoder_installed}" == "true" && "${RECEIVER_ACARS_DECODER_SOFTWARE}" != "${decoder_being_installed}" ]]; then
decoder_count=$((decoder_count+1))
fi
@ -193,14 +193,14 @@ function ask_for_device_assignments() {
if [[ $(dpkg-query -W -f='${STATUS}' dump1090-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]]; then
log_message "The FlightAware dump1090 decoder appears to be installed"
adsb_decoder_installed="true"
adsb_decoder="dump1090-fa"
RECEIVER_ADSB_DECODER_SOFTWARE="dump1090-fa"
fi
if [[ $(dpkg-query -W -f='${STATUS}' readsb 2>/dev/null | grep -c "ok installed") -eq 1 ]]; then
log_message "The Readsb decoder appears to be installed"
adsb_decoder_installed="true"
adsb_decoder="readsb"
RECEIVER_ADSB_DECODER_SOFTWARE="readsb"
fi
if [[ "${adsb_decoder_installed}" == "true" && "${adsb_decoder}" != "${decoder_being_installed}" ]]; then
if [[ "${adsb_decoder_installed}" == "true" && "${RECEIVER_ADSB_DECODER_SOFTWARE}" != "${decoder_being_installed}" ]]; then
decoder_count=$((decoder_count+1))
fi
@ -209,9 +209,9 @@ function ask_for_device_assignments() {
if [[ $(dpkg-query -W -f='${STATUS}' dump978-fa 2>/dev/null | grep -c "ok installed") -eq 1 ]]; then
log_message "The FlightAware dump978 decoder appears to be installed"
uat_decoder_installed="true"
uat_decoder="dump978-fa"
RECEIVER_UAT_DECODER_SOFTWARE="dump978-fa"
fi
if [[ "${uat_decoder_installed}" == "true" && "${uat_decoder}" != "${decoder_being_installed}" ]]; then
if [[ "${uat_decoder_installed}" == "true" && "${RECEIVER_UAT_DECODER_SOFTWARE}" != "${decoder_being_installed}" ]]; then
decoder_count=$((decoder_count+1))
fi
@ -220,14 +220,14 @@ function ask_for_device_assignments() {
if [[ -f /usr/local/bin/dumpvdl2 ]]; then
log_message "The dumpvdl2 decoder appears to be installed"
vdlm2_decoder_installed="true"
vdlm2_decoder="dumpvdl2"
RECEIVER_VDLM2_DECODER_SOFTWARE="dumpvdl2"
fi
if [[ -f /usr/local/bin/vdlm2dec ]]; then
log_message "The VDLM2DEC decoder appears to be installed"
vdlm2_decoder_installed="true"
vdlm2_decoder="vdlm2dec"
RECEIVER_VDLM2_DECODER_SOFTWARE="vdlm2dec"
fi
if [[ "${vdlm2_decoder_installed}" == "true" && "${vdlm2_decoder}" != "${decoder_being_installed}" ]]; then
if [[ "${vdlm2_decoder_installed}" == "true" && "${RECEIVER_VDLM2_DECODER_SOFTWARE}" != "${decoder_being_installed}" ]]; then
decoder_count=$((decoder_count+1))
fi
@ -238,18 +238,18 @@ function ask_for_device_assignments() {
--msgbox "It appears that existing decoder(s) have been installed on this device. In order to run this decoder in tandem with other decoders you will need to specifiy which RTL-SDR dongle each decoder is to use.\n\nKeep in mind in order to run multiple decoders on a single device you will need to have multiple RTL-SDR devices connected to your device." \
12 78
if [[ "${acars_decoder_installed}" == "true" && "${acars_decoder}" == "acarsdec" ]]; then
if [[ "${acars_decoder_installed}" == "true" && "${RECEIVER_ACARS_DECODER_SOFTWARE}" == "acarsdec" ]]; then
log_message "Determining which device is currently assigned to ACARSDEC"
exec_start=`get_config "ExecStart" "/etc/systemd/system/acarsdec.service"`
RECEIVER_DEVICE_ASSIGNED_TO_ACARS_DECODER=`echo $exec_start | grep -o -P '(?<=-r ).*(?= -A)'`
device_assigned_to_acars_decoder=`echo $exec_start | grep -o -P '(?<=-r ).*(?= -A)'`
log_message "Asking the user to assign a RTL-SDR device number to ACARSDEC"
acars_device_number_title="Enter the ACARSDEC RTL-SDR Device Number"
while [[ -z $acars_device_number ]]; do
acars_device_number=$(whiptail --backtitle "Decoder Configuration" \
--title "${acars_device_number_title}" \
--inputbox "\nEnter the RTL-SDR device number to assign to ACARSDEC." \
8 78 \
"${RECEIVER_DEVICE_ASSIGNED_TO_ACARS_DECODER}" 3>&1 1>&2 2>&3)
while [[ -z $RECEIVER_DEVICE_ASSIGNED_TO_ACARS_DECODER ]]; do
RECEIVER_DEVICE_ASSIGNED_TO_ACARS_DECODER=$(whiptail --backtitle "Decoder Configuration" \
--title "${acars_device_number_title}" \
--inputbox "\nEnter the RTL-SDR device number to assign to ACARSDEC." \
8 78 \
"${device_assigned_to_acars_decoder}" 3>&1 1>&2 2>&3)
exit_status=$?
if [[ $exit_status != 0 ]]; then
exit 1
@ -258,17 +258,17 @@ function ask_for_device_assignments() {
done
fi
if [[ "${adsb_decoder_installed}" == "true" && "${adsb_decoder}" == "dump1090-fa" ]]; then
if [[ "${adsb_decoder_installed}" == "true" && "${RECEIVER_ADSB_DECODER_SOFTWARE}" == "dump1090-fa" ]]; then
log_message "Determining which device is currently assigned to dump1090-fa"
RECEIVER_DEVICE_ASSIGNED_TO_ADSB_DECODER=`get_config "RECEIVER_SERIAL" "/etc/default/dump1090-fa"`
device_assigned_to_adsb_decoder=`get_config "RECEIVER_SERIAL" "/etc/default/dump1090-fa"`
log_message "Asking the user to assign a RTL-SDR device number to dump1090-fa"
adsb_device_number_title="Enter the dump1090-fa RTL-SDR Device Number"
while [[ -z $adsb_device_number ]]; do
adsb_device_number=$(whiptail --backtitle "Decoder Configuration" \
--title "${adsb_device_number_title}" \
--inputbox "\nEnter the RTL-SDR device number to assign to dump1090-fa." \
8 78 \
"${RECEIVER_DEVICE_ASSIGNED_TO_ADSB_DECODER}" 3>&1 1>&2 2>&3)
while [[ -z $RECEIVER_DEVICE_ASSIGNED_TO_ADSB_DECODER ]]; do
RECEIVER_DEVICE_ASSIGNED_TO_ADSB_DECODER=$(whiptail --backtitle "Decoder Configuration" \
--title "${adsb_device_number_title}" \
--inputbox "\nEnter the RTL-SDR device number to assign to dump1090-fa." \
8 78 \
"${device_assigned_to_adsb_decoder}" 3>&1 1>&2 2>&3)
exit_status=$?
if [[ $exit_status != 0 ]]; then
exit 1
@ -277,18 +277,18 @@ function ask_for_device_assignments() {
done
fi
if [[ "${uat_decoder_installed}" == "true" && "${dump978-fa}" == "dump978-fa" ]]; then
if [[ "${uat_decoder_installed}" == "true" && "${RECEIVER_UAT_DECODER_SOFTWARE}" == "dump978-fa" ]]; then
log_message "Determining which device is currently assigned to dump978-fa"
receiver_options=`get_config "RECEIVER_OPTIONS" "/etc/default/dump978-fa"`
RECEIVER_DEVICE_ASSIGNED_TO_UAT_DECODER=$receiver_options | grep -o -P '(?<=serial=).*(?= --)'
device_assigned_to_uat_decoder=`echo $receiver_options | grep -o -P '(?<=serial=).*(?= --)'`
log_message "Asking the user to assign a RTL-SDR device number to dump978-fa"
uat_device_number_title="Enter the dump978-fa RTL-SDR Device Number"
while [[ -z $uat_device_number ]] ; do
uat_device_number=$(whiptail --backtitle "Decoder Configuration" \
--title "${uat_device_number_title}" \
--inputbox "\nEnter the RTL-SDR device number to assign to dump978-fa." \
8 78 \
"${RECEIVER_DEVICE_ASSIGNED_TO_UAT_DECODER}" 3>&1 1>&2 2>&3)
while [[ -z $RECEIVER_DEVICE_ASSIGNED_TO_UAT_DECODER ]] ; do
RECEIVER_DEVICE_ASSIGNED_TO_UAT_DECODER=$(whiptail --backtitle "Decoder Configuration" \
--title "${uat_device_number_title}" \
--inputbox "\nEnter the RTL-SDR device number to assign to dump978-fa." \
8 78 \
"${device_assigned_to_uat_decoder}" 3>&1 1>&2 2>&3)
exit_status=$?
if [[ $exit_status != 0 ]]; then
exit 1
@ -297,18 +297,18 @@ function ask_for_device_assignments() {
done
fi
if [[ "${vdlm2_decoder_installed}" == "true" && "${vdlm2_decoder}" == "dumpvdl2" ]]; then
if [[ "${vdlm2_decoder_installed}" == "true" && "${RECEIVER_VDLM2_DECODER_SOFTWARE}" == "dumpvdl2" ]]; then
log_message "Determining which device is currently assigned to dumpvdl2"
exec_start=`get_config "ExecStart" "/etc/systemd/system/dumpvdl2.service"`
RECEIVER_DEVICE_ASSIGNED_TO_VDLM2_DECODER=`echo $exec_start | grep -o -P '(?<=--rtlsdr ).*(?= --gain)'`
device_assigned_to_vdlm2_decoder=`echo $exec_start | grep -o -P '(?<=--rtlsdr ).*(?= --gain)'`
log_message "Asking the user to assign a RTL-SDR device number to dumpvdl2"
vdlm2_device_number_title="Enter the dumpvdl2 RTL-SDR Device Number"
while [[ -z $vdlm2_device_number ]]; do
vdlm2_device_number=$(whiptail --backtitle "Decoder Configuration" \
--title "${vdlm2_device_number_title}" \
--inputbox "Enter the RTL-SDR device number to assign to dumpvdl2." \
8 78 \
"${RECEIVER_DEVICE_ASSIGNED_TO_VDLM2_DECODER}" 3>&1 1>&2 2>&3)
while [[ -z $RECEIVER_DEVICE_ASSIGNED_TO_VDLM2_DECODER ]]; do
RECEIVER_DEVICE_ASSIGNED_TO_VDLM2_DECODER=$(whiptail --backtitle "Decoder Configuration" \
--title "${vdlm2_device_number_title}" \
--inputbox "Enter the RTL-SDR device number to assign to dumpvdl2." \
8 78 \
"${device_assigned_to_vdlm2_decoder}" 3>&1 1>&2 2>&3)
exit_status=$?
if [[ $exit_status != 0 ]]; then
exit 1
@ -317,17 +317,18 @@ function ask_for_device_assignments() {
done
fi
if [[ "${adsb_decoder_installed}" == "true" && "${adsb_decoder}" == "readsb" ]]; then
if [[ "${adsb_decoder_installed}" == "true" && "${RECEIVER_ADSB_DECODER_SOFTWARE}" == "readsb" ]]; then
log_message "Determining which device is currently assigned to Readsb"
RECEIVER_DEVICE_ASSIGNED_TO_ADSB_DECODER=`get_config "RECEIVER_SERIAL" "/etc/default/readsb"`
receiver_options=`get_config "RECEIVER_OPTIONS" "/etc/default/readsb"`
device_assigned_to_adsb_decoder=`echo $receiver_options | grep -o -P '(?<=--device ).*(?= )'`
log_message "Asking the user to assign a RTL-SDR device number to Readsb"
adsb_device_number_title="Enter the Readsb RTL-SDR Device Number"
while [[ -z $adsb_device_number ]]; do
adsb_device_number=$(whiptail --backtitle "Decoder Configuration" \
--title "${adsb_device_number_title}" \
--inputbox "\nEnter the RTL-SDR device number to assign to Readsb." \
8 78 \
"${RECEIVER_DEVICE_ASSIGNED_TO_ADSB_DECODER}" 3>&1 1>&2 2>&3)
while [[ -z $RECEIVER_DEVICE_ASSIGNED_TO_ADSB_DECODER ]]; do
RECEIVER_DEVICE_ASSIGNED_TO_ADSB_DECODER=$(whiptail --backtitle "Decoder Configuration" \
--title "${adsb_device_number_title}" \
--inputbox "\nEnter the RTL-SDR device number to assign to Readsb." \
8 78 \
"${device_assigned_to_adsb_decoder}" 3>&1 1>&2 2>&3)
exit_status=$?
if [[ $exit_status != 0 ]]; then
exit 1
@ -336,18 +337,18 @@ function ask_for_device_assignments() {
done
fi
if [[ "${vdlm2_decoder_installed}" == "true" && "${vdlm2_decoder}" == "vdlm2dec" ]]; then
if [[ "${vdlm2_decoder_installed}" == "true" && "${RECEIVER_VDLM2_DECODER_SOFTWARE}" == "vdlm2dec" ]]; then
log_message "Determining which device is currently assigned to VDLM2DEC"
exec_start=`get_config "ExecStart" "/etc/systemd/system/vdlm2dec.service"`
RECEIVER_DEVICE_ASSIGNED_TO_VDLM2_DECODER=`echo $exec_start | grep -o -P '(?<=-r ).*(?= -A)'`
device_assigned_to_vdlm2_decoder=`echo $exec_start | grep -o -P '(?<=-r ).*(?= )'`
log_message "Asking the user to assign a RTL-SDR device number to VDLM2DEC"
vdlm2_device_number_title="Enter the VDLM2DEC RTL-SDR Device Number"
while [[ -z $vdlm2_device_number ]]; do
vdlm2_device_number=$(whiptail --backtitle "Decoder Configuration" \
--title "${vdlm2_device_number_title}" \
--inputbox "\nEnter the RTL-SDR device number to assign to VDLM2DEC." \
8 78 \
"${RECEIVER_DEVICE_ASSIGNED_TO_VDLM2_DECODER}" 3>&1 1>&2 2>&3)
while [[ -z $RECEIVER_DEVICE_ASSIGNED_TO_VDLM2_DECODER ]]; do
RECEIVER_DEVICE_ASSIGNED_TO_VDLM2_DECODER=$(whiptail --backtitle "Decoder Configuration" \
--title "${vdlm2_device_number_title}" \
--inputbox "\nEnter the RTL-SDR device number to assign to VDLM2DEC." \
8 78 \
"${device_assigned_to_vdlm2_decoder}" 3>&1 1>&2 2>&3)
exit_status=$?
if [[ $exit_status != 0 ]]; then
exit 1
@ -372,14 +373,14 @@ function assign_devices_to_decoders() {
fi
if [[ ! -z $RECEIVER_DEVICE_ASSIGNED_TO_ADSB_DECODER && "${RECEIVER_ADSB_DECODER_SOFTWARE}" == "dump1090-fa" ]]; then
log_message "Assigning RTL-SDR device number ${RECEIVER_DEVICE_ASSIGNED_TO_ADSB_DECODER} to the FlightAware Dump1090 decoder"
log_message "Assigning RTL-SDR device number ${RECEIVER_DEVICE_ASSIGNED_TO_ADSB_DECODER} to FlightAware Dump1090"
change_config "RECEIVER_SERIAL" $RECEIVER_DEVICE_ASSIGNED_TO_ADSB_DECODER "/etc/default/dump1090-fa"
log_message "Restarting dump1090-fa"
sudo systemctl restart dump1090-fa
fi
if [[ ! -z $RECEIVER_DEVICE_ASSIGNED_TO_UAT_DECODER && "${RECEIVER_UAT_DECODER_SOFTWARE}" == "dump978-fa" ]]; then
log_message "Assigning RTL-SDR device number ${RECEIVER_DEVICE_ASSIGNED_TO_UAT_DECODER} to the FlightAware Dump978 decoder"
log_message "Assigning RTL-SDR device number ${RECEIVER_DEVICE_ASSIGNED_TO_UAT_DECODER} to FlightAware Dump978"
sudo sed -i -e "s|driver=rtlsdr|driver=rtlsdr,serial=${RECEIVER_DEVICE_ASSIGNED_TO_UAT_DECODER}|g" /etc/default/dump978-fa
log_message "Restarting dump978-fa"
sudo systemctl restart dump978-fa
@ -395,13 +396,13 @@ function assign_devices_to_decoders() {
fi
if [[ ! -z $RECEIVER_DEVICE_ASSIGNED_TO_ADSB_DECODER && "${RECEIVER_ADSB_DECODER_SOFTWARE}" == "readsb" ]]; then
log_message "Assigning RTL-SDR device number ${RECEIVER_DEVICE_ASSIGNED_TO_ADSB_DECODER} to the Readsb decoder"
change_config "RECEIVER_SERIAL" $RECEIVER_DEVICE_ASSIGNED_TO_ADSB_DECODER "/etc/default/readsb"
log_message "Assigning RTL-SDR device number ${RECEIVER_DEVICE_ASSIGNED_TO_ADSB_DECODER} to Readsb"
sudo sed -i -e "s|\(.*--device \)\([0-9]\+\)\( .*\)|\1${RECEIVER_DEVICE_ASSIGNED_TO_ADSB_DECODER}\3|g" /etc/default/readsb
log_message "Restarting Readsb"
sudo systemctl restart readsb
fi
if [[ ! -z "${RECEIVER_DEVICE_ASSIGNED_TO_VDLM2_DECODER}" && "${RECEIVER_VDLM2_DECODER_SOFTWARE}" == "vdlm2dec" ]]; then
if [[ ! -z $RECEIVER_DEVICE_ASSIGNED_TO_VDLM2_DECODER && "${RECEIVER_VDLM2_DECODER_SOFTWARE}" == "vdlm2dec" ]]; then
log_message "Assigning RTL-SDR device number ${RECEIVER_DEVICE_ASSIGNED_TO_VDLM2_DECODER} to vdlm2dec"
sudo sed -i -e "s|\(.*-r \)\([0-9]\+\)\( .*\)|\1${RECEIVER_DEVICE_ASSIGNED_TO_VDLM2_DECODER}\3|g" /etc/systemd/system/vdlm2dec.service
log_message "Reloading systemd units"
@ -409,4 +410,4 @@ function assign_devices_to_decoders() {
log_message "Restarting vdlm2dec"
sudo systemctl restart vdlm2dec
fi
}
}