From bf21b389e5f4e90aa8d16f953fafc04d53b729fe Mon Sep 17 00:00:00 2001
From: Cecil <knoppmyth@gmail.com>
Date: Wed, 6 Jul 2011 01:08:54 -0700
Subject: ntp:bumped to latest.

---
 abs/core/ntp/PKGBUILD        | 99 ++++++++++++++++++++------------------------
 abs/core/ntp/changelog       |  0
 abs/core/ntp/ntp-client.conf | 10 +----
 abs/core/ntp/ntp.conf        | 21 ++++++----
 abs/core/ntp/ntpd            | 40 +++++++++++-------
 abs/core/ntp/ntpdate         |  7 ++--
 6 files changed, 89 insertions(+), 88 deletions(-)
 create mode 100644 abs/core/ntp/changelog

diff --git a/abs/core/ntp/PKGBUILD b/abs/core/ntp/PKGBUILD
index 772e0bf..69669c7 100755
--- a/abs/core/ntp/PKGBUILD
+++ b/abs/core/ntp/PKGBUILD
@@ -1,8 +1,9 @@
-# $Id: PKGBUILD 75563 2010-04-01 20:42:21Z giovanni $
-# Maintainer: dorphell <dorphell@archlinux.org>
+# $Id: PKGBUILD 117473 2011-04-03 17:50:26Z andrea $
+# Maintainer: kevin <kevin@archlinux.org>
 
 pkgname=ntp
-pkgver=4.2.6p2
+pkgver=4.2.6.p3
+_realver=4.2.6p3
 pkgrel=3
 pkgdesc="NTP (Network Time Protocol) tries to keep servers in sync"
 arch=(i686 x86_64)
@@ -12,78 +13,66 @@ depends=('openssl' 'readline' 'libcap')
 makedepends=('perl-html-parser')
 backup=('etc/ntp.conf' 'etc/conf.d/ntp-client.conf')
 options=('!emptydirs')
-source=(http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-${pkgver}.tar.gz
-        ntp-4.2.4_p7-nano.patch
-	fix-ipv6.patch
+changelog=changelog
+source=(http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-${_realver}.tar.gz
 	ntp-4.2.4-html2man.patch
-        ntp.conf
-        ntp-client.conf
-        ntpd
-        ntpdate)
-sha1sums=('a1f21b23c8c80f35801d59e30ba30779f2025a72' '4de6cd3fad1946146107f86d1f161eb835fbb2d3'\
-         '3632f8a00838f48e484bca24de06db443cc14fff' '7f8783e243e23c8853a9f9fb5b36f467aab8dc15'\
-         '3625ed2aa71d9e0dd04634f32e65d83b76cfe780' 'c8e388f2577b4329da5e77f0455083db6dd97fa8'\
-         'd9b09de9d718a864270e9330e20109e182dfbdd9' '6dfc3b6996f591123ee8938fd0fe7c27eb5c7552')
+	ntp.conf
+	ntp-client.conf
+	ntpd
+	ntpdate)
+md5sums=('59876a9009b098ff59767ee45a88ebd2' '1b04e888717bb31479a6087632981723'
+         '398a7f270f6ae083f47f86eb8b557a75' '58997d6cf4846d80e35a01b855376a33'
+         'bf20804e75656609e808ca21b53ea4aa' '99b49d763e5866f4f81c48d922c80b93')
 
 build() {
-  cd "$srcdir/$pkgname-$pkgver" || return 1
-  # fix glibc build issue
-  patch -Np1 -i ../ntp-4.2.4_p7-nano.patch || return 1
-  # fix ipv6 support
-  patch -Np1 -i ../fix-ipv6.patch || return 1
+  cd "$srcdir/$pkgname-$_realver"
   # fix man page generation
-  patch -Np1 -i ../ntp-4.2.4-html2man.patch || return 1
+  patch -Np1 -i ../ntp-4.2.4-html2man.patch
   # configure
   export LDFLAGS="${LDFLAGS//-Wl,--as-needed}"
-  libtoolize --copy  --force || return 1
-  ac_cv_header_dns_sd_h=0 ./configure --prefix=/usr --mandir=/usr/share/man --enable-linux-caps || return 1
+  # 4.2.6p3: aclocal too old, regenerate
+  rm -f aclocal.m4
+  libtoolize --copy --force
+  ac_cv_header_dns_sd_h=0 ./configure --prefix=/usr \
+    --mandir=/usr/share/man \
+    --enable-linux-caps
+  # build
+  make
+}
+
+package() {
+  cd "$srcdir/$pkgname-$_realver"
 
-  # build and install
-  make || return 1
-  make DESTDIR="$pkgdir" install || return 1
+  # install
+  make DESTDIR="$pkgdir" install
 
   # install conf files
-  mkdir -p "$pkgdir/usr/share/ntp" || return 1
-  install -D -m644 conf/* "$pkgdir/usr/share/ntp/" || return 1
+  install -d "$pkgdir/usr/share/ntp"
+  install -D -m644 conf/* "${pkgdir}/usr/share/ntp"
 
   # install launch scripts 
-  mkdir -p "$pkgdir/etc/rc.d" || return 1
-  install -D -m755 "$srcdir"/{ntpd,ntpdate} "$pkgdir/etc/rc.d/" || return 1
+  install -d "$pkgdir/etc/rc.d"
+  install -D -m755 ${srcdir}/{ntpd,ntpdate} "$pkgdir/etc/rc.d"
 
   # install man pages
   cd html
-  ../scripts/html2man || return 1
-  sed -i 's/^[\t\ ]*$//;/./,/^$/!d' man/man*/*.[58] || return 1
+  ../scripts/html2man
+  sed -i 's/^[\t\ ]*$//;/./,/^$/!d' man/man*/*.[58]
   install -d "$pkgdir"/usr/share/man/man{5,8}
-  install -m644 man/man5/* "$pkgdir/usr/share/man/man5/" || return 1
-  install -m644 man/man8/* "$pkgdir/usr/share/man/man8/" || return 1
-  mv "$pkgdir/usr/share/man/man8/ntpd.8" "$pkgdir/usr/share/man/man8/ntp-ntpd.8" || return 1
+  install -m644 man/man5/* "$pkgdir/usr/share/man/man5/"
+  install -m644 man/man8/* "$pkgdir/usr/share/man/man8/"
+  mv "$pkgdir/usr/share/man/man8/ntpd.8" "$pkgdir/usr/share/man/man8/ntp-ntpd.8"
   cd ..
 
   # install sample configs
-  install -D -m644 "$srcdir/ntp.conf" "$pkgdir/etc/ntp.conf" || return 1
+  install -D -m644 "$srcdir/ntp.conf" "$pkgdir/etc/ntp.conf"
   install -D -m644 "$srcdir/ntp-client.conf" \
-  	"$pkgdir/etc/conf.d/ntp-client.conf" || return 1
+  	"$pkgdir/etc/conf.d/ntp-client.conf"
 
   # create /var/lib/ntp
-  mkdir -p "$pkgdir/var/lib/ntp" || return 1
-  touch "$pkgdir/var/lib/ntp/.placeholder" || return 1
+  install -d "$pkgdir/var/lib/ntp"
+  touch "$pkgdir/var/lib/ntp/.placeholder"
 
-  install -Dm644 "$srcdir/$pkgname-$pkgver/COPYRIGHT" "$pkgdir/usr/share/licenses/$pkgname/COPYRIGHT"
+  install -Dm644 "$srcdir/$pkgname-$_realver/COPYRIGHT" \
+    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
 }
-md5sums=('cf73cd85f248232c62f8029e6eb05938'
-         '36c5711228cb0cf48966daa993e06f55'
-         '9dabdbc6b8cd020f2205515df7972c21'
-         '1b04e888717bb31479a6087632981723'
-         '5bd3924f5720b97837969ec4ec4d5e09'
-         'c7f50632b69bd4f32cf052d0b1848463'
-         '46118a8ec2c4f5bbfafd730af21b7c03'
-         '140855352baeb89da0c6c1c475c18b57')
-sha1sums=('04b5e3c3755fe9e5bcec5bd5d29255cfef2102c4'
-          '4de6cd3fad1946146107f86d1f161eb835fbb2d3'
-          '3632f8a00838f48e484bca24de06db443cc14fff'
-          '7f8783e243e23c8853a9f9fb5b36f467aab8dc15'
-          '3625ed2aa71d9e0dd04634f32e65d83b76cfe780'
-          'c8e388f2577b4329da5e77f0455083db6dd97fa8'
-          'd9b09de9d718a864270e9330e20109e182dfbdd9'
-          '6dfc3b6996f591123ee8938fd0fe7c27eb5c7552')
diff --git a/abs/core/ntp/changelog b/abs/core/ntp/changelog
new file mode 100644
index 0000000..e69de29
diff --git a/abs/core/ntp/ntp-client.conf b/abs/core/ntp/ntp-client.conf
index a0463b7..e728db5 100755
--- a/abs/core/ntp/ntp-client.conf
+++ b/abs/core/ntp/ntp-client.conf
@@ -1,11 +1,5 @@
-# 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
+# client options for "ntpd -q" - ntpdate equivalent
+NTP_CLIENT_OPTION="-g"
 
 # arguments passed to ntpd when started
 NTPD_ARGS="-g"
diff --git a/abs/core/ntp/ntp.conf b/abs/core/ntp/ntp.conf
index 93fc919..7f888e4 100755
--- a/abs/core/ntp/ntp.conf
+++ b/abs/core/ntp/ntp.conf
@@ -19,24 +19,24 @@ server pool.ntp.org
 # netselect -s 3 pool.ntp.org
 ##
 
-# you should not need to modify the following paths
-driftfile	/var/lib/ntp/ntp.drift
-
 #server ntplocal.example.com prefer 
 #server timeserver.example.org 
 
 # Warning: Using default NTP settings will leave your NTP
 # server accessible to all hosts on the Internet.
 
-# If you want to deny all machines (including your own)
-# from accessing the NTP server, uncomment:
+# A default deny all (including localhost) policy
+# To use this define restrictions for all servers and clients
 #restrict default ignore
+#restrict -6 default ignore
 
-
-# To deny other machines from changing the
-# configuration but allow localhost:
+# A more open policy, allow access but deny changing the configuration
 restrict default nomodify nopeer
+#restrict -6 default nomodify nopeer
+
+# Allow localhost
 restrict 127.0.0.1
+#restrict -6 ::1
 
 
 # To allow machines within your network to synchronize
@@ -45,3 +45,8 @@ restrict 127.0.0.1
 # to synchronize against, uncomment this line.
 #
 #restrict 192.168.0.0 mask 255.255.255.0 nomodify nopeer notrap
+
+
+# you should not need to modify the following paths
+driftfile	/var/lib/ntp/ntp.drift
+
diff --git a/abs/core/ntp/ntpd b/abs/core/ntp/ntpd
index 56f6248..825efc1 100755
--- a/abs/core/ntp/ntpd
+++ b/abs/core/ntp/ntpd
@@ -4,30 +4,42 @@
 . /etc/rc.d/functions
 . /etc/conf.d/ntp-client.conf
 
-PID=`pidof -o %PPID /usr/bin/ntpd`
+PIDFILE="/var/run/ntpd/ntpd.pid"
+PID=$(cat $PIDFILE 2> /dev/null)
+
 case "$1" in
   start)
     stat_busy "Starting NTP Daemon"
+    [ ! -d /var/run/ntpd ] && install -d /var/run/ntpd &>/dev/null
     if [ -z "$PID" ]; then 
-       /usr/bin/ntpd $NTPD_ARGS &
-    fi
-    if [ ! -z "$PID" -o $? -gt 0 ]; then
-      stat_fail
+       /usr/bin/ntpd $NTPD_ARGS -p /var/run/ntpd/ntpd.pid &>/dev/null
+      if [ $? -gt 0 ]; then
+        stat_fail
+        exit 1
+      else
+        add_daemon ntpd
+        stat_done
+      fi
     else
-      PID=`pidof -o %PPID /usr/bin/ntpd`
-      echo $PID > /var/run/ntpd.pid
-      add_daemon ntpd
-      stat_done
+      stat_fail
+      exit 1
     fi
     ;;
   stop)
     stat_busy "Stopping NTP Daemon"
-    [ ! -z "$PID" ]  && kill $PID &> /dev/null
-    if [ $? -gt 0 ]; then
-      stat_fail
+    if [ -n "$PID" ]; then
+      kill $PID &> /dev/null
+      if [ $? -gt 0 ]; then
+        stat_fail
+        exit 1
+      else
+        rm $PIDFILE &>/dev/null
+        rm_daemon ntpd
+        stat_done
+      fi
     else
-      rm_daemon ntpd
-      stat_done
+      stat_fail
+      exit 1
     fi
     ;;
   restart)
diff --git a/abs/core/ntp/ntpdate b/abs/core/ntp/ntpdate
index 643ae19..99508f4 100755
--- a/abs/core/ntp/ntpdate
+++ b/abs/core/ntp/ntpdate
@@ -7,9 +7,10 @@
 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
+    /usr/bin/ntpd -q $NTP_CLIENT_OPTION &> /dev/null
+    if [ $? -gt 0 ]; then
       stat_fail
+      exit 1
     else
       add_daemon ntpdate
       stat_done
@@ -22,9 +23,9 @@ case "$1" in
     ;;
   restart)
     $0 stop
-    sleep 1
     $0 start
     ;;
   *)
     echo "usage: $0 {start|stop|restart}"  
 esac
+
-- 
cgit v0.12