Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=frugalware-current.git;a=commitdiff;h=cd6c3222981ffa40c94b477d0014f5c0c7dcfac8

commit cd6c3222981ffa40c94b477d0014f5c0c7dcfac8
Author: Devil505 <devil505li...@gmail.com>
Date:   Mon Aug 15 15:54:14 2011 +0200

openntpd-3.9p1-8-i686
* removed RC script
* added systemd service script
* added patch for adjtimex

diff --git a/source/network/openntpd/FrugalBuild 
b/source/network/openntpd/FrugalBuild
index 3587f74..6facb65 100644
--- a/source/network/openntpd/FrugalBuild
+++ b/source/network/openntpd/FrugalBuild
@@ -4,7 +4,7 @@

pkgname=openntpd
pkgver=3.9p1
-pkgrel=7
+pkgrel=8
pkgdesc="A free, easy to use implementation of the Network Time Protocol."
url="http://www.openntpd.org/";
groups=('network')
@@ -13,18 +13,24 @@ backup=('etc/ntpd.conf' 'etc/sysconfig/ntpd')
depends=('openssl>=1.0.0')
up2date="lynx -dump http://www.openntpd.org/|perl -wlne 'if(/Portable OpenNTPD 
(\d\.\d(\.\d)?[a-z]\d) released/) { print \$1; exit; }'"
source=(ftp://ftp.openbsd.org/pub/OpenBSD/OpenNTPD/$pkgname-$pkgver.tar.gz \
-        pidfile.patch rc.ntpd ntpd.sysconfig)
+        pidfile.patch $pkgname.service ntpd.sysconfig linux-adjtimex.patch)

build()
{
-       Fbuild --with-mantype=man
+        Fcd
+        Fpatchall
+        autoreconf -fi || Fdie
+       Fmake --with-mantype=man --with-adjtimex
+       Fmakeinstall
Fmkdir /var/empty/ntpd
-       Frcd2 ntpd
+       Fmkdir lib/systemd/system/
+        Finstall 0644 $pkgname.service /lib/systemd/system/$pkgname.service
Ffile ntpd.sysconfig /etc/sysconfig/ntpd
}
sha1sums=('098a435d02886a9e4d34afb15b15fde795eda1e9' \
'7492895dda68aebdda46ebeb9393e57b608109ca' \
-          '9d61b869809218fa0904114dd6d7e277ee472a96' \
-          '51ef671195aa6cb7de1cbd74dde9275f083174ec')
+          'e9b93060da215a53363585b45a657a349547a8a5' \
+          '51ef671195aa6cb7de1cbd74dde9275f083174ec' \
+          'ab11f4793fa66905e8e5466c6ff0ead6719f57b6')

