mirror of https://gitlab.com/hp3icc/emq-TE1.git
Update direwolf.sh
This commit is contained in:
parent
0891888e53
commit
de5ae35e49
|
|
@ -26,7 +26,7 @@ fi
|
|||
# requeriments
|
||||
#########################################################################################################################
|
||||
|
||||
apps=("git" "gcc" "g++" "make" "cmake" "libasound2-dev" "libudev-dev" "gpsd" "libgps-dev" "gpsd-clients" "gpsd-tools")
|
||||
apps=("git" "gcc" "g++" "make" "cmake" "libasound2-dev" "libudev-dev" "gpsd" "libgps-dev" "gpsd-clients" "gpsd-tools" "chrony")
|
||||
|
||||
for app in "${apps[@]}"
|
||||
do
|
||||
|
|
@ -60,54 +60,20 @@ fi
|
|||
# GPSD
|
||||
#########################################################################################################################
|
||||
cat > /etc/udev/rules.d/49-usb-gps.rules <<- "EOF"
|
||||
KERNEL=="ttyACM[0-9]*", SUBSYSTEM=="tty", ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a7", SYMLINK="ttyGPS", RUN+="gpsctl --nmea"
|
||||
KERNEL=="ttyACM[0-9]*", SUBSYSTEM=="tty", ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a7", SYMLINK="ttyACM0"
|
||||
EOF
|
||||
sudo udevadm control --reload-rules
|
||||
|
||||
cat > /etc/default/gpsd <<- "EOF"
|
||||
START_DAEMON="true"
|
||||
GPSD_OPTIONS="-n"
|
||||
DEVICES="/dev/ttyGPS"
|
||||
GPSD_OPTIONS="-r -n"
|
||||
DEVICES="/dev/ttyACM0"
|
||||
USBAUTO="true"
|
||||
|
||||
EOF
|
||||
|
||||
sudo ln -sf /lib/systemd/system/gpsd.service /etc/systemd/system/multi-user.target.wants/
|
||||
#sudo systemctl start gpsd
|
||||
#archivo="/etc/ntp.conf"
|
||||
#palabra=("server 127.127.28.0 4" "fudge 127.127.28.0 time1 0.340 refid GPS" "server 127.127.28.1 prefer" "fudge 127.127.28.1 refid GPS1")
|
||||
|
||||
#for palabra in "${palabra[@]}"
|
||||
#do
|
||||
|
||||
#if grep -i -E "$palabra" "$archivo" >/dev/null 2>&1; then
|
||||
# echo "line found"
|
||||
# else
|
||||
# echo "$palabra">> "$archivo"
|
||||
#fi
|
||||
#done
|
||||
#sudo /etc/init.d/ntp restart
|
||||
|
||||
cat > /lib/systemd/system/tnmea.service <<- "EOFT"
|
||||
[Unit]
|
||||
Description=TNMEA Service
|
||||
#After=direwolf.service
|
||||
After=multi-user.target
|
||||
Requires=gpsd.service
|
||||
|
||||
[Service]
|
||||
StandardOutput=null
|
||||
ExecStartPre=sleep 30
|
||||
ExecStart=gpsctl --nmea
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
||||
|
||||
EOFT
|
||||
archivo="/lib/systemd/system/gpsd.service"
|
||||
palabra=("Also=tnmea.socket")
|
||||
#
|
||||
archivo="/etc/chrony/chrony.conf"
|
||||
palabra=("refclock SHM 0 offset 0.5 delay 0.2 refid NMEA")
|
||||
|
||||
for palabra in "${palabra[@]}"
|
||||
do
|
||||
|
|
@ -118,9 +84,32 @@ if grep -i -E "$palabra" "$archivo" >/dev/null 2>&1; then
|
|||
echo "$palabra">> "$archivo"
|
||||
fi
|
||||
done
|
||||
systemctl stop gpsd.socket gpsd.service
|
||||
cat > /lib/systemd/system/gpsd.service <<- "EOFT"
|
||||
[Unit]
|
||||
Description=GPS (Global Positioning System) Daemon
|
||||
Requires=gpsd.socket
|
||||
# Needed with chrony SOCK refclock
|
||||
After=chronyd.service
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
EnvironmentFile=-/etc/default/gpsd
|
||||
ExecStart=/usr/sbin/gpsd $GPSD_OPTIONS $DEVICES
|
||||
ExecStartPost=bash -c 'sleep 3 && gpsctl --nmea'
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Also=gpsd.socket
|
||||
|
||||
EOFT
|
||||
sed -i "s/ListenStream=127.0.0.1:2947/#ListenStream=127.0.0.1:2947/g" /lib/systemd/system/gpsd.socket
|
||||
sed -i "s/#ListenStream=0.0.0.0:2947/ListenStream=0.0.0.0:2947/g" /lib/systemd/system/gpsd.socket
|
||||
systemctl daemon-reload
|
||||
systemctl start tnmea.service
|
||||
systemctl enable tnmea.service
|
||||
systemctl is-active gpsd
|
||||
systemctl is-active chrony
|
||||
sudo ln -sf /lib/systemd/system/gpsd.service /etc/systemd/system/multi-user.target.wants/
|
||||
systemctl enable chrony
|
||||
systemctl restart gpsd.socket gpsd.service
|
||||
systemctl enable gpsd.socket gpsd.service
|
||||
#########################################################################################################################
|
||||
|
|
|
|||
Loading…
Reference in New Issue