New package: clockspeed-0.62
clockspeed: remove unused template variable clockspeed: make arch-specific for x86/x86_64 * Add NOTES about what the package contains * Add README and INSTALL to docs clockspeed: depend on sv-helper for supervision
This commit is contained in:
parent
22cff7dbd9
commit
3299466d7e
14 changed files with 238 additions and 0 deletions
8
srcpkgs/clockspeed/files/NOTES
Normal file
8
srcpkgs/clockspeed/files/NOTES
Normal file
|
@ -0,0 +1,8 @@
|
|||
This clockspeed package includes two services, /etc/sv/clockspeed and
|
||||
/etc/sv/clockspeed_adjust, which implement the methodology described
|
||||
at http://thedjbway.b0llix.net.
|
||||
|
||||
SEE ALSO:
|
||||
http://thedjbway.b0llix.net/clockspeed.html
|
||||
http://thedjbway.b0llix.net/clocksd.html
|
||||
|
69
srcpkgs/clockspeed/files/clockctl
Executable file
69
srcpkgs/clockspeed/files/clockctl
Executable file
|
@ -0,0 +1,69 @@
|
|||
#!/bin/sh
|
||||
# clockctl
|
||||
# interface to djb clockspeed (0.62)
|
||||
# ===
|
||||
# from http://thedjbway.b0llix.net/clockspeed/clockctl.html
|
||||
|
||||
# read configuration:
|
||||
if [ -r /etc/clockspeed/clockspeed.conf ] ; then
|
||||
. /etc/clockspeed/clockspeed.conf
|
||||
else
|
||||
echo "$0: configuration error: unable to read clockspeed.conf"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# clock_pick function:
|
||||
clock_pick()
|
||||
{
|
||||
case ${CLOCK_TYPE} in
|
||||
ntp|NTP)
|
||||
${CLOCKSPEED_BIN}/sntpclock "${CLOCK_IP}"
|
||||
;;
|
||||
tai|TAI)
|
||||
${CLOCKSPEED_BIN}/taiclock "${CLOCK_IP}"
|
||||
;;
|
||||
*)
|
||||
echo "$0: configuration error: CLOCK_TYPE not recognized"
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
# process command:
|
||||
case $1 in
|
||||
a|atto)
|
||||
echo "Viewing current attoseconds in hardware tick:"
|
||||
${CLOCKSPEED_BIN}/clockview < ${CLOCKSPEED_HOME}/etc/atto
|
||||
;;
|
||||
m|mark)
|
||||
echo "Obtaining new calibration mark from master server at ${CLOCK_IP}:"
|
||||
clock_pick | tee ${CLOCKSPEED_HOME}/adjust | ${CLOCKSPEED_BIN}/clockview
|
||||
;;
|
||||
s|sync)
|
||||
echo "Setting system clock with master server at ${CLOCK_IP}:"
|
||||
clock_pick | ${CLOCKSPEED_BIN}/clockadd && \
|
||||
clock_pick | ${CLOCKSPEED_BIN}/clockview
|
||||
;;
|
||||
v|view)
|
||||
echo "Checking system clock against master server at ${CLOCK_IP} (clockview):"
|
||||
clock_pick | ${CLOCKSPEED_BIN}/clockview
|
||||
;;
|
||||
h|help)
|
||||
cat <<END_HELP
|
||||
clockspeed control:
|
||||
atto -- inspect current "attoseconds"
|
||||
mark -- obtain new calibration mark for clockspeed
|
||||
sync -- set the system clock with master time server
|
||||
view -- check system clock against master time server
|
||||
help -- this screen
|
||||
END_HELP
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 [ a|atto | m|mark | s|sync | v|view | h|help ]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
16
srcpkgs/clockspeed/files/clockspeed.conf
Normal file
16
srcpkgs/clockspeed/files/clockspeed.conf
Normal file
|
@ -0,0 +1,16 @@
|
|||
# /usr/local/etc/clockspeed.conf
|
||||
# configuration support for djb clockspeed (0.62)
|
||||
# ===
|
||||
## CLOCKSPEED_HOME=/path/to/clockspeed
|
||||
CLOCKSPEED_HOME="/var/lib/clockspeed"
|
||||
|
||||
## CLOCKSPEED_BIN=/path/to/clockspeed/bin
|
||||
CLOCKSPEED_BIN="/usr/bin"
|
||||
|
||||
## CLOCK_TYPE 'ntp' | 'tai'
|
||||
CLOCK_TYPE="ntp"
|
||||
|
||||
## CLOCK_IP="1.2.3.4"
|
||||
CLOCK_IP="104.232.3.3"
|
||||
|
||||
### that's all, folks!
|
2
srcpkgs/clockspeed/files/clockspeed/finish
Executable file
2
srcpkgs/clockspeed/files/clockspeed/finish
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
sv s clockspeed_adjust && sv t clockspeed_adjust || /bin/true
|
1
srcpkgs/clockspeed/files/clockspeed/log/run
Symbolic link
1
srcpkgs/clockspeed/files/clockspeed/log/run
Symbolic link
|
@ -0,0 +1 @@
|
|||
/usr/bin/rsvlog
|
7
srcpkgs/clockspeed/files/clockspeed/run
Executable file
7
srcpkgs/clockspeed/files/clockspeed/run
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
# clockspeed/run
|
||||
# "run" script for a clockspeed daemon
|
||||
exec 2>&1
|
||||
[ -d /var/lib/clockspeed/etc ] || mkdir -p /var/lib/clockspeed/etc
|
||||
echo "*** Starting clockspeed..."
|
||||
exec /usr/bin/clockspeed
|
26
srcpkgs/clockspeed/files/clockspeed_adjust/clock_adjust.sh
Executable file
26
srcpkgs/clockspeed/files/clockspeed_adjust/clock_adjust.sh
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
# from http://thedjbway.b0llix.net/clocksd/index.html
|
||||
#
|
||||
# clock_adjust.sh
|
||||
# periodically get timing mark for clockspeed service
|
||||
|
||||
# initialize WAIT, WAIT_MAX:
|
||||
WAIT=541
|
||||
WAIT_MAX=2617923
|
||||
|
||||
# loop indefinitely
|
||||
while :
|
||||
do
|
||||
# obtain timing mark for calibrating clockspeed adjust:
|
||||
clockctl mark
|
||||
# log current "attoseconds":
|
||||
clockctl atto
|
||||
echo "==="
|
||||
echo "Waiting ${WAIT} seconds until next adjustment..."
|
||||
sleep ${WAIT}
|
||||
# increment $WAIT:
|
||||
WAIT=`expr ${WAIT} + ${WAIT} + ${WAIT}`
|
||||
if [ ${WAIT} -gt ${WAIT_MAX} ] ; then
|
||||
WAIT=${WAIT_MAX}
|
||||
fi
|
||||
done
|
1
srcpkgs/clockspeed/files/clockspeed_adjust/log/run
Symbolic link
1
srcpkgs/clockspeed/files/clockspeed_adjust/log/run
Symbolic link
|
@ -0,0 +1 @@
|
|||
/usr/bin/rsvlog
|
9
srcpkgs/clockspeed/files/clockspeed_adjust/run
Executable file
9
srcpkgs/clockspeed/files/clockspeed_adjust/run
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh -e
|
||||
# clockspeed_adjust/run
|
||||
# "run" script for a clockspeed_adjust daemon
|
||||
echo "*** Checking for clockspeed daemon..."
|
||||
sv -w5 u clockspeed
|
||||
exec 2>&1
|
||||
echo "*** Starting clockspeed_adjust..."
|
||||
chown clocksd /var/lib/clockspeed/adjust
|
||||
exec chpst -u clocksd:nogroup ./clock_adjust.sh
|
1
srcpkgs/clockspeed/files/taiclockd/log/run
Symbolic link
1
srcpkgs/clockspeed/files/taiclockd/log/run
Symbolic link
|
@ -0,0 +1 @@
|
|||
/usr/bin/rsvlog
|
6
srcpkgs/clockspeed/files/taiclockd/run
Normal file
6
srcpkgs/clockspeed/files/taiclockd/run
Normal file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/sh
|
||||
# taiclockd/run
|
||||
# "run" script for a taiclockd daemon
|
||||
exec 2>&1
|
||||
echo "*** Starting taiclockd..."
|
||||
exec chpst -u clocksd:nogroup /usr/bin/taiclockd
|
16
srcpkgs/clockspeed/patches/clockspeed-0.62.cross.patch
Normal file
16
srcpkgs/clockspeed/patches/clockspeed-0.62.cross.patch
Normal file
|
@ -0,0 +1,16 @@
|
|||
diff -Naur clockspeed-0.62.orig/conf-cc clockspeed-0.62/conf-cc
|
||||
--- clockspeed-0.62.orig/conf-cc 1998-10-13 12:37:49.000000000 -0500
|
||||
+++ clockspeed-0.62/conf-cc 2015-02-25 13:38:10.932118897 -0600
|
||||
@@ -1,3 +1,3 @@
|
||||
-gcc -O2
|
||||
+$CC -O2
|
||||
|
||||
This will be used to compile .c files.
|
||||
diff -Naur clockspeed-0.62.orig/conf-ld clockspeed-0.62/conf-ld
|
||||
--- clockspeed-0.62.orig/conf-ld 1998-10-13 12:37:49.000000000 -0500
|
||||
+++ clockspeed-0.62/conf-ld 2015-02-25 13:40:43.579122985 -0600
|
||||
@@ -1,3 +1,3 @@
|
||||
-gcc -s
|
||||
+$CC -s $LDFLAGS
|
||||
|
||||
This will be used to link .o files into an executable.
|
33
srcpkgs/clockspeed/patches/clockspeed-0.62.errno.patch
Normal file
33
srcpkgs/clockspeed/patches/clockspeed-0.62.errno.patch
Normal file
|
@ -0,0 +1,33 @@
|
|||
diff -u clockspeed-0.62.old/clockview.c clockspeed-0.62/clockview.c
|
||||
--- clockspeed-0.62.old/clockview.c 1998-10-13 12:37:49.000000000 -0500
|
||||
+++ clockspeed-0.62/clockview.c 2003-05-08 09:59:26.000000000 -0500
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
+#include <time.h>
|
||||
#include "substdio.h"
|
||||
#include "readwrite.h"
|
||||
#include "strerr.h"
|
||||
diff -u clockspeed-0.62.old/error.h clockspeed-0.62/error.h
|
||||
--- clockspeed-0.62.old/error.h 1998-10-13 12:37:49.000000000 -0500
|
||||
+++ clockspeed-0.62/error.h 2003-05-08 09:07:13.000000000 -0500
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef ERROR_H
|
||||
#define ERROR_H
|
||||
|
||||
-extern int errno;
|
||||
+#include <errno.h>
|
||||
|
||||
extern int error_intr;
|
||||
extern int error_nomem;
|
||||
diff -u clockspeed-0.62.old/leapsecs_read.c clockspeed-0.62/leapsecs_read.c
|
||||
--- clockspeed-0.62.old/leapsecs_read.c 1998-10-13 12:37:49.000000000 -0500
|
||||
+++ clockspeed-0.62/leapsecs_read.c 2003-05-08 09:07:13.000000000 -0500
|
||||
@@ -2,7 +2,6 @@
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
-extern int errno;
|
||||
#include "tai.h"
|
||||
#include "leapsecs.h"
|
||||
|
43
srcpkgs/clockspeed/template
Normal file
43
srcpkgs/clockspeed/template
Normal file
|
@ -0,0 +1,43 @@
|
|||
# Template file for 'clockspeed'
|
||||
pkgname="clockspeed"
|
||||
version="0.62"
|
||||
revision=1
|
||||
build_style="gnu-makefile"
|
||||
makedepends="groff"
|
||||
hostmakedepends="groff"
|
||||
depends="sv-helper"
|
||||
only_for_archs="i686 x86_64"
|
||||
make_dirs="/etc/clockspeed 0755 root root"
|
||||
short_desc="Dan Bernstein's clockspeed (network) timekeeping utility"
|
||||
maintainer="bougyman <tj@rubyists.com>"
|
||||
license="Public Domain"
|
||||
homepage="http://cr.yp.to/clockspeed.html"
|
||||
distfiles="http://cr.yp.to/clockspeed/clockspeed-0.62.tar.gz "
|
||||
checksum=43539964c4b554794b2da760d138c5975cbc850f1c8ec2ee96f5dba66e0d9eed
|
||||
|
||||
system_accounts="clocksd"
|
||||
clocksd_groups="nogroup"
|
||||
clocksd_homedir="/var/lib/${pkgname}"
|
||||
clocksd_descr="User for clockspeed adjustments"
|
||||
conf_files="/etc/${pkgname}/${pkgname}.conf"
|
||||
patch_args="-p1"
|
||||
|
||||
pre_build() {
|
||||
sed -i -e 's|/usr/local/clockspeed|/var/lib/clockspeed|' conf-home
|
||||
}
|
||||
|
||||
do_install() {
|
||||
for binary in clockadd clockspeed clockview sntpclock taiclock taiclockd;
|
||||
do
|
||||
vbin $binary
|
||||
done
|
||||
vbin ${FILESDIR}/clockctl
|
||||
vconf leapsecs.dat
|
||||
vmkdir etc/clockspeed
|
||||
vinstall ${FILESDIR}/clockspeed.conf 644 etc/clockspeed
|
||||
vsv clockspeed
|
||||
vsv clockspeed_adjust
|
||||
vdoc README
|
||||
vdoc INSTALL
|
||||
vdoc ${FILESDIR}/NOTES
|
||||
}
|
Loading…
Reference in a new issue