summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /net-misc/clockspeed/files
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'net-misc/clockspeed/files')
-rw-r--r--net-misc/clockspeed/files/clockspeed-0.62-gentoo.patch225
-rw-r--r--net-misc/clockspeed/files/ntpclockset57
2 files changed, 282 insertions, 0 deletions
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..35441097ca61
--- /dev/null
+++ b/net-misc/clockspeed/files/ntpclockset
@@ -0,0 +1,57 @@
+#!/bin/bash
+# $Id$
+
+# 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}