Update direwolf.sh

This commit is contained in:
RaspbianProyect by HP3ICC 2023-07-05 20:11:38 +00:00
parent 42694f744b
commit 6a0a4c6d68
1 changed files with 38 additions and 18 deletions

View File

@ -30,7 +30,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" "ntp")
for app in "${apps[@]}"
do
@ -48,19 +48,19 @@ done
#########################################################################################################################
# GPSD
#########################################################################################################################
#cat > /etc/udev/rules.d/49-usb-gps.rules <<- "EOF"
#KERNEL=="ttyACM[0-9]*", SUBSYSTEM=="tty", ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a7", SYMLINK="ttyACM0"
#EOF
cat > /etc/udev/rules.d/49-usb-gps.rules <<- "EOF"
KERNEL=="ttyACM[0-9]*", SUBSYSTEM=="tty", ATTRS{idVendor}=="1546", ATTRS{idProduct}=="01a7", SYMLINK="ttyGPS"
EOF
cat > /etc/default/gpsd <<- "EOF"
START_DAEMON="true"
GPSD_OPTIONS="-n"
DEVICES="/dev/ttyACM0"
DEVICES="/dev/ttyGPS"
USBAUTO="true"
EOF
sudo systemctl stop gpsd
#sudo systemctl stop gpsd
#cat > /lib/systemd/system/gpsd.service <<- "EOFG"
#[Unit]
#Description=GPS (Global Positioning System) Daemon
@ -80,23 +80,43 @@ sudo systemctl stop gpsd
#EOFG
sudo systemctl daemon-reload
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")
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
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
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=gpsd.service
Wants=gpsd.service
[Service]
ExecStart=gpsctl --nmea
Restart=always
RestartSec=3
[Install]
WantedBy=default.target
EOFT
systemctl daemon-reload
systemctl start tnmea.service
systemctl enable tnmea.service
systemctl restart gpsd.socket gpsd.service
systemctl enable gpsd.socket gpsd.service
#########################################################################################################################
# direwolf
#########################################################################################################################