#!/bin/bash
#
# Install script to run on the Yeti
#
echo 'Building linuxptp'
tar -xvzf linuxptp-1.8.tgz
cd linuxptp-1.8
# there is a large clock discrepancy on the yeti at bootup so make will not run
# This changes the timestamp on all the files to the yeti time so that make 
# doesn't complain
touch *
make
make install
cd ..
echo 'Done building linuxptp'
cp ptp4l.service /lib/systemd/system/
#cp phc2sys.service /lib/systemd/system/
mkdir -p /etc/linuxptp/
cp ptp4l.conf /etc/linuxptp/

systemctl enable ptp4l.service
systemctl start ptp4l.service

# Right now I don't think phc2sys is necessary, but it's included here in case
# it needs to be enabled in the future
#systemctl enable phc2sys.service