# optimization OK
diff --git a/source/network/openntpd/linux-adjtimex.patch 
b/source/network/openntpd/linux-adjtimex.patch
new file mode 100644
index 0000000..e7b72da
--- /dev/null
+++ b/source/network/openntpd/linux-adjtimex.patch
@@ -0,0 +1,168 @@
+Only in openntpd-3.9p1.old: configure
+diff -ur --unidirectional-new-file openntpd-3.9p1.old/configure.ac 
openntpd-3.9p1/configure.ac
+--- openntpd-3.9p1.old/configure.ac    2006-05-14 07:29:23.000000000 +0200
++++ openntpd-3.9p1/configure.ac        2008-02-07 13:13:18.066366142 +0100
+@@ -583,6 +583,11 @@
+       [ builtin_arc4random=$withval ]
+ )
+
++AC_ARG_WITH(adjtimex,
++              [  --with-adjtimex         Use adjtimex to adjust kernel skew],
++              [ AC_DEFINE(USE_ADJTIMEX, [], [Use adjust skew with adjtimex 
(experimental)]) ]
++          )
++
+ AC_ARG_WITH(mantype,
+       [  --with-mantype=man|cat|doc  Set man page type],
+       [
+diff -ur --unidirectional-new-file openntpd-3.9p1.old/defines.h 
openntpd-3.9p1/defines.h
+--- openntpd-3.9p1.old/defines.h       2006-05-14 07:29:21.000000000 +0200
++++ openntpd-3.9p1/defines.h   2008-02-07 13:14:34.488711868 +0100
+@@ -20,6 +20,10 @@
+ # define setproctitle(x)
+ #endif
+
++#ifdef USE_ADJTIMEX
++# define adjtime(a,b) (_compat_adjtime((a),(b)))
++#endif
++
+ #if !defined(SA_LEN)
+ # if defined(HAVE_STRUCT_SOCKADDR_SA_LEN)
+ #  define SA_LEN(x)   ((x)->sa_len)
+Only in openntpd-3.9p1.old: ntpd.0
+Only in openntpd-3.9p1.old: ntpd.conf.0
+diff -ur --unidirectional-new-file 
openntpd-3.9p1.old/openbsd-compat/Makefile.in 
openntpd-3.9p1/openbsd-compat/Makefile.in
+--- openntpd-3.9p1.old/openbsd-compat/Makefile.in      2006-05-14 
07:29:19.000000000 +0200
++++ openntpd-3.9p1/openbsd-compat/Makefile.in  2008-02-07 13:31:39.499728930 
+0100
+@@ -9,7 +9,7 @@
+ COMPAT=               atomicio.o bsd-arc4random.o bsd-misc.o bsd-poll.o \
+               bsd-snprintf.o bsd-getifaddrs.o bsd-setresuid.o \
+               bsd-setresgid.o fake-rfc2553.o
+-PORT=         port-qnx.o
++PORT=         port-linux.o port-qnx.o
+
+ VPATH=@srcdir@
+ CC=@CC@
+diff -ur --unidirectional-new-file 
openntpd-3.9p1.old/openbsd-compat/openbsd-compat.h 
openntpd-3.9p1/openbsd-compat/openbsd-compat.h
+--- openntpd-3.9p1.old/openbsd-compat/openbsd-compat.h 2006-05-14 
07:29:19.000000000 +0200
++++ openntpd-3.9p1/openbsd-compat/openbsd-compat.h     2008-02-07 
13:17:00.272366764 +0100
+@@ -46,6 +46,11 @@
+                 __attribute__((__format__ (printf, 2, 3)));
+ #endif
+
++#ifdef USE_ADJTIMEX
++# include <sys/time.h>
++int _compat_adjtime(const struct timeval *, struct timeval *);
++#endif
++
+ #ifndef HAVE_INET_PTON
+ int inet_pton(int, const char *, void *);
+ #endif
+diff -ur --unidirectional-new-file 
openntpd-3.9p1.old/openbsd-compat/port-linux.c 
openntpd-3.9p1/openbsd-compat/port-linux.c
+--- openntpd-3.9p1.old/openbsd-compat/port-linux.c     1970-01-01 
01:00:00.000000000 +0100
++++ openntpd-3.9p1/openbsd-compat/port-linux.c 2008-02-07 13:24:43.800366563 
+0100
+@@ -0,0 +1,105 @@
++
++
++/*
++ * Copyright (c) 2004 Darren Tucker <dtucker at zip com au>
++ *
++ * Permission to use, copy, modify, and distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#include "includes.h"
++
++#ifdef USE_ADJTIMEX
++#include <sys/timex.h>
++#include <errno.h>
++#ifdef adjtime
++# undef adjtime
++#endif
++
++#include "ntpd.h"
++
++/* scale factor used by adjtimex freq param.  1 ppm = 65536 */
++#define ADJTIMEX_FREQ_SCALE 65536
++
++/* maximum change to skew per adjustment, in PPM */
++#define MAX_SKEW_DELTA 5.0
++
++int
++_compat_adjtime(const struct timeval *delta, struct timeval *olddelta)
++{
++      static struct timeval tlast = {0,0};
++      static double tskew = 0;
++      static int synced = -1;
++      struct timeval tnow, tdelta;
++      double skew = 0, newskew, deltaskew, adjust, interval = 0;
++      struct timex tmx;
++      int result, saved_errno;
++
++      gettimeofday(&tnow, NULL);
++      adjust = (double)delta->tv_sec;
++      adjust += (double)delta->tv_usec / 1000000;
++
++      /* Even if the caller doesn't care about the olddelta, we do */
++      if (olddelta == NULL)
++              olddelta = &tdelta;
++
++      result = adjtime(delta, olddelta);
++      saved_errno = errno;
++
++      if (olddelta->tv_sec == 0 && olddelta->tv_usec == 0 &&
++          synced != INT_MAX)
++              synced++;
++       else
++              synced = 0;
++
++      /*
++       * do skew calculations if we have synced
++       */
++      if (synced == 0 ) {
++              tmx.modes = 0;
++              if (adjtimex(&tmx) == -1)
++                      log_warn("adjtimex get failed");
++              else
++                      tskew = (double)tmx.freq / ADJTIMEX_FREQ_SCALE;
++      } else if (synced >= 1) {
++              interval = (double)(tnow.tv_sec - tlast.tv_sec);
++              interval += (double)(tnow.tv_usec - tlast.tv_usec) / 1000000;
++
++              skew = (adjust * 1000000) / interval;
++              newskew = ((tskew * synced) + skew) / synced;
++              deltaskew = newskew - tskew;
++
++              if (deltaskew > MAX_SKEW_DELTA) {
++                      log_info("skew change %0.3lf exceeds limit", deltaskew);
++                      tskew += MAX_SKEW_DELTA;
++              } else if (deltaskew < -MAX_SKEW_DELTA) {
++                      log_info("skew change %0.3lf exceeds limit", deltaskew);
++                      tskew -= MAX_SKEW_DELTA;
++              } else {
++                      tskew = newskew;
++              }
++
++              /* Adjust the kernel skew.  */
++              tmx.freq = (long)(tskew * ADJTIMEX_FREQ_SCALE);
++              tmx.modes = ADJ_FREQUENCY;
++              if (adjtimex(&tmx) == -1)
++                      log_warn("adjtimex set freq failed");
++      }
++
++      log_debug("interval %0.3lf skew %0.3lf total skew %0.3lf", interval,
++          skew, tskew);
++
++      tlast = tnow;
++      errno = saved_errno;
++      return result;
++}
++#endif
diff --git a/source/network/openntpd/openntpd.service 
b/source/network/openntpd/openntpd.service
new file mode 100644
index 0000000..794caa6
--- /dev/null
+++ b/source/network/openntpd/openntpd.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=OpenNTP Daemon
+After=network.target
+
+[Service]
+EnvironmentFile=/etc/sysconfig/ntpd
+ExecStart=/usr/sbin/ntpd -d $PARAMS
+StandardOutput=syslog
+
+[Install]
+WantedBy=multi-user.target
diff --git a/source/network/openntpd/rc.ntpd b/source/network/openntpd/rc.ntpd
deleted file mode 100644
index c5ab9d7..0000000
--- a/source/network/openntpd/rc.ntpd
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/bash
-
-# (c) 2005 Marcus Habermehl <bmh198...@yahoo.de>
-# (c) 2004 Peter BARABAS <z...@artifact.hu>
-# rc.ntpd for Frugalware
-# distributed under GPL License
-
-# chkconfig: 2345 32 56
-# description: Starts or stops OpenNTPD
-
-source /lib/initscripts/functions
-TEXTDOMAIN=ntpd
-TEXTDOMAINDIR=/lib/initscripts/messages
-
-source /etc/sysconfig/ntpd
-
-actions=(restart status start stop)
-daemon=$"OpenNTPD"
-
-pid="pidof ntpd 2> /dev/null"
-
-rc_start()
-{
-       start_msg
-       if [[ "$(eval $pid)" == "" ]] ; then
-               /usr/sbin/ntpd $NTPD_OPTIONS
-               ok $?
-       else
-               ok 999
-       fi
-}
-
-rc_stop()
-{
-       stop_msg
-       if [[ "$(eval $pid)" != "" ]] ; then
-               killall ntpd
-               ok $?
-       else
-               ok 999
-       fi
-}
-
-rc_exec $1
-
-# vim: ft=sh
diff --git a/source/network/openntpd/rc.ntpd.pot 
b/source/network/openntpd/rc.ntpd.pot
deleted file mode 100644
index 93c3a9b..0000000
--- a/source/network/openntpd/rc.ntpd.pot
+++ /dev/null
@@ -1,20 +0,0 @@
-# rc.ntpd.
-# Copyright (C) YEAR THE rc.ntpd'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the rc.ntpd package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2005-12-05 20:49+0100\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <l...@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=CHARSET\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-msgid "OpenNTPD"
-msgstr ""
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to