summaryrefslogtreecommitdiffstats
path: root/abs/core/ntp
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/ntp')
-rwxr-xr-xabs/core/ntp/PKGBUILD26
-rwxr-xr-xabs/core/ntp/ntp-client.conf7
-rwxr-xr-xabs/core/ntp/ntp.conf57
-rwxr-xr-xabs/core/ntp/ntpd39
-rwxr-xr-xabs/core/ntp/ntpdate30
5 files changed, 159 insertions, 0 deletions
diff --git a/abs/core/ntp/PKGBUILD b/abs/core/ntp/PKGBUILD
new file mode 100755
index 0000000..fc568b0
--- /dev/null
+++ b/abs/core/ntp/PKGBUILD
@@ -0,0 +1,26 @@
+pkgname=ntp
+pkgver=4.2.4p5
+pkgrel=3
+pkgdesc="NTP (Network Time Protocol) tries to keep servers in sync"
+arch=(i686 x86_64)
+url="http://www.ntp.org/"
+depends=('openssl' 'readline' )
+backup=('etc/ntp.conf' 'conf.d/ntp-client.conf')
+source=(http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2.4p5.tar.gz \
+ ntp.conf ntp-client.conf ntpd ntpdate )
+
+
+build() {
+ cd $startdir/src/$pkgname-$pkgver
+ ./configure --prefix=/usr
+ make || return 1
+ make prefix=$startdir/pkg/usr install
+ mkdir -p $startdir/pkg/usr/share/ntp/ $startdir/pkg/usr/man/man1/
+ install -D -m644 conf/* $startdir/pkg/usr/share/ntp/
+ install -D -m755 $startdir/ntpd $startdir/pkg/etc/rc.d/ntpd
+ install -D -m755 $startdir/ntpdate $startdir/pkg/etc/rc.d/ntpdate
+ install -D -m644 $startdir/src/man/* $startdir/pkg/usr/man/man1/
+ install -D -m644 $startdir/ntp-client.conf $startdir/pkg/etc/conf.d/ntp-client.conf
+ install -D -m644 $startdir/ntp.conf $startdir/pkg/etc/ntp.conf
+}
+
diff --git a/abs/core/ntp/ntp-client.conf b/abs/core/ntp/ntp-client.conf
new file mode 100755
index 0000000..ace4daf
--- /dev/null
+++ b/abs/core/ntp/ntp-client.conf
@@ -0,0 +1,7 @@
+# change this to a server closer to your location
+NTP_CLIENT_SERVER="pool.ntp.org"
+# client options
+NTP_CLIENT_OPTION="-b -u"
+
+# timeout for the ntp-client
+NTPCLIENT_TIMEOUT=10
diff --git a/abs/core/ntp/ntp.conf b/abs/core/ntp/ntp.conf
new file mode 100755
index 0000000..9411643
--- /dev/null
+++ b/abs/core/ntp/ntp.conf
@@ -0,0 +1,57 @@
+# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
+
+#driftfile /var/lib/ntp/ntp.drift
+driftfile /etc/ntp.drift
+
+
+# Enable this if you want statistics to be logged.
+#statsdir /var/log/ntpstats/
+
+statistics loopstats peerstats clockstats
+filegen loopstats file loopstats type day enable
+filegen peerstats file peerstats type day enable
+filegen clockstats file clockstats type day enable
+
+
+# You do need to talk to an NTP server or two (or three).
+#server ntp.your-provider.example
+
+# pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will
+# pick a different set every time it starts up. Please consider joining the
+# pool: <http://www.pool.ntp.org/join.html>
+server pool.ntp.org
+server 0.us.pool.ntp.org iburst
+server 1.us.pool.ntp.org iburst
+server 2.us.pool.ntp.org iburst
+server 3.us.pool.ntp.org iburst
+
+
+# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
+# details. The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
+# might also be helpful.
+#
+# Note that "restrict" applies to both servers and clients, so a configuration
+# that might be intended to block requests from certain clients could also end
+# up blocking replies from your own upstream servers.
+
+# By default, exchange time with everybody, but don't allow configuration.
+restrict -4 default kod notrap nomodify nopeer noquery
+restrict -6 default kod notrap nomodify nopeer noquery
+
+# Local users may interrogate the ntp server more closely.
+restrict 127.0.0.1
+restrict ::1
+
+# Clients from this (example!) subnet have unlimited access, but only if
+# cryptographically authenticated.
+#restrict 192.168.123.0 mask 255.255.255.0 notrust
+
+
+# If you want to provide time to your local subnet, change the next line.
+# (Again, the address is an example only.)
+#broadcast 192.168.123.255
+
+# If you want to listen to time broadcasts on your local subnet, de-comment the
+# next lines. Please do this only if you trust everybody on the network!
+#disable auth
+#broadcastclient \ No newline at end of file
diff --git a/abs/core/ntp/ntpd b/abs/core/ntp/ntpd
new file mode 100755
index 0000000..bb39123
--- /dev/null
+++ b/abs/core/ntp/ntpd
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/bin/ntpd`
+case "$1" in
+ start)
+ stat_busy "Starting NTP Daemon"
+ if [ -z "$PID" ]; then
+ /usr/bin/ntpd -g &
+ fi
+ if [ ! -z "$PID" -o $? -gt 0 ]; then
+ stat_fail
+ else
+ PID=`pidof -o %PPID /usr/bin/ntpd`
+ echo $PID > /var/run/ntpd.pid
+ add_daemon ntpd
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping NTP Daemon"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon ntpd
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
diff --git a/abs/core/ntp/ntpdate b/abs/core/ntp/ntpdate
new file mode 100755
index 0000000..643ae19
--- /dev/null
+++ b/abs/core/ntp/ntpdate
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+. /etc/conf.d/ntp-client.conf
+
+case "$1" in
+ start)
+ stat_busy "Starting NTP Client"
+ /usr/bin/ntpdate $NTP_CLIENT_OPTION -t $NTPCLIENT_TIMEOUT $NTP_CLIENT_SERVER > /dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon ntpdate
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping NTP Client"
+ rm_daemon ntpdate
+ stat_done
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac