summaryrefslogtreecommitdiff
path: root/source/n/ntp
diff options
context:
space:
mode:
Diffstat (limited to 'source/n/ntp')
-rw-r--r--source/n/ntp/doinst.sh18
-rwxr-xr-xsource/n/ntp/ntp.SlackBuild112
-rw-r--r--source/n/ntp/ntp.conf44
-rw-r--r--source/n/ntp/ntp.keys2
-rw-r--r--source/n/ntp/rc.ntpd53
-rw-r--r--source/n/ntp/slack-desc19
6 files changed, 248 insertions, 0 deletions
diff --git a/source/n/ntp/doinst.sh b/source/n/ntp/doinst.sh
new file mode 100644
index 00000000..1e74ce44
--- /dev/null
+++ b/source/n/ntp/doinst.sh
@@ -0,0 +1,18 @@
+config() {
+ NEW="$1"
+ OLD="`dirname $NEW`/`basename $NEW .new`"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+config etc/ntp.conf.new
+config etc/ntp/ntp.keys.new
+if [ -r etc/rc.d/rc.ntpd -a -r etc/rc.d/rc.ntpd.new ]; then
+ chmod --reference=etc/rc.d/rc.ntpd etc/rc.d/rc.ntpd.new
+fi
+config etc/rc.d/rc.ntpd.new
diff --git a/source/n/ntp/ntp.SlackBuild b/source/n/ntp/ntp.SlackBuild
new file mode 100755
index 00000000..93ff1ee8
--- /dev/null
+++ b/source/n/ntp/ntp.SlackBuild
@@ -0,0 +1,112 @@
+#!/bin/sh
+
+# Copyright 2008, 2009 Patrick J. Volkerding, Sebeka, MN, USA
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+VERSION=4.2.4p7
+ARCH=${ARCH:-x86_64}
+BUILD=${BUILD:-1}
+
+NUMJOBS=${NUMJOBS:-" -j7 "}
+
+if [ "$ARCH" = "i486" ]; then
+ SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+elif [ "$ARCH" = "s390" ]; then
+ SLKCFLAGS="-O2"
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp}
+PKG=$TMP/package-ntp
+
+rm -rf $PKG
+mkdir -p $TMP $PKG
+cd $TMP
+rm -rf ntp-${VERSION}*
+tar xvf $CWD/ntp-${VERSION}*.tar.?z* || exit 1
+cd ntp-${VERSION}* || exit 1
+chown -R root:root .
+find . \
+ \( -perm 2777 -o -perm 2755 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 777 -o -perm 775 -o -perm 774 -o -perm 711 -o -perm 555 -o -perm 511 \) \
+ -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
+ -exec chmod 644 {} \;
+
+CFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --localstatedir=/var \
+ --sysconfdir=/etc \
+ --bindir=/usr/sbin \
+ --sbindir=/usr/sbin \
+ --program-prefix= \
+ --program-suffix= \
+ --build=$ARCH-slackware-linux
+
+make $NUMJOBS || make || exit 1
+make install DESTDIR=$PKG || exit 1
+
+# Since the Makefile's install pays no heed to the --bindir settings,
+# we'll move things to where they've always been ourselves:
+mv $PKG/usr/bin/* $PKG/usr/sbin
+rmdir $PKG/usr/bin
+
+# This is just epty:
+rmdir $PKG/usr/lib || exit 1
+
+mkdir -p $PKG/etc/ntp
+cat $CWD/ntp.conf > $PKG/etc/ntp.conf.new
+cat $CWD/ntp.keys > $PKG/etc/ntp/ntp.keys.new
+chmod 600 $PKG/etc/ntp/ntp.keys.new
+touch $PKG/etc/ntp/step-tickers
+
+mkdir -p $PKG/etc/rc.d
+cat $CWD/rc.ntpd > $PKG/etc/rc.d/rc.ntpd.new
+
+mkdir -p $PKG/usr/doc/ntp-$VERSION
+cp -a \
+ COPYRIGHT NEWS README* TODO WHERE-TO-START \
+ *.y2kfixes clockstuff conf html scripts \
+ $PKG/usr/doc/ntp-$VERSION
+mkdir $PKG/usr/doc/ntp-$VERSION/util
+cp -a util/README $PKG/usr/doc/ntp-$VERSION/util
+mkdir $PKG/usr/doc/ntp-$VERSION/ntpdate
+cp -a ntpdate/README $PKG/usr/doc/ntp-$VERSION/ntpdate
+( cd $PKG/usr/doc/ntp-$VERSION
+ find . -type d -name .deps -exec rm -rf {} \; 2> /dev/null
+)
+
+find $PKG | xargs file | grep -e "executable" -e "shared object" \
+ | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
+
+gzip -9 $PKG/usr/man/man?/*.?
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $TMP/ntp-$VERSION-$ARCH-$BUILD.txz
+
diff --git a/source/n/ntp/ntp.conf b/source/n/ntp/ntp.conf
new file mode 100644
index 00000000..b2476786
--- /dev/null
+++ b/source/n/ntp/ntp.conf
@@ -0,0 +1,44 @@
+# Sample /etc/ntp.conf: Configuration file for ntpd.
+#
+# Undisciplined Local Clock. This is a fake driver intended for backup
+# and when no outside source of synchronized time is available. The
+# default stratum is usually 3, but in this case we elect to use stratum
+# 0. Since the server line does not have the prefer keyword, this driver
+# is never used for synchronization, unless no other other
+# synchronization source is available. In case the local host is
+# controlled by some external source, such as an external oscillator or
+# another protocol, the prefer keyword would cause the local host to
+# disregard all other synchronization sources, unless the kernel
+# modifications are in use and declare an unsynchronized condition.
+#
+server 127.127.1.0 # local clock
+fudge 127.127.1.0 stratum 10
+#server pool.ntp.org
+
+#
+# Drift file. Put this in a directory which the daemon can write to.
+# No symbolic links allowed, either, since the daemon updates the file
+# by creating a temporary in the same directory and then rename()'ing
+# it to the file.
+#
+driftfile /etc/ntp/drift
+multicastclient # listen on default 224.0.1.1
+broadcastdelay 0.008
+
+#
+# Keys file. If you want to diddle your server at run time, make a
+# keys file (mode 600 for sure) and define the key number to be
+# used for making requests.
+# PLEASE DO NOT USE THE DEFAULT VALUES HERE. Pick your own, or remote
+# systems might be able to reset your clock at will.
+#
+#keys /etc/ntp/keys
+#trustedkey 65535
+#requestkey 65535
+#controlkey 65535
+
+# Don't serve time or stats to anyone else by default (more secure)
+restrict default noquery nomodify
+# Trust ourselves. :-)
+restrict 127.0.0.1
+
diff --git a/source/n/ntp/ntp.keys b/source/n/ntp/ntp.keys
new file mode 100644
index 00000000..1c3fbd2c
--- /dev/null
+++ b/source/n/ntp/ntp.keys
@@ -0,0 +1,2 @@
+65535 M akey
+1 M pass
diff --git a/source/n/ntp/rc.ntpd b/source/n/ntp/rc.ntpd
new file mode 100644
index 00000000..2db421f6
--- /dev/null
+++ b/source/n/ntp/rc.ntpd
@@ -0,0 +1,53 @@
+#!/bin/sh
+# Start/stop/restart ntpd.
+
+# Start ntpd:
+ntpd_start() {
+ CMDLINE="/usr/sbin/ntpd -g"
+ echo -n "Starting NTP daemon: $CMDLINE"
+ $CMDLINE -p /var/run/ntpd.pid
+ echo
+}
+
+# Stop ntpd:
+ntpd_stop() {
+ echo -n "Stopping NTP daemon..."
+ kill $(cat /var/run/ntpd.pid)
+ echo
+ sleep 1
+ rm -f /var/run/ntpd.pid
+ killall ntpd 2> /dev/null
+}
+
+# Restart ntpd:
+ntpd_restart() {
+ ntpd_stop
+ sleep 1
+ ntpd_start
+}
+
+# Check if ntpd is running
+ntpd_status() {
+ if [ -e /var/run/ntpd.pid ]; then
+ echo "ntpd is running."
+ else
+ echo "ntpd is stopped."
+ fi
+}
+
+case "$1" in
+'start')
+ ntpd_start
+ ;;
+'stop')
+ ntpd_stop
+ ;;
+'restart')
+ ntpd_restart
+ ;;
+'status')
+ ntpd_status
+ ;;
+*)
+ echo "usage $0 start|stop|restart|status"
+esac
diff --git a/source/n/ntp/slack-desc b/source/n/ntp/slack-desc
new file mode 100644
index 00000000..6319e888
--- /dev/null
+++ b/source/n/ntp/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+ |-----handy-ruler------------------------------------------------------|
+ntp: ntp (Network Time Protocol daemon)
+ntp:
+ntp: The Network Time Protocol (NTP) is used to synchronize the time of a
+ntp: computer client or server to another server or reference time source,
+ntp: such as a radio or satellite receiver or modem. It provides client
+ntp: accuracies typically within a millisecond on LANs and up to a few tens
+ntp: of milliseconds on WANs relative to a primary server synchronized to
+ntp: Coordinated Universal Time (UTC) via a Global Positioning Service
+ntp: (GPS) receiver, for example.
+ntp:
+ntp: