diff options
-rw-r--r-- | sysutils/clockspeed/Makefile | 32 | ||||
-rw-r--r-- | sysutils/clockspeed/files/clockspeed.sh.sample | 16 | ||||
-rw-r--r-- | sysutils/clockspeed/files/patch-ad | 2 | ||||
-rw-r--r-- | sysutils/clockspeed/files/patch-leapsecs_read.c | 11 | ||||
-rw-r--r-- | sysutils/clockspeed/pkg-message | 45 | ||||
-rw-r--r-- | sysutils/clockspeed/pkg-plist | 6 |
6 files changed, 105 insertions, 7 deletions
diff --git a/sysutils/clockspeed/Makefile b/sysutils/clockspeed/Makefile index c11ccdadfb2e..93112259f424 100644 --- a/sysutils/clockspeed/Makefile +++ b/sysutils/clockspeed/Makefile @@ -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} diff --git a/sysutils/clockspeed/files/clockspeed.sh.sample b/sysutils/clockspeed/files/clockspeed.sh.sample new file mode 100644 index 000000000000..c74fd1b8b622 --- /dev/null +++ b/sysutils/clockspeed/files/clockspeed.sh.sample @@ -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 diff --git a/sysutils/clockspeed/files/patch-ad b/sysutils/clockspeed/files/patch-ad index 52cd9386d83b..390e0d794dda 100644 --- a/sysutils/clockspeed/files/patch-ad +++ b/sysutils/clockspeed/files/patch-ad @@ -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. diff --git a/sysutils/clockspeed/files/patch-leapsecs_read.c b/sysutils/clockspeed/files/patch-leapsecs_read.c new file mode 100644 index 000000000000..b05ea4f8375e --- /dev/null +++ b/sysutils/clockspeed/files/patch-leapsecs_read.c @@ -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); diff --git a/sysutils/clockspeed/pkg-message b/sysutils/clockspeed/pkg-message new file mode 100644 index 000000000000..5a6f932bf952 --- /dev/null +++ b/sysutils/clockspeed/pkg-message @@ -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. diff --git a/sysutils/clockspeed/pkg-plist b/sysutils/clockspeed/pkg-plist index 00df5283921f..75ff0637ee1f 100644 --- a/sysutils/clockspeed/pkg-plist +++ b/sysutils/clockspeed/pkg-plist @@ -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 |