From 6dc455d5ad895ccae941fa6613a366a762f91bcf19ef7e0250e39ba6aa88f9cf Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Thu, 8 Mar 2018 13:37:26 +0000 Subject: [PATCH] - Generate default config during build OBS-URL: https://build.opensuse.org/package/show/network:time/ptpd?expand=0&rev=17 --- ptpd.changes | 5 ++++ ptpd.spec | 16 ++++++++----- ptpd2.conf | 68 ---------------------------------------------------- 3 files changed, 15 insertions(+), 74 deletions(-) delete mode 100644 ptpd2.conf diff --git a/ptpd.changes b/ptpd.changes index e57a718..133d0cc 100644 --- a/ptpd.changes +++ b/ptpd.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Thu Mar 8 13:30:11 UTC 2018 - mpluskal@suse.com + +- Generate default config during build + ------------------------------------------------------------------- Thu Jan 25 08:08:17 UTC 2018 - mpluskal@suse.com diff --git a/ptpd.spec b/ptpd.spec index 6054f1f..b6d40e9 100644 --- a/ptpd.spec +++ b/ptpd.spec @@ -29,7 +29,6 @@ Group: System/Daemons URL: https://github.com/ptpd/ptpd Source0: https://github.com/ptpd/ptpd/archive/ptpd-%{version}.tar.gz Source1: ptpd2.service -Source2: ptpd2.conf Source3: conf.sysconfig.ptpd # PATCH-FIX-UPSTREAM ptpd2-net-snmp_U64.patch gh#ptpd/ptpd#25 Patch0: ptpd2-net-snmp_U64.patch @@ -73,10 +72,14 @@ autoreconf -fiv %install %make_install -install -D -p -m 0644 %{SOURCE1} %{buildroot}/%{_unitdir}/%{name}2.service +install -Dpm 0644 %{SOURCE1} \ + %{buildroot}/%{_unitdir}/%{name}2.service ln -sv %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}2 -install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/%{name}2.conf -install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_fillupdir}/sysconfig.ptpd2 +# Generate default config +install -d %{buildroot}%{_sysconfdir} +./src/ptpd2 --default-config > %{buildroot}%{_sysconfdir}/%{name}2.conf +install -Dpm 0644 %{SOURCE3} \ + %{buildroot}%{_fillupdir}/sysconfig.ptpd2 # have to create the below, else ptpd will not log drift install -d %{buildroot}%{_localstatedir}/log touch %{buildroot}%{_localstatedir}/log/ptpd2_kernelclock.drift @@ -95,8 +98,9 @@ touch %{buildroot}%{_localstatedir}/log/ptpd2_kernelclock.drift %service_del_postun %{name}2.service %files -%doc COPYRIGHT ChangeLog README -%config %{_sysconfdir}/%{name}2.conf +%license COPYRIGHT +%doc ChangeLog README +%config(noreplace) %{_sysconfdir}/%{name}2.conf %{_sbindir}/ptpd2 %{_sbindir}/rcptpd2 %{_mandir}/man5/ptpd2.conf.5%{ext_man} diff --git a/ptpd2.conf b/ptpd2.conf deleted file mode 100644 index ea158ef..0000000 --- a/ptpd2.conf +++ /dev/null @@ -1,68 +0,0 @@ -; -============================================================================== -; This is a recommended configuration for a PTPv2 slave -; For a full list of options run ptpd2 -H or see the documentation and man -pages -; -============================================================================== - -; interface has to be specified -ptpengine:interface= - -; PTP domain -ptpengine:domain=0 - -; available presets are slaveonly, masteronly and masterslave (full IEEE -1588 implementation) -ptpengine:preset=slaveonly - -; multicast for both sync and delay requests - use hybrid for unicast delay -requests -ptpengine:ip_mode=multicast - -; when enabled, sniffing is used instead of sockets to send and receive -packets -ptpengine:use_libpcap=n - -; go into panic mode for 10 minutes instead of resetting the clock -ptpengine:panic_mode=y -ptpengine:panic_mode_duration=10 - -; uncomment this to enable outlier filters -ptpengine:sync_outlier_filter_enable=y -ptpengine:delay_outlier_filter_enable=y - -; store observed drift in a file -clock:drift_handling=file -clock:drift_file=/var/log/ptpd2_kernelclock.drift - -; update online statistics every 5 seconds -global:statistics_update_interval=5 - -; wait 5 statistics intervals for one-way delay to stabilise -ptpengine:calibration_delay=5 - -; log file, event log only. if timing statistics are needed, see -statistics_file -global:log_file=/var/log/ptpd2.log -; log file up to 5M -global:log_file_max_size=5000 -; rotate logs up to 5 files -global:log_file_max_files=5 - -; status file providing an overview of ptpd's operation and statistics -global:log_status=y - -; required if ip_mode is set to hybrid -;ptpengine:log_delayreq_interval=0 - -; uncomment this to log a timing log like in previous ptpd versions -;global:statistics_file=/var/log/ptpd2.stats - -; on multi-core systems it is recommended to bind ptpd to a single core -;global:cpuaffinity_cpucore=0 - -; use DSCP 46 for expedited forwarding over ipv4 networks -ptpengine:ip_dscp=46 - -; always keep a new line in the end