headless system won't make a default choice
"K0LNY ??" <[email protected]>
| Newsgroups | gmane.linux.debian.devel.accessibility |
|---|---|
| Organization | Home |
| Message-ID | <00aa01dbbeaf$c7759e10$01ffa8c0@nucwin10> |
Hello, I have this police/fire software on a Raspberry PI, which is Debian. The sighted guy who helped me make this was able to tune the trunked P25 stuff by using Anydesk to log in and tune the waterfall visual tuner from another city. I'm trying to get the default choice to work on boot-up, but the only way it works is for him to log in and click on the desktop menu option in the choice window that is on the desktop. I only SSH into it, but this is supposed to default to a choice after a few seconds but it does not do that. There is a menu.sh file in the home directory, and there is a service file to run the script, which does run on startup, but the default choice is only made when he logs in and clicks on the choice. I'll attach the menu file here in case anyone is interested in looking at it to see if they might be able to tell why the default choice is not happening. Thanks Glenn You know nothing for sure, except the fact that you know nothing for sure. John F. Kennedy Glenn K0LNY & WSAT439
menu (2).sh
(application/octet-stream, 2.4 KB)
#!/bin/bash
/bin/aplay /home/pi/scanner-start.wav
sleep 5
# Announce the IP Address
echo "Your IP address is" > /home/pi/ip_announce.txt
hostname -I | awk '{print $1}' > /home/pi/ip.txt
[[ -f /home/pi/ip_announce.txt ]] && voxin-say -f /home/pi/ip_announce.txt | /bin/aplay
sleep 0.5
[[ -f /home/pi/ip.txt ]] && voxin-say -f /home/pi/ip.txt | /bin/aplay
sleep 1
# Announce the Hostname
echo "The hostname is" > /home/pi/host_announce.txt
hostname > /home/pi/host.txt
[[ -f /home/pi/host_announce.txt ]] && voxin-say -f /home/pi/host_announce.txt | /bin/aplay
sleep 0.5
[[ -f /home/pi/host.txt ]] && voxin-say -f /home/pi/host.txt | /bin/aplay
sleep 1
# Announce Menu Loading
[[ -f /home/pi/menu-load.txt ]] && voxin-say -f /home/pi/menu-load.txt | /bin/aplay
sleep 1
[[ -f /home/pi/choice.txt ]] && voxin-say -f /home/pi/choice.txt | /bin/aplay
# Function to display and announce the menu
show_menu() {
clear
echo "Which file do you want to run?"
# Announce each menu item with a pause after the number
for i in {1..5}; do
if [[ -f /home/pi/num$i.txt && -f /home/pi/option$i.txt ]]; then
voxin-say -f /home/pi/num$i.txt | /bin/aplay
sleep 0.5
voxin-say -f /home/pi/option$i.txt | /bin/aplay
fi
done
echo -n "Enter your choice (or wait 5 seconds for default): "
}
# Show the menu
show_menu
# Read user input with a 5-second timeout
read -t 5 choice || true
# If no input received, default to option 1
if [ -z "$choice" ]; then
choice=1
fi
# Announce and execute the selected choice
option_file="/home/pi/option$choice.txt"
if [[ -f "$option_file" ]]; then
voxin-say -f "$option_file" | /bin/aplay
fi
case $choice in
1)
echo "Running Trunk Recorder 800..."
bash /home/pi/trunk-build/run_trunk_recordervhf.sh
;;
2)
echo "Running Trunk Recorder vhf..."
bash /home/pi/trunk-build/run_trunk_recorder800.sh
;;
3)
echo "Running OP25 800..."
bash /home/pi/Documents/NE/RTL-SDR/'Monitor Norfolk 800.sh'
;;
4)
echo "Running OP25 VHF..."
bash /home/pi/Documents/NE/RTL-SDR/'Monitor Norfolk VHF.sh'
;;
5)
echo "Exiting..."
;;
*)
echo "Invalid choice. Running default option: Trunk Recorder 800..."
[[ -f /home/pi/invalid.txt ]] && voxin-say -f /home/pi/invalid.txt | /bin/aplay
bash /home/pi/trunk-build/run_trunk_recordervhf.sh
;;
esac
exit 0