diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /net-misc/clockspeed |
reinit the tree, so we can have metadata
Diffstat (limited to 'net-misc/clockspeed')
-rw-r--r-- | net-misc/clockspeed/Manifest | 8 | ||||
-rw-r--r-- | net-misc/clockspeed/clockspeed-0.62-r6.ebuild | 45 | ||||
-rw-r--r-- | net-misc/clockspeed/files/clockspeed-0.62-gentoo.patch | 225 | ||||
-rw-r--r-- | net-misc/clockspeed/files/ntpclockset | 56 | ||||
-rw-r--r-- | net-misc/clockspeed/metadata.xml | 10 |
5 files changed, 344 insertions, 0 deletions
diff --git a/net-misc/clockspeed/Manifest b/net-misc/clockspeed/Manifest new file mode 100644 index 000000000000..a8e4fa028706 --- /dev/null +++ b/net-misc/clockspeed/Manifest @@ -0,0 +1,8 @@ +AUX clockspeed-0.62-gentoo.patch 6605 SHA256 0bbdf6c13257322468acf5485018bf8040e64fc14e2f8a60f5c622f4514af5c9 SHA512 83a7e8ff40a0b3871256b9e151dd99bda903c8e230698d753a535d336a2d95c8514e97133dfd271a69345f4b100fb608d621b46183f082ec6f62bbf4d24d784b WHIRLPOOL 2fb8fad657fbcb77e5884ec79ac1d806c5d73c91299fad4025140654f9b1eebaa42f6f306e427258c4420bb5e261ea3b361518e373a39f361a494dd9eb56872a +AUX ntpclockset 1100 SHA256 c3cb8901704ed41401e689dd2331a2581c1c1deb6847a8ee486a21975d61d46e SHA512 4301f84956df473aea2e13f304fc320897e680619a6933f5fe3b6fa229fc4e34dd6874bb6fa417c462f6eae2513ad7cccc843108331ee0a45fb19c7f0563dc6c WHIRLPOOL c374e655bda86daf0603311420eddad2f2ea9476586be24ed551d908b39a4e704d1dd03bda0d7b8b039072ea2d14d592cfc8f75b79cce49080d0f60ad1e95a66 +DIST clockspeed-0.62.tar.gz 25797 SHA256 43539964c4b554794b2da760d138c5975cbc850f1c8ec2ee96f5dba66e0d9eed SHA512 4dae1cfcfc5eb1398fd5a7642ff91987487d9828d314d4bd9f93cdadc60fe99889280a7f8e9192674ed19d246bd4a450ad32b1258e450216111c488074db7978 WHIRLPOOL 83ab5d7c4c7eb6c465e0e0c5c227a8eee911bdf9afdca444b5b161643ec10a8e92013560ec87d13e13770d05a2a3718fb3666644b481fd7597a9c5ed1ede0cf9 +DIST leapsecs.dat.20081114 192 SHA256 e1745c2571b5e3af38f60e1a6caf4cf02cdae103cfd52defa8dfa6d5b1fe0e22 SHA512 c85634ce30f40a03ae45983ee29483fe5859f291a0a69835dad1f50459327b212b8187a0c2c18c9a27fd74f2d69ed0d9a556349c8b2833b9a30107ed259aacc7 WHIRLPOOL e56db3fb4f30308ce7485b95bc89d2552def50fda49173661b6b16c7b55cdcee740585f21dcc620f9cb9b329cd0615e9f28445b7c40888efa032da0eca023a70 +EBUILD clockspeed-0.62-r6.ebuild 1179 SHA256 1a85dd5eca325fa08d374c763ddfed4f117a2f9100e79ac4c8855707814a4e93 SHA512 15440cd55706f54c578227c99cb1a9fffb5dcd1960e0600f0db6f6545d8f3a767a887c3c581649ee0b3c341e3acf84f112e5c8496a20802623b6138bd55d588c WHIRLPOOL 2f320920eea53e5353ad06c67d52f9682d9dae4fc6db0616abea9f1bfad2467eb89a41405e543d47f4a0debe24d92e07f3228694eb6763f5d6d948d8335f24c9 +MISC ChangeLog 2623 SHA256 a2bce4c4a12ecb19b1f194ebd1fd0a48c41350315c23ea1086559ff249fa8591 SHA512 a98f05d6f1a2c4916d50b2e4c20c74ee159f31402d8e261c5676c63d427a21a3e73deeb2c4d9b31e8782cf2bfae52c87e84f3ece5dea1c00fcff0aebdc8b9ac1 WHIRLPOOL 3f43faeefdfdb31a2688055dc9c79582dd26c57c3cc55090f672843a8fd42aff403c5b80d850b6c9f2741e309151a8114e26a8d85fad6b3e700fa53fe8e3c911 +MISC ChangeLog-2015 4515 SHA256 553596c1cbb47c713cfbbdaafdba9abf676b4a74c3e42e45daa1ed97331f5d40 SHA512 72d7c27418dadd70b272855e3302d8d4f09d4b9856fc261fea801791c11f4ddab7f7bf917b28304aca3ebe1a9a5355e9661cf4e1684d75dc9363afe12e773549 WHIRLPOOL 83959c77da15c845145e5216e9fc9d5ea62008fafc2e74ddf54d73a37462ea6fff4b94506f471fd6571aed8dbb78f9947c978f9862d0b1719e6b0d863b07d202 +MISC metadata.xml 416 SHA256 73104d23ffa4254cf5d909108df37a52d649a8b95d3b8ac306462348775a04d3 SHA512 966f4ad088720ae3da99158933a8344b9f17b7f251ae37562b99ee8cdc9e1fdbb0d530e42703208ed1373932037918e4657bd0663a42f3a3348505ccdcd39d69 WHIRLPOOL 306efb26b4d66250059e7bb7970377daa2babf8152786a32527b128c3eb6241f2ef147f273a62eb60d2da2f4ce23fa675f2cf07db37b4704cce099f8c54e5640 diff --git a/net-misc/clockspeed/clockspeed-0.62-r6.ebuild b/net-misc/clockspeed/clockspeed-0.62-r6.ebuild new file mode 100644 index 000000000000..172b3051b388 --- /dev/null +++ b/net-misc/clockspeed/clockspeed-0.62-r6.ebuild @@ -0,0 +1,45 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=4 +inherit eutils flag-o-matic + +DESCRIPTION="A simple Network Time Protocol (NTP) client" +HOMEPAGE="http://cr.yp.to/clockspeed.html" + +# this is the trailing part of the name for the latest leapseconds file. +LEAPSECONDS_DATE="20081114" + +SRC_URI="http://cr.yp.to/clockspeed/${P}.tar.gz + https://dev.gentoo.org/~pacho/maintainer-needed/leapsecs.dat."$LEAPSECONDS_DATE"" + +LICENSE="all-rights-reserved" +SLOT="0" +KEYWORDS="amd64 ~mips x86" +IUSE="static selinux" +RESTRICT="mirror bindist test" + +DEPEND="sys-apps/groff" +RDEPEND="selinux? ( sec-policy/selinux-clockspeed ) + net-dns/djbdns" + +src_prepare() { + epatch "${FILESDIR}"/${P}-gentoo.patch +} + +src_configure() { + echo "$(tc-getCC) ${CFLAGS} ${ASFLAGS}" > conf-cc + use static && append-ldflags -static + echo "$(tc-getCC) ${LDFLAGS}" > conf-ld +} + +src_install() { + dobin clockspeed clockadd clockview sntpclock taiclock taiclockd + dosbin "${FILESDIR}"/ntpclockset + + doman *.1 + dodoc BLURB CHANGES INSTALL README THANKS TODO + + insinto /var/lib/clockspeed + newins "${DISTDIR}"/leapsecs.dat."$LEAPSECONDS_DATE" leapsecs.dat +} diff --git a/net-misc/clockspeed/files/clockspeed-0.62-gentoo.patch b/net-misc/clockspeed/files/clockspeed-0.62-gentoo.patch new file mode 100644 index 000000000000..59c9dfcbf4ec --- /dev/null +++ b/net-misc/clockspeed/files/clockspeed-0.62-gentoo.patch @@ -0,0 +1,225 @@ +--- clockspeed-0.62/INSTALL ++++ clockspeed-0.62/INSTALL +@@ -4,8 +4,8 @@ + + Things you have to decide before starting: + +-* Where the clockspeed package will be installed, normally +-/usr/local/clockspeed. To change this directory, edit conf-home now. ++* Where the clockspeed package will be installed, normally /usr. ++To change this directory, edit conf-home now. + + + How to install: +@@ -16,9 +16,9 @@ + or with gethrtime(). The compiler must support a 64-bit type, either + long or long long. + +- 2. Install the programs, the man pages, and /etc/leapsecs.dat: ++ 2. Install the programs, the man pages, and /var/lib/clockspeed/leapsecs.dat: + # make setup check +- Put /usr/local/clockspeed/bin into $PATH. ++ Put /usr/bin into $PATH. + + + How to test: +@@ -39,20 +39,20 @@ + 5. Start clockspeed: + # clockspeed & + Give clockspeed a time measurement: +- # sntpclock 1.2.3.4 > /usr/local/clockspeed/adjust & ++ # sntpclock 1.2.3.4 > /var/lib/clockspeed/adjust & + + 6. After a few hours, give clockspeed a second time measurement: +- # sntpclock 1.2.3.4 > /usr/local/clockspeed/adjust & ++ # sntpclock 1.2.3.4 > /var/lib/clockspeed/adjust & + You can run sntpclock as a non-root user, if you change +- /usr/local/clockspeed/adjust to be owned by that user. I recommend ++ /var/lib/clockspeed/adjust to be owned by that user. I recommend + this for security. + + 7. After a few days, check how well clockspeed has adjusted your clock: + % sntpclock 1.2.3.4 | clockview + Check how many attoseconds clockspeed thinks are in one tick: +- % clockview < /usr/local/clockspeed/etc/atto ++ % clockview < /var/lib/clockspeed/atto + Give it another time measurement: +- # sntpclock 1.2.3.4 > /usr/local/clockspeed/adjust & ++ # sntpclock 1.2.3.4 > /var/lib/clockspeed/adjust & + + 8. Repeat step 7 after a few weeks, then after a few months. Your clock + should now be synchronized to the remote clock to within a few +@@ -70,7 +70,7 @@ + Here 5.6.7.8 is the master's IP address. Set the client's clock: + # clockadd < adjustment + Finally, run clockspeed as in step 5, and do +- % taiclock 5.6.7.8 > /usr/local/clockspeed/adjust & ++ % taiclock 5.6.7.8 > /var/lib/clockspeed/adjust & + after a few days. + + +--- clockspeed-0.62/Makefile ++++ clockspeed-0.62/Makefile +@@ -7,8 +7,8 @@ + auto-ccld.sh: \ + conf-cc conf-ld warn-auto.sh + ( cat warn-auto.sh; \ +- echo CC=\'`head -1 conf-cc`\'; \ +- echo LD=\'`head -1 conf-ld`\' \ ++ echo CC=\'`head -n 1 conf-cc`\'; \ ++ echo LD=\'`head -n 1 conf-ld`\' \ + ) > auto-ccld.sh + + auto-str: \ +@@ -21,7 +21,7 @@ + + auto_home.c: \ + auto-str conf-home +- ./auto-str auto_home `head -1 conf-home` > auto_home.c ++ ./auto-str auto_home `head -n 1 conf-home` > auto_home.c + + auto_home.o: \ + compile auto_home.c +--- clockspeed-0.62/clockspeed.1 ++++ clockspeed-0.62/clockspeed.1 +@@ -12,7 +12,7 @@ + + .B clockspeed + reads the real-time measurements from +-.BR /usr/local/clockspeed/adjust . ++.BR /var/lib/clockspeed/adjust . + Each real-time measurement must be a single 16-byte packet, + expressed as a TAI64NA time adjustment to the local UNIX clock. + +@@ -24,12 +24,12 @@ + .B clockspeed + can figure out the number of real attoseconds per tick. + It saves this number in TAI64NA format in +-.BR /usr/local/clockspeed/etc/atto , ++.BR /var/lib/clockspeed/atto , + overwriting +-.B /usr/local/clockspeed/etc/atto.tmp ++.B /var/lib/clockspeed/atto.tmp + for reliability. + It reads +-.B /usr/local/clockspeed/etc/atto ++.B /var/lib/clockspeed/atto + when it starts up again. + + .B clockspeed +--- clockspeed-0.62/clockspeed.c ++++ clockspeed-0.62/clockspeed.c +@@ -83,7 +83,7 @@ + if (deriv <= 0) return; + if (deriv > 200000000) return; /* 5Hz ticks? be serious */ + +- fd = open_trunc("etc/atto.tmp"); ++ fd = open_trunc("/var/lib/clockspeed/atto.tmp"); + if (fd == -1) return; + + buf[0] = 0; +@@ -119,7 +119,7 @@ + if (fsync(fd) == -1) { close(fd); return; } + if (close(fd) == -1) return; /* NFS stupidity */ + +- rename("etc/atto.tmp","etc/atto"); /* if it fails, bummer */ ++ rename("/var/lib/clockspeed/atto.tmp","/var/lib/clockspeed/atto"); /* if it fails, bummer */ + } + + void main() +@@ -136,16 +136,16 @@ + if (chdir(auto_home) == -1) _exit(1); + umask(033); + +- if (open_read("etc/atto") == 0) { ++ if (open_read("/var/lib/clockspeed/atto") == 0) { + r = read(0,buf,sizeof buf); + if (r == sizeof buf) + deriv = nano(buf); + close(0); + } + +- if (fifo_make("adjust",0600) == -1) if (errno != error_exist) _exit(1); +- if (open_read("adjust") != 0) _exit(1); +- if (open_write("adjust") == -1) _exit(1); ++ if (fifo_make("/var/lib/clockspeed/adjust",0600) == -1) if (errno != error_exist) _exit(1); ++ if (open_read("/var/lib/clockspeed/adjust") != 0) _exit(1); ++ if (open_write("/var/lib/clockspeed/adjust") == -1) _exit(1); + + now(&first); + +--- clockspeed-0.62/clockview.c ++++ clockspeed-0.62/clockview.c +@@ -1,5 +1,5 @@ + #include <sys/types.h> +-#include <sys/time.h> ++#include <time.h> + #include "substdio.h" + #include "readwrite.h" + #include "strerr.h" +--- clockspeed-0.62/conf-home ++++ clockspeed-0.62/conf-home +@@ -1,4 +1,4 @@ +-/usr/local/clockspeed ++/usr + + This is the clockspeed home directory. Programs will be installed in + .../bin. +--- clockspeed-0.62/error.h ++++ clockspeed-0.62/error.h +@@ -1,7 +1,7 @@ + #ifndef ERROR_H + #define ERROR_H + +-extern int errno; ++#include <errno.h> + + extern int error_intr; + extern int error_nomem; +--- clockspeed-0.62/hier.c ++++ clockspeed-0.62/hier.c +@@ -2,7 +2,9 @@ + + void hier() + { +- c("/","etc","leapsecs.dat",-1,-1,0644); ++ d("/var/lib","clockspeed",-1,-1,0755); ++ ++ c("/","var/lib/clockspeed","leapsecs.dat",-1,-1,0644); + + h(auto_home,-1,-1,0755); + +--- clockspeed-0.62/leapsecs.3 ++++ clockspeed-0.62/leapsecs.3 +@@ -52,10 +52,10 @@ + + .B leapsecs_read + reads the leap-second table from +-.BR /etc/leapsecs.dat . ++.BR /var/lib/clockspeed/leapsecs.dat . + It returns 0 on success, -1 on error. + If +-.B /etc/leapsecs.dat ++.B /var/lib/clockspeed/leapsecs.dat + does not exist, + .B leapsecs_read + treats it as an empty file. +--- clockspeed-0.62/leapsecs_read.c ++++ clockspeed-0.62/leapsecs_read.c +@@ -2,7 +2,6 @@ + #include <sys/stat.h> + #include <fcntl.h> + #include <errno.h> +-extern int errno; + #include "tai.h" + #include "leapsecs.h" + +@@ -18,7 +17,7 @@ + int i; + struct tai u; + +- fd = open("/etc/leapsecs.dat",O_RDONLY | O_NDELAY); ++ fd = open("/var/lib/clockspeed/leapsecs.dat",O_RDONLY | O_NDELAY); + if (fd == -1) { + if (errno != ENOENT) return -1; + if (leapsecs) free(leapsecs); diff --git a/net-misc/clockspeed/files/ntpclockset b/net-misc/clockspeed/files/ntpclockset new file mode 100644 index 000000000000..c4c9d1b68ccb --- /dev/null +++ b/net-misc/clockspeed/files/ntpclockset @@ -0,0 +1,56 @@ +#!/bin/bash + +# Updates by Sascha Silbe + +usage() { + cat << EOF +Usage: ntpclockset [options] <NTP server> +Example: ntpclockset -q 192.168.0.1 + +Options: + --quiet (-q) be quiet (only show errors) + --help (-h) show this text and exit +EOF + exit 1 +} + +quiet=0 + +for curArg in "$@" ; do + case "${curArg}" in + -q|--quiet) quiet=1;; + -h|--help) usage;; + -*) echo "Invalid option '${curArg}'" + usage;; + *) NTPSERVER="${curArg}";; + esac +done + +[ -z $NTPSERVER ] && NTPSERVER=`dnsip pool.ntp.org | awk '{print $1}'` + +tmpfile="`mktemp`" +# display how much your clock is off by +if ! sntpclock $NTPSERVER > ${tmpfile} ; then + echo "!!! Could not contact NTP server: $NTPSERVER" >&2 + exit 2 +fi + +if [ ${quiet} -eq 0 ] ; then + echo ">>> Current clock sync:" + cat ${tmpfile} | clockview + echo + echo -n ">>> Now setting clock ..." +fi +cat ${tmpfile} | clockadd +if [ ${quiet} -eq 0 ] ; then + echo " [ok]" + echo -n ">>> Writing time to hardware clock ..." +fi +/sbin/hwclock --systohc +if [ ${quiet} -eq 0 ] ; then + echo " [ok]" + echo + echo ">>> New clock sync:" + sntpclock $NTPSERVER | clockview +fi +rm -f ${tmpfile} diff --git a/net-misc/clockspeed/metadata.xml b/net-misc/clockspeed/metadata.xml new file mode 100644 index 000000000000..a12252d0f03c --- /dev/null +++ b/net-misc/clockspeed/metadata.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<!-- maintainer-needed --> +<longdescription lang="en"> +clockspeed uses a hardware tick counter to compensate for a persistently fast or +slow system clock. Given a few time measurements from a reliable source, it +computes and then eliminates the clock skew. +</longdescription> +</pkgmetadata> |