1) Install leapsecs.dat (leapseconds support)

2) Add PKGMESSAGE with additional FreeBSD specific installation
   information
3) Install sample startup script
4) Bump PORTREVISION due to (1)

PR:		27617
Submitted by:	Vivek Khera <khera@kciLink.com>
This commit is contained in:
Mario Sergio Fujikawa Ferreira 2001-05-25 14:58:06 +00:00
parent 3ea6bb84f2
commit 69feeee703
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=43045
6 changed files with 105 additions and 7 deletions

View file

@ -7,7 +7,7 @@
PORTNAME= clockspeed
PORTVERSION= 0.62
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= sysutils
MASTER_SITES= http://cr.yp.to/clockspeed/ \
ftp://mirror.pipex.net/pub/qmail/ \
@ -23,19 +23,41 @@ INSTALL_TARGET= setup check
MAN1= clockadd.1 clockspeed.1 clockview.1 sntpclock.1 \
taiclock.1 taiclockd.1
PREFIX_FIX_FILES= ${WRKSRC}/leapsecs_read.c ${WRKSRC}/INSTALL
CLOCKSPEED_RC_SCRIPT_SAMPLE= ${FILESDIR}/clockspeed.sh.sample
RC_SCRIPT_STARTUP_DIR= ${PREFIX}/etc/rc.d
.include <bsd.port.pre.mk>
post-patch: real-post-patch
do-configure:
@${PERL} -pi -e "s|%%PREFIX%%|${PREFIX}|g" ${WRKSRC}/INSTALL
@${ECHO} ${CC} ${CFLAGS} > ${WRKSRC}/conf-cc
@${ECHO} ${CC} -s -L${LOCALBASE}/lib > ${WRKSRC}/conf-ld
@${ECHO} ${PREFIX} > ${WRKSRC}/conf-home
post-install:
post-install: real-post-install
.include <bsd.port.post.mk>
real-post-patch:
@${SED} "s!/usr/local/!${PREFIX}!" ${CLOCKSPEED_RC_SCRIPT_SAMPLE} > \
${WRKDIR}/${CLOCKSPEED_RC_SCRIPT_SAMPLE:T}
.for file in ${PREFIX_FIX_FILES}
@${PERL} -pi -ne "s|%%PREFIX%%|${PREFIX}|g" ${file}
.endfor
real-post-install:
.if !defined(NOPORTDOCS)
@${INSTALL} -d -o ${SHAREOWN} -g ${SHAREGRP} -m 755 \
${PREFIX}/share/doc/clockspeed
@${INSTALL_DATA} ${WRKSRC}/INSTALL ${PREFIX}/share/doc/clockspeed
@${INSTALL_DATA} ${PKGMESSAGE} \
${PREFIX}/share/doc/clockspeed/INSTALL-FreeBSD
.endif
@${INSTALL} -d -o ${SHAREOWN} -g ${SHAREGRP} -m 755 \
${PREFIX}/etc/clockspeed
.include <bsd.port.mk>
@${INSTALL_DATA} ${WRKSRC}/leapsecs.dat ${PREFIX}/etc/clockspeed
@${INSTALL_SCRIPT} ${WRKDIR}/${CLOCKSPEED_RC_SCRIPT_SAMPLE:T} \
${RC_SCRIPT_STARTUP_DIR}/${CLOCKSPEED_RC_SCRIPT_SAMPLE:T}
@${SED} s!/usr/local/!${PREFIX}/! ${PKGMESSAGE}

View file

@ -0,0 +1,16 @@
#!/bin/sh
PREFIX=/usr/local/
case "$1" in
start)
exec ${PREFIX}/bin/clockspeed &
exit 0
;;
stop)
;;
*)
echo "Usage: `basename $0` {start|stop}" >&2
exit 64
;;
esac

View file

@ -14,7 +14,7 @@
long or long long.
- 2. Install the programs, the man pages, and /etc/leapsecs.dat:
+ 2. Install the programs, the man pages, and %%PREFIX%%/etc/leapsecs.dat:
+ 2. Install the programs, the man pages, and %%PREFIX%%/etc/clockspeed/leapsecs.dat:
# make setup check
- Put /usr/local/clockspeed/bin into $PATH.
+ Put %%PREFIX%%/bin into $PATH.

