From 4f09aa96d7e2a7b228488392c2dd86bfaab0a924 Mon Sep 17 00:00:00 2001 From: RaspbianProyect by HP3ICC Date: Wed, 5 Jul 2023 04:15:25 +0000 Subject: [PATCH] Update direwolf.sh --- install/direwolf.sh | 61 +++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 33 deletions(-) diff --git a/install/direwolf.sh b/install/direwolf.sh index 2ad0fb1..8af4314 100644 --- a/install/direwolf.sh +++ b/install/direwolf.sh @@ -3,6 +3,14 @@ cd / if systemctl status direwolf.service |grep active >/dev/null 2>&1 then systemctl stop direwolf.service +fi +if systemctl status gpsd.socket |grep active >/dev/null 2>&1 +then systemctl stop gpsd.socket + +fi +if systemctl status gpsd |grep active >/dev/null 2>&1 +then systemctl stop gpsd + fi if [ -d "/opt/direwolf" ] then @@ -16,27 +24,13 @@ then #echo "found file" fi -apps=("git" "gcc" "g++" "make" "cmake" "libasound2-dev" "libudev-dev" "libgps-dev" "gpsd" "libgps-dev" "ntp") -for app in "${apps[@]}" -do - # Verificar apps - if ! dpkg -s "$app" >/dev/null 2>&1; then - echo "app no instalada" - - else - # app ya instalada - apt-get remove -y "$app" - apt-get purge -y "$app" - - fi -done ######################################################################################################################### # requeriments ######################################################################################################################### -apps=("git" "gcc" "g++" "make" "cmake" "libasound2-dev" "libudev-dev" "libgps-dev" "gpsd" "libgps-dev" "ntp") +apps=("git" "gcc" "g++" "make" "cmake" "libasound2-dev" "libudev-dev" "gpsd" "libgps-dev" "gpsd-clients" "gpsd-tools") for app in "${apps[@]}" do @@ -49,24 +43,25 @@ do echo "$app ya instalada" fi done +#"ntp" -#apt-get install gpsd -y ######################################################################################################################### # 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="ttyACM0" +#EOF cat > /etc/default/gpsd <<- "EOF" START_DAEMON="true" USBAUTO="true" DEVICES="/dev/ttyACM0" -GPSD_SOCKET="/var/run/gpsd.sock" GPSD_OPTIONS="-n" +GPSD_SOCKET="/var/run/gpsd.sock" EOF -#GPSD_SOCKET="/var/run/gpsd.sock" +sudo ln -sf /lib/systemd/system/gpsd.service /etc/systemd/system/multi-user.target.wants/ + sudo systemctl stop gpsd cat > /lib/systemd/system/gpsd.service <<- "EOFG" [Unit] @@ -88,20 +83,20 @@ Also=gpsd.socket EOFG sudo systemctl daemon-reload -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") +#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 +#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 ######################################################################################################################### # direwolf