Compare commits
4 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd21d63c33 | ||
|
|
fe671c1553 | ||
|
|
9628eb52ce | ||
|
|
d19affdf37 |
7 changed files with 161 additions and 21 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
shmpps.tar
|
||||
21
Makefile
21
Makefile
|
|
@ -1,21 +0,0 @@
|
|||
# Makefile for source rpm: shmpps
|
||||
# $Id$
|
||||
NAME := shmpps
|
||||
SPECFILE = $(firstword $(wildcard *.spec))
|
||||
|
||||
define find-makefile-common
|
||||
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(find-makefile-common))
|
||||
|
||||
ifeq ($(MAKEFILE_COMMON),)
|
||||
# attept a checkout
|
||||
define checkout-makefile-common
|
||||
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
||||
endef
|
||||
|
||||
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
|
||||
endif
|
||||
|
||||
include $(MAKEFILE_COMMON)
|
||||
65
shmpps.init
Normal file
65
shmpps.init
Normal 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
|
||||
68
shmpps.spec
Normal file
68
shmpps.spec
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
Name: shmpps
|
||||
Version: 1.03
|
||||
Release: 1%{?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.init
|
||||
Source2: shmpps.sysconfig
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
Requires: ntp
|
||||
Requires(post): /sbin/chkconfig
|
||||
Requires(preun): /sbin/chkconfig /sbin/service
|
||||
Requires(postun): /sbin/service
|
||||
|
||||
%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
|
||||
rm -rf %{buildroot}
|
||||
install -p -m755 -D shm_splc2 %{buildroot}%{_sbindir}/shm_splc2
|
||||
install -p -m755 -D %{SOURCE1} %{buildroot}%{_initrddir}/shmpps
|
||||
install -p -m644 -D %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/shmpps
|
||||
|
||||
%clean
|
||||
rm -rf %{buildroot}
|
||||
|
||||
%post
|
||||
/sbin/chkconfig --add shmpps
|
||||
|
||||
%preun
|
||||
if [ "$1" -eq 0 ]; then
|
||||
/sbin/service shmpps stop > /dev/null 2>&1
|
||||
/sbin/chkconfig --del shmpps
|
||||
fi
|
||||
|
||||
%postun
|
||||
if [ "$1" -ge 1 ]; then
|
||||
/sbin/service shmpps condrestart > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%{_sbindir}/shm_splc2
|
||||
%{_initrddir}/shmpps
|
||||
%config(noreplace) %{_sysconfdir}/sysconfig/shmpps
|
||||
|
||||
%changelog
|
||||
* Sat Nov 22 2008 Chris Adams <linux@cmadams.net> 1.03-1
|
||||
- initial package
|
||||
|
||||
26
shmpps.sysconfig
Normal file
26
shmpps.sysconfig
Normal 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
1
sources
|
|
@ -0,0 +1 @@
|
|||
a55d2a3c51c7810cfd3e2adb08f55d02 shmpps.tar
|
||||
Loading…
Add table
Add a link
Reference in a new issue