initial import (#859193)

This commit is contained in:
Miroslav Lichvar 2012-09-21 15:54:54 +02:00
parent d2e1273af0
commit 1d19672cbe
5 changed files with 125 additions and 0 deletions

1
.gitignore vendored
View File

@ -0,0 +1 @@
/linuxptp-20120920git6ce135.tar.gz

100
linuxptp.spec Normal file
View File

@ -0,0 +1,100 @@
%global gitdate 20120920
%global gitrev 6ce135
Name: linuxptp
Version: 0
Release: 0.2.%{gitdate}git%{gitrev}%{?dist}
Summary: PTP implementation for Linux
Group: System Environment/Base
License: GPLv2+
URL: http://linuxptp.sourceforge.net/
# git clone git://git.code.sf.net/p/linuxptp/code linuxptp; cd linuxptp
# git archive --prefix=linuxptp/ %{gitrev} | gzip > linuxptp-%{gitdate}git%{gitrev}.tar.gz
Source0: %{name}-%{gitdate}git%{gitrev}.tar.gz
Source1: phc2sys.service
Source2: ptp4l.service
BuildRequires: systemd-units
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%description
This software is an implementation of the Precision Time Protocol (PTP)
according to IEEE standard 1588 for Linux. The dual design goals are to provide
a robust implementation of the standard and to use the most relevant and modern
Application Programming Interfaces (API) offered by the Linux kernel.
Supporting legacy APIs and other platforms is not a goal.
%prep
%setup -q -n %{name}
# Comment everything out.
sed 's/^[[:alnum:]]/#\0/' < default.cfg > ptp4l.conf
%build
make %{?_smp_mflags} \
INC="" \
EXTRA_CFLAGS="$RPM_OPT_FLAGS -pie -fpie" \
EXTRA_LDFLAGS="-Wl,-z,relro,-z,now"
%install
mkdir -p $RPM_BUILD_ROOT{%{_sysconfdir}/sysconfig,%{_sbindir},%{_unitdir}}
install -m 644 -p ptp4l.conf $RPM_BUILD_ROOT%{_sysconfdir}
install -m 755 -t $RPM_BUILD_ROOT%{_sbindir} ptp4l pmc phc2sys hwstamp_ctl
install -m 644 -p -t $RPM_BUILD_ROOT%{_unitdir} %{SOURCE1} %{SOURCE2}
echo 'OPTIONS="-f /etc/ptp4l.conf -i eth0"' > \
$RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ptp4l
echo 'OPTIONS="-d /dev/pps0"' > $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/phc2sys
%post
%if 0%{?systemd_post:1}
%systemd_post ptp4l.service phc2sys.service
%else
/bin/systemctl daemon-reload &> /dev/null || :
%endif
%preun
%if 0%{?systemd_preun:1}
%systemd_preun phc2sys.service ptp4l.service
%else
if [ "$1" -eq 0 ]; then
/bin/systemctl --no-reload disable \
phc2sys.service ptp4l.service &> /dev/null
/bin/systemctl stop phc2sys.service ptp4l.service &> /dev/null
fi
:
%endif
%postun
%if 0%{?systemd_postun_with_restart:1}
%systemd_postun_with_restart ptp4l.service phc2sys.service
%else
/bin/systemctl daemon-reload &> /dev/null
if [ "$1" -ge 1 ]; then
/bin/systemctl try-restart ptp4l.service phc2sys.service &> /dev/null
fi
:
%endif
%files
%doc COPYING README.org default.cfg gPTP.cfg
%config(noreplace) %{_sysconfdir}/ptp4l.conf
%config(noreplace) %{_sysconfdir}/sysconfig/phc2sys
%config(noreplace) %{_sysconfdir}/sysconfig/ptp4l
%{_unitdir}/phc2sys.service
%{_unitdir}/ptp4l.service
%{_sbindir}/hwstamp_ctl
%{_sbindir}/phc2sys
%{_sbindir}/pmc
%{_sbindir}/ptp4l
%changelog
* Fri Sep 21 2012 Miroslav Lichvar <mlichvar@redhat.com> 0-0.2.20120920git6ce135
- fix issues found in package review (#859193)
* Thu Sep 20 2012 Miroslav Lichvar <mlichvar@redhat.com> 0-0.1.20120920git6ce135
- initial release

13
phc2sys.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=Synchronize system clock to PTP hardware clock (PHC)
After=ntpdate.service
Conflicts=ntpd.service chronyd.service
[Service]
Type=simple
EnvironmentFile=-/etc/sysconfig/phc2sys
ExecStart=/usr/sbin/phc2sys $OPTIONS
StandardOutput=null
[Install]
WantedBy=multi-user.target

10
ptp4l.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Precision Time Protocol (PTP) service
[Service]
Type=simple
EnvironmentFile=-/etc/sysconfig/ptp4l
ExecStart=/usr/sbin/ptp4l $OPTIONS
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1 @@
9bc4ce7ee5df1a11d916d90caef59baa linuxptp-20120920git6ce135.tar.gz