Skip to content

Instantly share code, notes, and snippets.

@RezhaBlue
Last active January 20, 2019 20:11
Show Gist options
  • Save RezhaBlue/3f782e34b7bc9902f08fd714946d3fcc to your computer and use it in GitHub Desktop.
Save RezhaBlue/3f782e34b7bc9902f08fd714946d3fcc to your computer and use it in GitHub Desktop.
# setup time on the rpi for first time
sudo /etc/init.d/ntp stop
sudo ntpd -q -g
sudo /etc/init.d/ntp start
sudo timedatectl set-ntp true
sudo timedatectl set-local-rtc 0
# setup sleepypi
wget https://raw.githubusercontent.com/SpellFoundry/Sleepy-Pi-Setup/master/Sleepy-Pi-Setup.sh
chmod +x Sleepy-Pi-Setup.sh
sudo ./Sleepy-Pi-Setup.sh
sed -ir '/#(dtparam=i2c_arm=on)/$1/' /boot/config.txt
#install i2c-tools
sudo apt-get install i2c-tools
systemctl restart systemd-udevd
i2cdetect -y 1
# Tell RPI about the RTC
if grep -q "pcf8523" /boot/config.txt; then
echo "RPI already knows about RTC"
else
sudo echo "dtoverlay=i2c-rtc,pcf8523" >> /boot/config.txt
fi
# configure hw-clock
## comment out systemd portion and updating from rtc to rpi
sed -ie '/systemd/,+2 s/^/#/' -e '/systz/,s/^/#/g' /lib/udev/hwclock-set
# disable ntp
sudo systemctl stop ntp.service
sudo systemctl disable ntp.service
# disable fakehw clock
sudo systemctl stop fake-hwclock.service
sudo systemctl disable fake-hwclock.service
# stop and disable timesync
sudo systemctl stop systemd-timesyncd.service
sudo systemctl disable systemd-timesyncd.service
# ta-dah!
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment