summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpetere <petere@0070b5ef-2f16-0410-befa-9a02bd1d6ddb>2006-10-11 14:38:52 +0000
committerpetere <petere@0070b5ef-2f16-0410-befa-9a02bd1d6ddb>2006-10-11 14:38:52 +0000
commit50fed1c1539fa8ce28541389698f74697f3db9e2 (patch)
tree91e64458fbf57439415ba457c45e7656e705047a
parent682ad7a9c0301beeb0202d44f9408975e5d95dd6 (diff)
downloadntp-50fed1c1539fa8ce28541389698f74697f3db9e2.tar.gz
* Added script ntpdate-debian. This is identical to ntpdate but reads
/etc/default/ntpdate automatically, allowing for centralized configuration. (closes: #147590, #372119, #392098) * Moved ntp.conf parsing logic to ntpdate-debian (closes: #392325) * Redirect error output of ntpdate.ifup to /dev/null (closes: #391819) git-svn-id: svn://svn.debian.org/pkg-ntp/ntp/trunk@120 0070b5ef-2f16-0410-befa-9a02bd1d6ddb
-rw-r--r--debian/changelog5
-rw-r--r--debian/man/ntpdate-debian.828
-rw-r--r--debian/ntpdate-debian22
-rw-r--r--debian/ntpdate.README.Debian7
-rw-r--r--debian/ntpdate.default22
-rw-r--r--debian/ntpdate.ifup10
-rw-r--r--debian/ntpdate.manpages1
-rwxr-xr-xdebian/rules1
8 files changed, 73 insertions, 23 deletions
diff --git a/debian/changelog b/debian/changelog
index 973fef4..7fb06b8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,11 @@ ntp (1:4.2.2p3+dfsg-1) UNRELEASED; urgency=medium
* Removed obsolete msyslog.c patch
* Removed obsolete dependencies: psmisc (killall no longer used), lsb-base
for ntpdate (no longer has an init script)
+ * Added script ntpdate-debian. This is identical to ntpdate but reads
+ /etc/default/ntpdate automatically, allowing for centralized
+ configuration. (closes: #147590, #372119, #392098)
+ * Moved ntp.conf parsing logic to ntpdate-debian (closes: #392325)
+ * Redirect error output of ntpdate.ifup to /dev/null (closes: #391819)
-- Peter Eisentraut <petere@debian.org> Tue, 10 Oct 2006 11:13:27 +0200
diff --git a/debian/man/ntpdate-debian.8 b/debian/man/ntpdate-debian.8
new file mode 100644
index 0000000..591d5ad
--- /dev/null
+++ b/debian/man/ntpdate-debian.8
@@ -0,0 +1,28 @@
+.TH ntpdate-debian 8
+.SH NAME
+ntpdate-debian \- set the date and time via NTP
+.SH SYNOPSIS
+.B ntpdate-debian
+.RB [\| \-bBdoqsuv \|]
+.RB [\| \-a
+.IR key \|]
+.RB [\| \-e
+.IR authdelay \|]
+.RB [\| \-k
+.IR keyfile \|]
+.RB [\| \-o
+.IR version \|]
+.RB [\| \-p
+.IR samples \|]
+.RB [\| \-t
+.IR timeout \|]
+.SH DESCRIPTION
+.B ntpdate-debian
+is identical to
+.BR ntpdate (8)
+except that it uses the configuration in
+.I /etc/default/ntpdate
+by default.
+.B ntpdate
+sets the local date and time by polling Network Time
+Protocol (NTP) servers.
diff --git a/debian/ntpdate-debian b/debian/ntpdate-debian
new file mode 100644
index 0000000..34ae800
--- /dev/null
+++ b/debian/ntpdate-debian
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -e
+
+if [ -r /etc/default/ntpdate ]; then
+ . /etc/default/ntpdate
+fi
+
+if [ "$NTPDATE_USE_NTP_CONF" = yes ]; then
+ if [ -r /etc/ntp.conf.dhcp ]; then
+ file=/etc/ntp.conf.dhcp
+ elif [ -r /etc/ntp.conf ]; then
+ file=/etc/ntp.conf
+ fi
+ if [ -n "$file" ]; then
+ NTPSERVERS=$(sed -rne 's/^(server|peer) ([-_.[:alnum:]]+).*$/\2/p' "$file" | grep -v '^127\.127\.')
+ fi
+elif [ -r /etc/default/ntpdate.dhcp ]; then
+ . /etc/default/ntpdate.dhcp
+fi
+
+exec /usr/sbin/ntpdate $NTPOPTIONS "$@" $NTPSERVERS
diff --git a/debian/ntpdate.README.Debian b/debian/ntpdate.README.Debian
index 39748fe..284bbb8 100644
--- a/debian/ntpdate.README.Debian
+++ b/debian/ntpdate.README.Debian
@@ -1,7 +1,6 @@
-ntpdate doesn't parse the /etc/ntp.conf file. Its server list resides
-in /etc/default/ntpdate. But if you happen to have a file
-/etc/ntp.conf installed, then /etc/default/ntpdate will try to grab
-the server list from there.
+ntpdate doesn't parse the /etc/ntp.conf file. The program
+ntpdate-debian is provided that reads its server list from
+/etc/default/ntpdate or alternatively from /etc/ntp.conf.
ntpdate is run whenever a network interface is brought up. To adjust
this behavior, the file /etc/network/if-up.d/ntpdate should be edited.
diff --git a/debian/ntpdate.default b/debian/ntpdate.default
index d4c4f58..3241694 100644
--- a/debian/ntpdate.default
+++ b/debian/ntpdate.default
@@ -1,15 +1,13 @@
-# Servers to check (Separate multiple servers with spaces.)
-# This code will take the server list from /etc/ntp.conf, from package ntp,
+# The settings in this file are used by the program ntpdate-debian, but not
+# by the upstream program ntpdate.
+
+# Set to "yes" to take the server list from /etc/ntp.conf, from package ntp,
# so you only have to keep it in one place.
-if [ -r /etc/ntp.conf ]; then
- NTPSERVERS=$(sed -rne 's/^(server|peer) ([-_.[:alnum:]]+).*$/\2/p' /etc/ntp.conf | grep -v '^127\.127\.')
-fi
-if [ -z "$NTPSERVERS" ]; then
- NTPSERVERS="0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org"
-fi
-if [ -r /etc/default/ntpdate.dhcp ]; then
- . /etc/default/ntpdate.dhcp
-fi
+NTPDATE_USE_NTP_CONF=yes
+
+# List of NTP servers to use (Separate multiple servers with spaces.)
+# Not used if NTPDATE_USE_NTP_CONF is yes.
+NTPSERVERS="0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org"
-# Additional options for ntpdate
+# Additional options to pass to ntpdate
NTPOPTIONS=""
diff --git a/debian/ntpdate.ifup b/debian/ntpdate.ifup
index b9a3169..3da6908 100644
--- a/debian/ntpdate.ifup
+++ b/debian/ntpdate.ifup
@@ -1,6 +1,6 @@
#!/bin/sh
-if [ ! -x /usr/sbin/ntpdate ]; then
+if [ ! -x /usr/sbin/ntpdate-debian ]; then
exit 0
fi
@@ -8,16 +8,12 @@ if [ "$METHOD" = loopback ]; then
exit 0
fi
-if [ -r /etc/default/ntpdate ]; then
- . /etc/default/ntpdate
-fi
-
# This is a heuristic: The idea is that if a static interface is brought
# up, that is a major event, and we can put in some extra effort to fix
# the system time. Feel free to change this, especially if you regularly
# bring up new network interfaces.
if [ "$METHOD" = static ]; then
- NTPOPTIONS="-b $NTPOPTIONS"
+ OPTS="-b"
fi
-/usr/sbin/ntpdate -s $NTPOPTIONS "$@" $NTPSERVERS &
+/usr/sbin/ntpdate-debian -s $OPTS 2>/dev/null &
diff --git a/debian/ntpdate.manpages b/debian/ntpdate.manpages
index af76f8c..28633b1 100644
--- a/debian/ntpdate.manpages
+++ b/debian/ntpdate.manpages
@@ -1 +1,2 @@
debian/man/ntpdate.8
+debian/man/ntpdate-debian.8
diff --git a/debian/rules b/debian/rules
index 9ba1567..63b3b98 100755
--- a/debian/rules
+++ b/debian/rules
@@ -64,6 +64,7 @@ install: build-stamp
install -D -m 0755 scripts/ntpsweep debian/ntp/usr/bin/ntpsweep
install -D -m 0644 debian/ntp.dhcp debian/ntp/etc/dhcp3/dhclient-enter-hooks.d/ntp
install -D -m 0644 debian/ntpdate.dhcp debian/ntpdate/etc/dhcp3/dhclient-enter-hooks.d/ntpdate
+ install -D -m 0755 debian/ntpdate-debian debian/ntpdate/usr/sbin/ntpdate-debian
install -D -m 0644 debian/ntp.conf debian/ntp/etc/ntp.conf