emq-TE1/direwolf.sh

344 lines
11 KiB
Bash

if [ -d "/opt/direwolf" ]
then
rm -r /opt/direwolf
#echo "found file"
fi
######################################################################################################################
# raspberry
#####################################################################################################################
if [ "$(cat /proc/cpuinfo | grep 'Raspberry')" != "" ]; then
cat > /etc/modprobe.d/raspi-blacklist.conf <<- "EOFB1"
blacklist snd_bcm2835
# blacklist spi and i2c by default (many users don't need them)
#blacklist spi-bcm2708
#blacklist i2c-bcm2708
blacklist snd-soc-pcm512x
blacklist snd-soc-wm8804
# dont load default drivers for the RTL dongle
blacklist dvb_usb_rtl28xxu
blacklist rtl_2832
blacklist rtl_2830
EOFB1
#
sudo sed -i 's/defaults.ctl.card.*/defaults.ctl.card 1/' /usr/share/alsa/alsa.conf
sudo sed -i 's/defaults.pcm.card.*/defaults.pcm.card 1/' /usr/share/alsa/alsa.conf
else
echo "PC"
fi
#########################################################################################################################
# requeriments
#########################################################################################################################
sudo apt-get install git gcc g++ make cmake libasound2-dev libudev-dev -y
#########################################################################################################################
# direwolf
#########################################################################################################################
cd /opt/
git clone https://www.github.com/wb2osz/direwolf
cd direwolf
git checkout dev
mkdir build && cd build
cmake ..
make -j4
sudo make install
make install-conf
cp /usr/local/bin/direwolf /opt/direwolf/direwolf2
wget https://gitlab.com/hp3icc/emq-TE1/-/raw/main/direwolf1 -O /opt/direwolf/direwolf1
#############
cat > /lib/systemd/system/direwolf-rtl.service <<- "EOF"
[Unit]
Description=Direwolf-RTL Service
Wants=network-online.target
After=syslog.target network-online.target
[Service]
User=root
Type=simple
Restart=always
RestartSec=3
StandardOutput=null
ExecStartPre=/bin/sh -c 'until ping -c1 noip.com; do sleep 1; done;'
ExecStart=/opt/direwolf/rtl.sh
# | direwolf -c /home/pi/direwolf/sdr.conf
[Install]
WantedBy=multi-user.target
#ExecStart= /usr/local/bin/rtl_fm -M fm -f 144.39M -p 0 -s 22050 -g 42 - | /usr/local/bin/direwolf -c /opt/direwolf/sdr.conf -r 22050 -D 1 -B 1200 -
EOF
######
cat > /lib/systemd/system/direwolf.service <<- "EOF"
[Unit]
Description=Direwolf Service
#Wants=network-online.target
After=sound.target syslog.target
#network-online.target
[Service]
User=root
Type=simple
Restart=always
RestartSec=3
StandardOutput=null
ExecStart=sudo direwolf -c /opt/direwolf/dw.conf
[Install]
WantedBy=multi-user.target
EOF
###
sudo cat > /opt/direwolf/service1 <<- "EOF"
[Unit]
Description=Direwolf Service
After=sound.target syslog.target
[Service]
User=root
Type=simple
Restart=always
RestartSec=3
StandardOutput=null
ExecStart=/usr/local/bin/direwolf -c /opt/direwolf/dw.conf
[Install]
WantedBy=multi-user.target
EOF
##
sudo cat > /opt/direwolf/service2 <<- "EOF"
[Unit]
Description=Direwolf Service
#Wants=network-online.target
After=sound.target syslog.target
#network-online.target
[Service]
User=root
Type=simple
Restart=always
RestartSec=3
StandardOutput=null
ExecStart=/usr/local/bin/direwolf -l /var/log/direwolf -c /opt/direwolf/dw.conf
[Install]
WantedBy=multi-user.target
EOF
###
cat > /opt/direwolf/rtl.sh <<- "EOF"
#!/bin/sh
PATH=/bin:/usr/bin:/usr/local/bin
unset LANG
rtl_fm -M fm -f 144.39M -p 0 -s 22050 -g 42 - | /usr/local/bin/direwolf -c /opt/direwolf/sdr.conf -r 22050 -D 1 -B 1200 -
EOF
#
cat > /opt/direwolf/rtl1.sh <<- "EOF"
#!/bin/sh
PATH=/bin:/usr/bin:/usr/local/bin
unset LANG
rtl_fm -M fm -f 144.39M -p 0 -s 22050 -g 42 - | /usr/local/bin/direwolf -c /opt/direwolf/sdr.conf -r 22050 -D 1 -B 1200 -
EOF
#
cat > /opt/direwolf/rtl2.sh <<- "EOF"
#!/bin/sh
PATH=/bin:/usr/bin:/usr/local/bin
unset LANG
rtl_fm -M fm -f 144.39M -p 0 -s 22050 -g 42 - | /usr/local/bin/direwolf -l /var/log/direwolf -c /opt/direwolf/sdr.conf -r 22050 -D 1 -B 1200 -
EOF
#
sudo chmod +x /opt/direwolf/rtl.sh
#
cat > /opt/direwolf/sdr.conf <<- "EOF"
#############################################################
# #
# Configuration file for DireWolf #
# #
# Linux version setting by hp3icc #
# #
# emq-TE1ws #
# #
# configuration for SDR read-only IGate. #
#############################################################
ADEVICE null null
CHANNEL 0
MYCALL HP3ICC-10
PBEACON sendto=IG delay=0:40 every=30 symbol="/r" lat=08^31.27N long=080^21.59W comment="SDR APRS RX-IGATE / Raspbian Proyect by hp3icc"
# First you need to specify the name of a Tier 2 server.
# The current preferred way is to use one of these regional rotate addresses:
# noam.aprs2.net - for North America
# soam.aprs2.net - for South America
# euro.aprs2.net - for Europe and Africa
# asia.aprs2.net - for Asia
# aunz.aprs2.net - for Oceania
IGSERVER igates.aprs.fi:14580
#noam.aprs2.net
# You also need to specify your login name and passcode.
# Contact the author if you can't figure out how to generate the passcode.
IGLOGIN HP3ICC-10 12345
# That's all you need for a receive only IGate which relays
# messages from the local radio channel to the global servers.
#
#AGWPORT 8000
#KISSPORT 8001
EOF
###
cat > /opt/direwolf/dw.conf <<- "EOF"
#############################################################
# #
# Configuration file for DireWolf #
# #
# Linux version setting by hp3icc #
# #
# emq-TE1ws #
# #
#############################################################
#############################################################
# #
# FIRST AUDIO DEVICE PROPERTIES #
# (Channel 0 + 1 if in stereo) #
# #
#############################################################
ADEVICE plughw:1,0
#ADEVICE null null
# ADEVICE - plughw:1,0
# ADEVICE UDP:7355 default
# Number of audio channels for this souncard: 1 or 2.
#
ACHANNELS 1
#############################################################
# #
# CHANNEL 0 PROPERTIES #
# #
#############################################################
CHANNEL 0
MYCALL HP3ICC-10
MODEM 1200
#MODEM 1200 1200:2200
#MODEM 300 1600:1800
#MODEM 9600 0:0
#
#MODEM 1200 E+ /3
#
#
# If not using a VOX circuit, the transmitter Push to Talk (PTT)
# DON'T connect it directly!
#
# For the PTT command, specify the device and either RTS or DTR.
# RTS or DTR may be preceded by "-" to invert the signal.
# Both can be used for interfaces that want them driven with opposite polarity.
#
# COM1 can be used instead of /dev/ttyS0, COM2 for /dev/ttyS1, and so on.
#
#PTT CM108
#PTT COM1 RTS
#PTT COM1 RTS -DTR
#PTT /dev/ttyUSB0 RTS
#PTT /dev/ttyUSB0 DTR
#PTT GPIO 25
#PTT GPIO 26
# The Data Carrier Detect (DCD) signal can be sent to the same places
# as the PTT signal. This could be used to light up an LED like a normal TNC.
#DCD COM1 -DTR
#DCD GPIO 24
#pin18 (GPIO 24) - (cathode) LED (anode) - 270ohm resistor - 3.3v
#DCD GPIO 13
#############################################################
# #
# VIRTUAL TNC SERVER PROPERTIES #
# #
#############################################################
#
# Dire Wolf acts as a virtual TNC and can communicate with
# client applications by different protocols:
#
# - the "AGW TCPIP Socket Interface" - default port 8000
# - KISS protocol over TCP socket - default port 8001
# - KISS TNC via pseudo terminal (-p command line option)
#
#Setting to 0 disables UI-proto only AGW and TCP-KISS ports
AGWPORT 8000
KISSPORT 8001
#KISSPORT 0
#
# It is sometimes possible to recover frames with a bad FCS.
# This applies to all channels.
# 0 [NONE] - Don't try to repair.
# 1 [SINGLE] - Attempt to fix single bit error. (default)
# 2 [DOUBLE] - Also attempt to fix two adjacent bits.
# ... see User Guide for more values and in-depth discussion.
#
#FIX_BITS 0
#Enable fixing of 1 bits and use generic AX25 heuristics data (not APRS heuristi$
#FIX_BITS 1 AX25
#
#############################################################
# #
# BEACONING PROPERTIES #
# #
#############################################################
#GPSD
#TBEACON symbol="/v" comment="HP3ICC-9 / APRS TRACKER / Raspbian Proyect by hp3icc" via=WIDE2-2
#SMARTBEACONING 28 0:30 12 0:1800 0:30 15 45 via=WIDE2-2
#
#PBEACON delay=0:05 every=20 symbol="/r" lat=08^31.27N long=080^21.59W comment="APRS DIGI-IGATE / Raspbian Proyect by hp3icc" via=WIDE2-2
#PBEACON sendto=IG delay=0:60 every=30 symbol="/r" lat=08^31.27N long=080^21.59W comment="APRS DIGI-IGATE / Raspbian Proyect by hp3icc"
#############################################################
# #
# DIGIPEATER PROPERTIES #
# #
#############################################################
DIGIPEAT 0 0 ^WIDE[3-7]-[1-7]$|^TEST$ ^WIDE[12]-[12]$ TRACE
FILTER 0 0 t/poimqstunw
#############################################################
# #
# INTERNET GATEWAY #
# #
#############################################################
# First you need to specify the name of a Tier 2 server.
# The current preferred way is to use one of these regional rotate addresses:
# noam.aprs2.net - for North America
# soam.aprs2.net - for South America
# euro.aprs2.net - for Europe and Africa
# brazil.d2g.com
#
#IGSERVER igates.aprs.fi:14580
#IGSERVER noam.aprs2.net:14580
#IGSERVER cx2sa.net:14580
#IGLOGIN HP3ICC-10 12345
IGTXVIA 0 WIDE2-2
#WIDE1-1,WIDE2-1
#WIDE2-2
#
#
#IGFILTER b/HP3ICC-5
#IGFILTER p/HP
#m/600
#
FILTER IG 0 t/p
#poimqstunw
IGTXLIMIT 6 10
#
EOF
#
#############################
systemctl daemon-reload