2019-09-12 06:56:45 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2019-10-14 12:39:19 -05:00
|
|
|
#script to install GPS Dongle for Raspberry Pi
|
2019-09-12 06:56:45 -05:00
|
|
|
#km4ack 20190911
|
2019-10-14 12:38:00 -05:00
|
|
|
#Last Edit km4ack 20191014
|
|
|
|
|
|
|
|
|
|
#check if running as root
|
|
|
|
|
IAM=$(whoami)
|
|
|
|
|
if [ $IAM = "root" ]
|
|
|
|
|
then
|
|
|
|
|
echo
|
|
|
|
|
else
|
|
|
|
|
echo "Please run this script as root"
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
2019-09-12 08:03:57 -05:00
|
|
|
|
2019-09-20 18:47:57 -05:00
|
|
|
#install needed packages
|
2019-09-12 06:56:45 -05:00
|
|
|
echo "installing a few needed packages"
|
2019-12-27 09:56:54 -06:00
|
|
|
apt-get install -y gpsd gpsd-clients python-gps chrony python-gi-cairo
|
2019-09-12 06:56:45 -05:00
|
|
|
|
|
|
|
|
#backup gpsd file
|
2019-09-12 07:06:40 -05:00
|
|
|
mv /etc/default/gpsd /etc/default/gpsd.org
|
2019-09-12 06:56:45 -05:00
|
|
|
|
|
|
|
|
#download gpsd file
|
2019-09-20 18:47:57 -05:00
|
|
|
wget https://raw.githubusercontent.com/km4ack/pi-scripts/master/gpsd -P /etc/default/
|
2019-09-12 06:56:45 -05:00
|
|
|
|
2019-09-12 07:06:40 -05:00
|
|
|
echo "refclock SHM 0 offset 0.5 delay 0.2 refid NMEA" >> /etc/chrony/chrony.conf
|
2019-09-12 06:56:45 -05:00
|
|
|
|
2020-09-24 13:22:29 -05:00
|
|
|
#line below added per this issue - https://github.com/km4ack/pi-build/issues/146
|
|
|
|
|
#24SEPT2020
|
|
|
|
|
ln -s /lib/systemd/system/gpsd.service /etc/systemd/system/multi-user.target.wants/
|
|
|
|
|
|
2019-10-11 15:37:09 -05:00
|
|
|
echo "";echo "";echo ""
|
|
|
|
|
echo "#############################################################################################"
|
|
|
|
|
echo "#instructions at https://raw.githubusercontent.com/km4ack/pi-scripts/master/gps-instruction #"
|
|
|
|
|
echo "#############################################################################################"
|
2019-09-12 06:56:45 -05:00
|
|
|
echo "Reboot is needed to complete"
|
2019-12-11 07:25:46 -06:00
|
|
|
#echo "Would you like to reboot now? y/n"
|
|
|
|
|
#read ANSW
|
|
|
|
|
|
|
|
|
|
#if [ $ANSW = "y" ]
|
|
|
|
|
#then
|
|
|
|
|
#reboot
|
|
|
|
|
#else
|
|
|
|
|
#echo "GPS won't work until reboot"
|
|
|
|
|
#exit 0
|
|
|
|
|
#fi
|
2019-09-12 09:20:39 -05:00
|
|
|
|