Compare commits

..

1 commit

Author SHA1 Message Date
Tom "spot" Callaway
8827523200 convert to systemd 2011-09-15 14:56:35 -04:00
7 changed files with 192 additions and 1 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
shmpps.tar

View file

@ -1 +0,0 @@
2014-06-04 - This package was already retired in pkgdb/blocked in koji, but no dead.package file existed. The original retirement reason is unclear.

65
shmpps.init Normal file
View file

@ -0,0 +1,65 @@
#!/bin/sh
#
# shmpps This shell script takes care of starting and stopping
# the shared memory PPS driver.
#
# chkconfig: - 58 74
# description: shm_splc2 is the shared memory PPS driver for NTP
# Source function library
. /etc/init.d/functions
prog=shm_splc2
lockfile=/var/lock/subsys/$prog
start() {
[ -x /usr/sbin/shm_splc2 ] || exit 5
[ -f /etc/sysconfig/shmpps ] || exit 6
. /etc/sysconfig/shmpps
echo -n $"Starting $prog: "
daemon $prog $OPTIONS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $lockfile
return $RETVAL
}
stop() {
echo -n $"Shutting down $prog: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $lockfile
return $RETVAL
}
# See how we were called
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $prog
;;
restart|force-reload)
stop
start
;;
try-restart|condrestart)
if [ -f $lockfile ]; then
stop
start
fi
;;
reload)
exit 3
;;
*)
echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
exit 2
esac

13
shmpps.service Normal file
View file

@ -0,0 +1,13 @@
[Unit]
Description=PPS Shared Memory Driver For NTP
After=syslog.target
Before=ntpd.service
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/shmpps
ExecStart=/usr/sbin/shm_splc2 $OPTIONS
[Install]
WantedBy=multi-user.target

86
shmpps.spec Normal file
View file

@ -0,0 +1,86 @@
Name: shmpps
Version: 1.03
Release: 3%{?dist}
Summary: Shared Memory driver for PPS time signals
Group: System Environment/Daemons
License: Public Domain and MIT
URL: http://time.qnan.org/
Source0: http://time.qnan.org/%{name}.tar
Source1: shmpps.service
Source2: shmpps.sysconfig
Requires: ntp
BuildRequires: systemd-units
Requires(post): systemd-sysv
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%description
Shared memory (SHM) driver to allow high-resolution pulse-per-second
(PPS) time sources to be used with a Network Time Protocol (NTP) server
without a PPS-enabled kernel. The PPS pin of the time source must be
connected to the declared signal pin on a serial or parallel port.
See /etc/sysconfig/shmpps for configuration.
%prep
%setup -q -n %{name}
sed -i \
-e 's/#undef *DOPARALLEL/#define DOPARALLEL/' \
shm_splc2.c
%build
make CFLAGS="%{optflags}" LDFLAGS=""
%install
install -p -m755 -D shm_splc2 %{buildroot}%{_sbindir}/shm_splc2
install -p -m644 -D %{SOURCE1} %{buildroot}%{_unitdir}/shmpps.service
install -p -m644 -D %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/shmpps
%post
if [ $1 -eq 1 ] ; then
# Initial installation
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%preun
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/bin/systemctl --no-reload disable shmpps.service > /dev/null 2>&1 || :
/bin/systemctl stop shmpps.service > /dev/null 2>&1 || :
fi
%postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/bin/systemctl try-restart shmpps.service >/dev/null 2>&1 || :
fi
%triggerun -- shmpps < 1.03-3
# Save the current service runlevel info
# User must manually run systemd-sysv-convert --apply shmpps
# to migrate them to systemd targets
/usr/bin/systemd-sysv-convert --save shmpps >/dev/null 2>&1 ||:
# Run these because the SysV package being removed won't do them
/sbin/chkconfig --del shmpps >/dev/null 2>&1 || :
/bin/systemctl try-restart shmpps.service >/dev/null 2>&1 || :
%files
%{_sbindir}/shm_splc2
%{_unitdir}/shmpps.service
%config(noreplace) %{_sysconfdir}/sysconfig/shmpps
%changelog
* Thu Sep 15 2011 Tom Callaway <spot@fedoraproject.org> - 1.03-3
- convert to systemd
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.03-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Sat Nov 22 2008 Chris Adams <linux@cmadams.net> 1.03-1
- initial package

26
shmpps.sysconfig Normal file
View file

@ -0,0 +1,26 @@
########################################################################
# Usage:
# shm -d/dev/device -s (serial) or -p (parallel) -u (unit)
# -c -l (line) -f -D
#
# -c sets second boundary on hi->lo transition for serial
# -l line defines serial line being sampled: DCD CTS DSR
# -f sets pin 14 flapping on parallel i/f
#
# -D debug level, may be repeated:
# No. of -D
# 0 normal operation: daemonize; no reporting
# 1 + no daemonization; progress reports to stderr
# 2 + out-of-range reports
# 3 + no updating SHM
#
# (wire PPS to parallel pin 10, ground to 18, echo out to 14)
#
# Configure ntpd to use this as a time source in ntp.conf like:
# server 127.127.28.3 minpoll 4 maxpoll 4 prefer
# fudge 127.127.28.3 refid GPS
########################################################################
# For serial DCD
OPTIONS="-d /dev/gps0 -s -u 0 -l DCD"
# For parallel
#OPTIONS="-d /dev/parport0 -p -u 0 -l DCD"

1
sources Normal file
View file

@ -0,0 +1 @@
a55d2a3c51c7810cfd3e2adb08f55d02 shmpps.tar