View file

@ -0,0 +1,11 @@
--- leapsecs_read.c.orig Thu May 24 20:07:04 2001
+++ leapsecs_read.c Thu May 24 20:12:33 2001
@@ -18,7 +18,7 @@
int i;
struct tai u;
- fd = open("/etc/leapsecs.dat",O_RDONLY | O_NDELAY);
+ fd = open("%%PREFIX%%/etc/clockspeed/leapsecs.dat",O_RDONLY | O_NDELAY);
if (fd == -1) {
if (errno != ENOENT) return -1;
if (leapsecs) free(leapsecs);

View file

@ -0,0 +1,45 @@
ATTENTIONATTENTION:
Please make sure that you read /usr/local/share/doc/clockspeed/INSTALL.
It contains important information about testing and configuring
clockspeed, and finally installing it in your system.
Clockspeed uses the libtai library, check /usr/ports/devel/libtai
for more details. TAI time measure is off 22 seconds from UTC time
measure. Therefore, your system time will show a 22 secs difference
from your time source after you've installed this port.
To fix this, you could follow this simple recipe created with
PR ports/27617.
1) killall clockspeed (you can't have it running)
2) sntpclock IP.OF.NTP.SERVER | clockadd
3) enable/start clockspeed :
% cp /usr/local/etc/rc.d/clockspeed.sh.sample \
/usr/local/etc/rc.d/clockspeed.sh
# enable clockspeed to automagically start next
# time you reboot. do this after testing everything
% /usr/local/etc/rc.d/clockspeed.sh start
# start clockspeed now
4) sntpclock IP.OF.NTP.SERVER > /usr/local/etc/clockspeed/adjust
5) cd /usr/src/share/zoneinfo
6) make -DLEAPSECONDS clean all install ; make clean
Step 5 and 6 build support in your system for leapseconds handling.
Take a note about this since you might forget later to disable it
if you remove this port. To disable it, simply re-do step 6 without
-DLEAPSECONDS.
Step 6 should not break anything but you can disable it anytime
as per last paragraph if you think something unusual has happened
to your system.
7) /stand/sysinstall -> configure -> time zone (choose the correct
time zone for your system)
8) sntpclock IP.OF.NTP.SERVER | clockview
Check how close is your clock before and after now. Should be
within milliseconds.
Do not forget to add a cron(8) job with step 4 to periodically
adjust clockspeed's drift rate. Once a week should be more than
adequate.

View file

@ -5,10 +5,14 @@ bin/sntpclock
bin/taiclock
bin/taiclockd
%%PORTDOCS%%share/doc/clockspeed/INSTALL
%%PORTDOCS%%share/doc/clockspeed/INSTALL-FreeBSD
%%PORTDOCS%%@dirrm share/doc/clockspeed
@mode 0755
@exec mkdir %D/etc/clockspeed
etc/clockspeed/leapsecs.dat
@unexec if [ -f %D/etc/rc.d/clockspeed.sh ]; then cmp -s %D/etc/rc.d/clockspeed.sh.sample %D/etc/rc.d/clockspeed.sh && rm -f %D/etc/rc.d/clockspeed.sh || echo "If you are permanently removing this port, you should do a ``rm -f ${PKG_PREFIX}/etc/rc.d/clockspeed.sh`` to remove startup files left." | fmt ; fi
etc/rc.d/clockspeed.sh.sample
@unexec rm %D/etc/clockspeed/atto.tmp 2>/dev/null || true
@unexec rm %D/etc/clockspeed/atto 2>/dev/null || true
@unexec rm %D/etc/clockspeed/adjust 2>/dev/null || true
@unexec rmdir %D/etc/clockspeed 2>/dev/null || true
@unexec rmdir %D/etc/clockspeed 2>/dev/null || echo "If you are permanently removing this port, you should do a ``rm -Rf ${PKG_PREFIX}/etc/clockspeed`` to remove any configuration files left." | fmt