4
4
# Dire Wolf automatically.
5
5
6
6
# See User Guide for more discussion.
7
- # For release 1.4 it is section 5.7 "Automatic Start Up After Reboot"
7
+ # For release 1.6 it is section 5.7 "Automatic Start Up After Reboot"
8
8
# but it could change in the future as more information is added.
9
9
10
10
11
11
# Versioning (this file, not direwolf version)
12
12
# -----------
13
- # v1.5 - KI6ZHD - Update to auto-detect binary paths and updated GUI start
13
+ # v1.6 - KI6ZHD - Update to auto-detect binary paths and updated GUI start
14
14
# v1.3 - KI6ZHD - added variable support for direwolf binary location
15
15
# v1.2 - KI6ZHD - support different versions of VNC
16
16
# v1.1 - KI6ZHD - expanded version to support running on text-only displays with
32
32
33
33
RUNMODE=AUTO
34
34
35
- # Location of the direwolf binary. Depends on $PATH as shown.
36
- # change this if you want to use some other specific location.
37
- # e.g. DIREWOLF="/usr/local/bin/direwolf"
38
35
39
- DIREWOLF=" direwolf"
36
+ # Location of the direwolf binary. Depends on $PATH as shown and how the program
37
+ # was installed. Change this if you want to use some other specific location.
38
+ # e.g. DIREWOLF="/usr/bin/direwolf"
39
+
40
+ DIREWOLF=" /usr/local/bin/direwolf"
41
+
40
42
41
43
# Direwolf start up command :: two examples where example one is enabled
42
44
#
43
45
# 1. For normal operation as TNC, digipeater, IGate, etc.
44
46
# Print audio statistics each 100 seconds for troubleshooting.
45
47
# Change this command to however you wish to start Direwolf
46
-
47
- DWCMD=" $DIREWOLF -a 100"
48
-
49
- # ---------------------------------------------------------------
50
48
#
51
49
# 2. Alternative for running with SDR receiver.
52
50
# Piping one application into another makes it a little more complicated.
53
51
# We need to use bash for the | to be recognized.
52
+ #
53
+ # DWCMD="bash -c 'rtl_fm -f 144.39M - | direwolf -c sdr.conf -r 24000 -D 1 -'"
54
+ #
55
+ # Config:
56
+ # This command assumes the direwolf.conf file is in the CURRENT directory that
57
+ # the user is within per the "pwd" command. If not, enhance this command to
58
+ # use the "-c" option such as "-c /home/pi/direwolf.conf" syntax
59
+ #
60
+ # Options:
61
+ # Any other direwolf options such as turning on/off color, etc should go in here
54
62
55
- # DWCMD="bash -c 'rtl_fm -f 144.39M - | direwolf -c sdr.conf -r 24000 -D 1 -' "
63
+ DWCMD=" $DIREWOLF -a 100 -t 0 "
56
64
57
65
58
66
# Where will logs go - needs to be writable by non-root users
@@ -66,24 +74,42 @@ LOGFILE=/var/tmp/dw-start.log
66
74
# Status variables
67
75
SUCCESS=0
68
76
77
+ function CHKERR {
78
+ if [ $? -ne 0 ]; then
79
+ echo -e " Last command failed"
80
+ exit 1
81
+ fi
82
+ }
83
+
69
84
function CLI {
85
+ # Auto-determine if screen is installed
70
86
SCREEN=` which screen`
71
87
if [ $? -ne 0 ]; then
72
88
echo -e " Error: screen is not installed but is required for CLI mode. Aborting"
73
89
exit 1
74
90
fi
75
91
76
- echo " Direwolf in CLI mode start up"
77
- echo " Direwolf in CLI mode start up" >> $LOGFILE
92
+ echo " Direwolf in CLI mode start up. All log output recorded to $LOGFILE "
93
+ echo " Direwolf in CLI mode start up. All log output recorded to $LOGFILE " >> $LOGFILE
78
94
79
95
# Screen commands
80
96
# -d m :: starts the command in detached mode
81
97
# -S :: name the session
98
+ # --
99
+ # Remove the "-d m" if you don't want screen to detach and not show direwolf"
82
100
$SCREEN -d -m -S direwolf $DWCMD >> $LOGFILE
101
+ CHKERR
83
102
SUCCESS=1
103
+ echo " "
104
+ echo " " >> $LOGFILE
84
105
85
106
$SCREEN -list direwolf
107
+ CHKERR
86
108
$SCREEN -list direwolf >> $LOGFILE
109
+ echo -e " \nYou can re-attach to the Direwolf screen with:"
110
+ echo -e " screen -dr direwolf"
111
+ echo -e " \nYou can re-attach to the Direwolf screen with:" >> $LOGFILE
112
+ echo -e " screen -dr direwolf" >> $LOGFILE
87
113
88
114
echo " -----------------------"
89
115
echo " -----------------------" >> $LOGFILE
@@ -98,7 +124,10 @@ function GUI {
98
124
# If VNC server is running, use its display number.
99
125
# Otherwise default to :0 (the Xwindows on the HDMI display)
100
126
#
101
- export DISPLAY=" :0"
127
+ if [ ! $DISPLAY ]; then
128
+ echo " No Xdisplay set"
129
+ # export DISPLAY=":0"
130
+ fi
102
131
103
132
# Reviewing for RealVNC sessions (stock in Raspbian Pixel)
104
133
if [ -n " ` ps -ef | grep vncserver-x11-serviced | grep -v grep` " ]; then
@@ -112,23 +141,29 @@ function GUI {
112
141
export DISPLAY=" $d "
113
142
fi
114
143
115
- echo " Direwolf in GUI mode start up"
116
- echo " Direwolf in GUI mode start up" >> $LOGFILE
144
+ echo " Direwolf in GUI mode start up. All log output recorded to $LOGFILE "
145
+ echo " Direwolf in GUI mode start up. All log output recorded to $LOGFILE " >> $LOGFILE
117
146
echo " DISPLAY=$DISPLAY "
118
147
echo " DISPLAY=$DISPLAY " >> $LOGFILE
119
148
120
149
#
121
150
# Auto adjust the startup for your particular environment: gnome-terminal, xterm, etc.
122
151
#
123
152
124
- if [ -x /usr/bin/lxterminal ]; then
125
- /usr/bin/lxterminal -t " Dire Wolf" -e " $DWCMD " &
153
+ if [ $( which lxterminal) ]; then
154
+ # echo "DEBUG: lxterminal stanza"
155
+ $( which lxterminal) -l -t " Dire Wolf" -e " $DWCMD " &
156
+ CHKERR
126
157
SUCCESS=1
127
- elif [ -x /usr/bin/xterm ]; then
128
- /usr/bin/xterm -bg white -fg black -e " $DWCMD " &
158
+ elif [ $( which xterm) ]; then
159
+ # echo "DEBUG: xterm stanza"
160
+ $( which xterm) -bg white -fg black -e " $DWCMD " &
161
+ CHKERR
129
162
SUCCESS=1
130
- elif [ -x /usr/bin/x-terminal-emulator ]; then
131
- /usr/bin/x-terminal-emulator -e " $DWCMD " &
163
+ elif [ $( which x-terminal-emulator) ]; then
164
+ # echo "DEBUG: x-xterm-emulator stanza"
165
+ $( which x-terminal-emulator) -e " $DWCMD " &
166
+ CHKERR
132
167
SUCCESS=1
133
168
else
134
169
echo " Did not find an X terminal emulator. Reverting to CLI mode"
@@ -147,12 +182,23 @@ function GUI {
147
182
#
148
183
export PATH=/usr/local/bin:$PATH
149
184
150
- # Log the start of the script run and re-run
151
- date >> $LOGFILE
185
+ if [ ! -x $DIREWOLF ]; then
186
+ echo -e " \nError: Direwolf program not found per the DIREWOLF variable in script. Aborting.\n"
187
+ echo -e " \nError: Direwolf program not found per the DIREWOLF variable in script. Aborting.\n" >> $LOGFILE
188
+ exit 1
189
+ fi
152
190
153
191
# First wait a little while in case we just rebooted
154
192
# and the desktop hasn't started up yet.
155
193
#
194
+ echo -e " \ndw-start.sh"
195
+ echo -e " -----------"
196
+ # Log the start of the script run and re-run
197
+ date
198
+ date >> $LOGFILE
199
+
200
+ # echo -e "Sleeping for 30 seconds to let any boot/reboot delays conclude"
201
+ echo -e " Sleeping for 30 seconds to let any boot/reboot delays conclude"
156
202
sleep 30
157
203
158
204
0 commit comments