Skip to content

Instantly share code, notes, and snippets.

@M0LTE
Created March 27, 2018 22:11
Show Gist options
  • Save M0LTE/2f80769942acdcf4f845fd15763f6bdd to your computer and use it in GitHub Desktop.
Save M0LTE/2f80769942acdcf4f845fd15763f6bdd to your computer and use it in GitHub Desktop.
Almost-working igate-on-a-pi script
#!/bin/bash -e
# for some reason line 65 doesn't start DW, needs a bit more work
apt-get install build-essential git cmake libusb-1.0-0-dev libasound2-dev screen
git clone https://www.github.com/wb2osz/direwolf
git checkout dev # switch to dev branch, optional
pushd direwolf
make
make install
make install-conf
popd
git clone git://git.osmocom.org/rtl-sdr.git
pushd rtl-sdr
mkdir build
pushd build
cmake ../ -DINSTALL_UDEV_RULES=ON -DDETACH_KERNEL_DRIVER=ON
make
make install
ldconfig
popd
popd
echo "blacklist dvb_usb_rtl28xxu
blacklist dvb_usb_v2
blacklist rtl_2830
blacklist rtl_2832
blacklist r820t" >> /etc/modprobe.d/raspi-blacklist.conf
'rm' ~/sdr.conf
'rm' ~/direwolf/sdr.conf
'rm' /usr/local/share/doc/direwolf/examples/sdr.conf
echo "ADEVICE null null
CHANNEL 0
MYCALL M0LTE
IGSERVER euro.aprs2.net
IGLOGIN M0LTE 14214" > /etc/direwolf.conf
echo '#!'"/bin/bash
export PATH=/usr/local/bin:\$PATH
RUNMODE=CLI
DIREWOLF=\"/usr/local/bin/direwolf\"
DWCMD=\"/bin/bash -c '/usr/local/bin/rtl_fm -f 144.80M - | /usr/local/bin/direwolf -c /etc/direwolf.conf -r 24000 -D 1 -t 0 -'\"
LOGFILE=/tmp/dw-start.log
SUCCESS=0
date >> \$LOGFILE
sleep 30
# Nothing to do if Direwolf is already running.
a=\`ps ax | grep direwolf | grep -vi -e bash -e screen -e grep | awk '{print \$1}'\`
if [ -n \"\$a\" ]
then
#date >> /tmp/dw-start.log
#echo \"Direwolf already running.\" >> \$LOGFILE
exit
fi
SCREEN=\`which screen\`
if [ \$? -ne 0 ]; then
echo -e \"Error: screen is not installed but is required for CLI mode. Aborting\"
exit 1
fi
echo \"Direwolf in CLI mode start up\"
echo \"Direwolf in CLI mode start up\" >> \$LOGFILE
\$SCREEN -d -m -S direwolf \$DWCMD >> \$LOGFILE
SUCCESS=1
\$SCREEN -list direwolf
\$SCREEN -list direwolf >> \$LOGFILE
echo \"-----------------------\"
echo \"-----------------------\" >> \$LOGFILE" > /root/direwolf/dw-start.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment