diff options
-rw-r--r-- | net-misc/ntp/CVS/Entries | 11 | ||||
-rw-r--r-- | net-misc/ntp/CVS/Repository | 1 | ||||
-rw-r--r-- | net-misc/ntp/CVS/Root | 1 | ||||
-rw-r--r-- | net-misc/ntp/Manifest | 45 | ||||
-rw-r--r-- | net-misc/ntp/files/4.2.2_p2-zeroconf-enhanced.patch | 995 | ||||
-rw-r--r-- | net-misc/ntp/files/CVS/Entries | 33 | ||||
-rw-r--r-- | net-misc/ntp/files/CVS/Repository | 1 | ||||
-rw-r--r-- | net-misc/ntp/files/CVS/Root | 1 | ||||
-rw-r--r-- | net-misc/ntp/files/digest-ntp-4.2.2_p2 | 6 | ||||
-rw-r--r-- | net-misc/ntp/files/ntp-4.2.2_p2-sntp-header.patch | 11 | ||||
-rwxr-xr-x | net-misc/ntp/files/ntp-client-4.1.2.rc | 32 | ||||
-rw-r--r-- | net-misc/ntp/files/ntp-client.confd | 20 | ||||
-rw-r--r-- | net-misc/ntp/files/ntp-client.rc | 35 | ||||
-rw-r--r-- | net-misc/ntp/files/ntp.conf | 47 | ||||
-rw-r--r-- | net-misc/ntp/files/ntp.logrotate | 5 | ||||
-rw-r--r-- | net-misc/ntp/files/ntpd.confd | 6 | ||||
-rw-r--r-- | net-misc/ntp/files/ntpd.rc | 38 | ||||
-rw-r--r-- | net-misc/ntp/ntp-4.2.2_p2.ebuild | 146 |
18 files changed, 1434 insertions, 0 deletions
diff --git a/net-misc/ntp/CVS/Entries b/net-misc/ntp/CVS/Entries new file mode 100644 index 0000000..2579f91 --- /dev/null +++ b/net-misc/ntp/CVS/Entries @@ -0,0 +1,11 @@ +/metadata.xml/1.1/Sat Oct 4 16:43:31 2003// +D/files//// +/ntp-4.1.2.ebuild/1.41/Sun Jul 24 02:47:13 2005// +/ChangeLog/1.75/Mon Jul 31 21:30:30 2006// +/Manifest/1.123/Mon Jul 31 21:30:30 2006// +/ntp-4.2.0-r2.ebuild/1.26/Mon Jul 31 21:30:30 2006// +/ntp-4.2.0.20040617-r3.ebuild/1.5/Mon Jul 31 21:30:30 2006// +/ntp-4.2.0.20050303-r1.ebuild/1.6/Mon Jul 31 21:30:30 2006// +/ntp-4.2.0.20060224.ebuild/1.2/Thu May 25 22:33:48 2006// +/ntp-4.2.2.ebuild/1.1/Sat Jun 17 07:42:34 2006// +/ntp-4.2.2_p2.ebuild/1.1/Sun Jul 16 07:03:01 2006// diff --git a/net-misc/ntp/CVS/Repository b/net-misc/ntp/CVS/Repository new file mode 100644 index 0000000..fd6e6b3 --- /dev/null +++ b/net-misc/ntp/CVS/Repository @@ -0,0 +1 @@ +gentoo-x86/net-misc/ntp diff --git a/net-misc/ntp/CVS/Root b/net-misc/ntp/CVS/Root new file mode 100644 index 0000000..3295473 --- /dev/null +++ b/net-misc/ntp/CVS/Root @@ -0,0 +1 @@ +dberkholz@cvs.gentoo.org:/var/cvsroot diff --git a/net-misc/ntp/Manifest b/net-misc/ntp/Manifest new file mode 100644 index 0000000..e83ed75 --- /dev/null +++ b/net-misc/ntp/Manifest @@ -0,0 +1,45 @@ +AUX 4.2.2_p2-zeroconf-enhanced.patch 27411 RMD160 f3206d6a7b71176388d134f44f37f641270e99f3 SHA1 2e600889631744ad18ca72cf1f130a6807178c4d SHA256 d17a958fd5db41bd3cc5247c3f459620d0563ed3646b67778b6cc51d12602e5d +MD5 4cf5f0e4959839c400d230f00221e32c files/4.2.2_p2-zeroconf-enhanced.patch 27411 +RMD160 f3206d6a7b71176388d134f44f37f641270e99f3 files/4.2.2_p2-zeroconf-enhanced.patch 27411 +SHA256 d17a958fd5db41bd3cc5247c3f459620d0563ed3646b67778b6cc51d12602e5d files/4.2.2_p2-zeroconf-enhanced.patch 27411 +AUX ntp-4.2.2_p2-sntp-header.patch 239 RMD160 ef54dbe18e39ccfdc642f97ed03c26a8dd337002 SHA1 0573c0111df19d073f8dc7e5f2b954f17d0050e1 SHA256 3ccbbac286bd214d91ad5939d94e4d2b107cf954cc319997d31951fb2c523fc8 +MD5 6fff5d2793b5cd469e275757e33f5665 files/ntp-4.2.2_p2-sntp-header.patch 239 +RMD160 ef54dbe18e39ccfdc642f97ed03c26a8dd337002 files/ntp-4.2.2_p2-sntp-header.patch 239 +SHA256 3ccbbac286bd214d91ad5939d94e4d2b107cf954cc319997d31951fb2c523fc8 files/ntp-4.2.2_p2-sntp-header.patch 239 +AUX ntp-client-4.1.2.rc 840 RMD160 c59a65945c2b82159a5fb3daf0d0dc2ac2962945 SHA1 97d88ba47005a35bc54d00fc39f1b06eea651379 SHA256 fd49a2ced29d224ae1d802ffc2cdf65dc735c4c6562d646af74e8031aa215f99 +MD5 b8fc232f85be1313aee4c5a6f0048ca7 files/ntp-client-4.1.2.rc 840 +RMD160 c59a65945c2b82159a5fb3daf0d0dc2ac2962945 files/ntp-client-4.1.2.rc 840 +SHA256 fd49a2ced29d224ae1d802ffc2cdf65dc735c4c6562d646af74e8031aa215f99 files/ntp-client-4.1.2.rc 840 +AUX ntp-client.confd 747 RMD160 06c8312f745b6d532d41cb9f2319ef91c7d26c4a SHA1 5b1bf1d65683b66c284bee25e14b7f66fe21ec46 SHA256 fe0277d2b38cc52c2336b20fb46a62c20e2a273f025bbad6348a393aac4bb3ee +MD5 47d7106c23cb6ac99c5bbfdcd2f3a7fa files/ntp-client.confd 747 +RMD160 06c8312f745b6d532d41cb9f2319ef91c7d26c4a files/ntp-client.confd 747 +SHA256 fe0277d2b38cc52c2336b20fb46a62c20e2a273f025bbad6348a393aac4bb3ee files/ntp-client.confd 747 +AUX ntp-client.rc 933 RMD160 39a8545bdfa1677a9762eeebecac3adc888e7fd8 SHA1 c44e4b133f197a65ee6472c8fceafe80265766f7 SHA256 604aefe6f48040255ed563b424ce9cde9370ff824fa12adee553d19603278868 +MD5 5eecb47ab966b2003b73b8cbd371de40 files/ntp-client.rc 933 +RMD160 39a8545bdfa1677a9762eeebecac3adc888e7fd8 files/ntp-client.rc 933 +SHA256 604aefe6f48040255ed563b424ce9cde9370ff824fa12adee553d19603278868 files/ntp-client.rc 933 +AUX ntp.conf 1451 RMD160 530166d0908cbe0a812cb3b5d5d59b8e1d8457c5 SHA1 3625ed2aa71d9e0dd04634f32e65d83b76cfe780 SHA256 4dd53d6c91aa7680b8e9d9f3fd9f2406463286377a2864ddfc7c005f9928f500 +MD5 5bd3924f5720b97837969ec4ec4d5e09 files/ntp.conf 1451 +RMD160 530166d0908cbe0a812cb3b5d5d59b8e1d8457c5 files/ntp.conf 1451 +SHA256 4dd53d6c91aa7680b8e9d9f3fd9f2406463286377a2864ddfc7c005f9928f500 files/ntp.conf 1451 +AUX ntp.logrotate 50 RMD160 26e70f82cdc0c346bfb7458cdc09461d6da061ec SHA1 79c50930d2bfcbf27dd3d23727d580932a68e8b6 SHA256 2f0c759ec8659090f1996572dc5e78cb930b12b7aec8570d446dddd6f2fab599 +MD5 19b878e23991b3aa64868b35670385b7 files/ntp.logrotate 50 +RMD160 26e70f82cdc0c346bfb7458cdc09461d6da061ec files/ntp.logrotate 50 +SHA256 2f0c759ec8659090f1996572dc5e78cb930b12b7aec8570d446dddd6f2fab599 files/ntp.logrotate 50 +AUX ntpd.confd 189 RMD160 f66902d8abf5180ac8cc24646d665597cec8ba43 SHA1 f5fc6088e5f859f59b8a7a085da2193154a2c222 SHA256 a3bc17ee0f7d41102d6c33e4281e22d312a42cc2ffd8848b08e9cd78d63f2d05 +MD5 5e1591f145a63cf66ee20ab65495781a files/ntpd.confd 189 +RMD160 f66902d8abf5180ac8cc24646d665597cec8ba43 files/ntpd.confd 189 +SHA256 a3bc17ee0f7d41102d6c33e4281e22d312a42cc2ffd8848b08e9cd78d63f2d05 files/ntpd.confd 189 +AUX ntpd.rc 805 RMD160 5b8ab5a48bca9bdc8052d07092ecdda1a21f9c5b SHA1 1708ff0dbd6024c38863fb8dd788aabf44d08ca2 SHA256 26fe2367fc969cc0f7dc150d7ec218fef1e316eb0d72715e6f59344fe154673e +MD5 299ea30653b1e0b93d51f19e07176bc4 files/ntpd.rc 805 +RMD160 5b8ab5a48bca9bdc8052d07092ecdda1a21f9c5b files/ntpd.rc 805 +SHA256 26fe2367fc969cc0f7dc150d7ec218fef1e316eb0d72715e6f59344fe154673e files/ntpd.rc 805 +DIST ntp-4.2.2p2-manpages.tar.bz2 48744 RMD160 e684f7e0fc285b0cd469346859e9daf8ead413fc SHA1 da341206d762fe5797df1a82382ae4027445873e SHA256 1ca88851575e7cb2fc9c48409e26da89048ac78e4098f5a4f6d504846de28690 +DIST ntp-4.2.2p2.tar.gz 2563137 RMD160 3c4c01c902be0afe92dd15d52c746549bd26d27f SHA1 f43125e25138c7d4de1d054b4e6df8186ca30b8d SHA256 38105050bd0c6852e5ce03ee541ac726e75a838fe4925df1a8d63c016e26c923 +EBUILD ntp-4.2.2_p2.ebuild 4034 RMD160 b2cca77e33f2537dc1080e0bbf550558e549cf2a SHA1 363b470fa1b87e11c1721e1f4e576542d0a1ca18 SHA256 210ed03ba1e5e3fcb17b47eab2c8ebdca31f868ea1c19695bfe44015b289548c +MD5 51d3978b30c8b315b0989b107e8a9bc9 ntp-4.2.2_p2.ebuild 4034 +RMD160 b2cca77e33f2537dc1080e0bbf550558e549cf2a ntp-4.2.2_p2.ebuild 4034 +SHA256 210ed03ba1e5e3fcb17b47eab2c8ebdca31f868ea1c19695bfe44015b289548c ntp-4.2.2_p2.ebuild 4034 +MD5 931e77d23c1e3b08a64d33bcae4ffad0 files/digest-ntp-4.2.2_p2 500 +RMD160 97521f75396a8e083da6976773b7cb33cf5aa939 files/digest-ntp-4.2.2_p2 500 +SHA256 489fe8b95da6a304f6da89b5f4a39445a7c32d5afb6afe29b17164373d41fb4e files/digest-ntp-4.2.2_p2 500 diff --git a/net-misc/ntp/files/4.2.2_p2-zeroconf-enhanced.patch b/net-misc/ntp/files/4.2.2_p2-zeroconf-enhanced.patch new file mode 100644 index 0000000..6e63b73 --- /dev/null +++ b/net-misc/ntp/files/4.2.2_p2-zeroconf-enhanced.patch @@ -0,0 +1,995 @@ +https://ntp.isc.org/bugs/show_bug.cgi?id=578 attachment #241 + +I did improve the existing Zeroconf support, which only did support Apple's +Bonjour, a bit. + +After applying the patch the following Zeroconf implementations are supported: + + * Avahi (LGPL) + * Howl (A fork of Apple's Bonjour code) + * Apple's Bonjour + +--- ../ntp-dev-org/configure.ac 2006-03-07 09:42:15.000000000 +0100 ++++ configure.ac 2006-03-06 14:13:16.000000000 +0100 +@@ -329,14 +329,63 @@ + + AC_HEADER_STDC + AC_CHECK_HEADERS(bstring.h) +-AC_CHECK_HEADER(dns_sd.h, +- [AC_CHECK_LIB(dns_sd, +- DNSServiceRegister, +- [AC_DEFINE(HAVE_DNSREGISTRATION, 1, +- [Use Rendezvous/DNS-SD registration])])]) +-case "$ac_cv_lib_dns_sd_DNSServiceRegister" in +- yes) LIBS="-ldns_sd $LIBS" ;; ++ ++dnl The below section allows to compile the ntp distribution ++dnl with Zeroconf support. At the time there are three Zeroconf ++dnl implementations available: Avahi (LGPL), Howl and Bonjour. ++dnl The --with-zeroconf knob is used to enable Zeroconf support. ++ ++AC_ARG_WITH(zeroconf, ++ AC_HELP_STRING([--with-zeroconf], [- Compile with Zeroconf support?]), ++ [zero=$withval], [zero=no]) ++ ++case "$zero" in ++ yes) ++ # mDNS support using Apple's Bonjour ++ AC_CHECK_HEADER(dns_sd.h, ++ [AC_CHECK_LIB(dns_sd, ++ DNSServiceRegister, ++ [AC_DEFINE(HAVE_DNSREGISTRATION, 1, ++ [Use DNS-SD registration])])]) ++ case "$ac_cv_lib_dns_sd_DNSServiceRegister" in ++ yes) ++ LIBS="-ldns_sd $LIBS" ++ AC_DEFINE(HAVE_BONJOUR, 1, [Use Bonjour/DNS-SD registration]) ++ ;; ++ esac ++ # mDNS support using Porchdog's Howl ++ AC_CHECK_HEADER(howl.h, ++ [AC_CHECK_LIB(howl, ++ sw_discovery_publish, ++ [AC_DEFINE(HAVE_DNSREGISTRATION, 1, ++ [Use DNS-SD registration])])]) ++ case "$ac_cv_lib_howl_sw_discovery_publish" in ++ yes) ++ LIBS="-lhowl $LIBS" ++ AC_DEFINE(HAVE_HOWL, 1, [Use Howl/DNS-SD registration]) ++ ;; ++ esac ++ # mDNS support using Avahi ++ AC_CHECK_HEADER(avahi-client/client.h, ++ [AC_CHECK_LIB(avahi-client, ++ avahi_client_new, ++ [AC_DEFINE(HAVE_DNSREGISTRATION, 1, ++ [Use DNS-SD registration])])]) ++ case "$ac_cv_lib_avahi_client_avahi_client_new" in ++ yes) ++ PKG_CHECK_MODULES(AVAHI, [ avahi-client >= 0.6 ]) ++ PKG_CHECK_MODULES(AVAHI_TPOLL, [ avahi-client >= 0.6 ], ++ [AC_DEFINE(HAVE_AVAHI_THREADED_POLL, 1, [Uses Avahis threaded poll implementation])]) ++ AC_SUBST(AVAHI_CFLAGS) ++ AC_SUBST(AVAHI_LIBS) ++ LIBS="$AVAHI_LIBS $LIBS" ++ CFLAGS="$AVAHI_CFLAGS $CFLAGS" ++ AC_DEFINE(HAVE_AVAHI, 1, [Use Avahi/DNS-SD registration]) ++ ;; ++ esac ++ ;; + esac ++ + AC_CHECK_HEADERS(errno.h fcntl.h ieeefp.h math.h) + + # HMS: Lame, but fast. +--- ../ntp-dev-org/ntpd/Makefile.am 2006-03-07 09:42:34.000000000 +0100 ++++ ntpd/Makefile.am 2006-03-06 14:44:27.000000000 +0100 +@@ -31,7 +31,8 @@ + + # SIM: cmd_args.c ntp_config.c ntp_io.c ntpd.c + ntpsim.c (include/ntpsim.h) + # ntp_resolver.c is presently unused... +-ntpd_SOURCES = cmd_args.c ntp_config.c ntp_io.c ntpd.c ++ntpd_SOURCES = cmd_args.c ntp_config.c ntp_io.c ntpd.c \ ++ ntpd_zeroconf.h ntpd_zeroconf.c ntpd_avahi.c ntpd_bonjour.c ntpd_howl.c + ntpdsim_SOURCES = $(ntpd_SOURCES) ntpsim.c + libntpd_a_SOURCES = jupiter.h ntp_control.c \ + ntp_crypto.c ntp_filegen.c \ +--- ../ntp-dev-org/ntpd/ntpd_avahi.c 2006-03-07 09:54:58.000000000 +0100 ++++ ntpd/ntpd_avahi.c 2006-03-07 09:56:47.000000000 +0100 +@@ -0,0 +1,420 @@ ++/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ ++/* ++ * Author: Daniel S. Haischt <me@daniel.stefan.haischt.name> ++ * Purpose: Avahi based Zeroconf support ++ * Docs: http://avahi.org/download/doxygen/ ++ * ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include <config.h> ++#endif ++ ++#ifdef HAVE_AVAHI ++ ++#include "ntpd_avahi.h" ++ ++/* ++ * This function tries to register the NTP DNS ++ * SRV service type. ++ */ ++static void register_stuff(struct context *ctx) { ++ char r[128]; ++ int ret; ++ ++ assert(ctx->client); ++ ++ if (!ctx->group) { ++ ++ if (!(ctx->group = avahi_entry_group_new(ctx->client, ++ publish_reply, ++ ctx))) { ++ msyslog(LOG_ERR, ++ "Failed to create entry group: %s\n", ++ avahi_strerror(avahi_client_errno(ctx->client))); ++ goto fail; ++ } ++ ++ } ++ ++ msyslog(LOG_INFO, "Adding service '%s'\n", ctx->name); ++ ++ if (avahi_entry_group_is_empty(ctx->group)) { ++ /* Register our service */ ++ ++ if (avahi_entry_group_add_service(ctx->group, ++ AVAHI_IF_UNSPEC, ++ AVAHI_PROTO_UNSPEC, ++ 0, ++ ctx->name, ++ NTP_DNS_SERVICE_TYPE, ++ NULL, ++ NULL, ++ ctx->port, ++ NULL) < 0) { ++ msyslog(LOG_ERR, ++ "Failed to add service: %s\n", ++ avahi_strerror(avahi_client_errno(ctx->client))); ++ goto fail; ++ } ++ ++ if (avahi_entry_group_commit(ctx->group) < 0) { ++ msyslog(LOG_ERR, ++ "Failed to commit entry group: %s\n", ++ avahi_strerror(avahi_client_errno(ctx->client))); ++ goto fail; ++ } ++ } ++ ++ return; ++ ++ fail: ++ avahi_client_free (ctx->client); ++#ifndef HAVE_AVAHI_THREADED_POLL ++ avahi_simple_poll_quit(ctx->simple_poll); ++#else ++ avahi_threaded_poll_quit(ctx->threaded_poll); ++#endif ++} ++ ++/* Called when publishing of service data completes */ ++static void publish_reply(AvahiEntryGroup *g, ++ AvahiEntryGroupState state, ++ AVAHI_GCC_UNUSED void *userdata) ++{ ++ struct context *ctx = userdata; ++ ++ assert(g == ctx->group); ++ ++ switch (state) { ++ ++ case AVAHI_ENTRY_GROUP_ESTABLISHED : ++ /* The entry group has been established successfully */ ++ break; ++ ++ case AVAHI_ENTRY_GROUP_COLLISION: { ++ char *n; ++ ++ /* Pick a new name for our service */ ++ ++ n = avahi_alternative_service_name(ctx->name); ++ assert(n); ++ ++ avahi_free(ctx->name); ++ ctx->name = n; ++ ++ register_stuff(ctx); ++ break; ++ } ++ ++ case AVAHI_ENTRY_GROUP_FAILURE: { ++ msyslog(LOG_ERR, ++ "Failed to register service: %s\n", ++ avahi_strerror(avahi_client_errno(ctx->client))); ++ avahi_client_free (avahi_entry_group_get_client(g)); ++#ifndef HAVE_AVAHI_THREADED_POLL ++ avahi_simple_poll_quit(ctx->simple_poll); ++#else ++ avahi_threaded_poll_quit(ctx->threaded_poll); ++#endif ++ break; ++ } ++ ++ case AVAHI_ENTRY_GROUP_UNCOMMITED: ++ case AVAHI_ENTRY_GROUP_REGISTERING: ++ ; ++ } ++} ++ ++static void client_callback(AvahiClient *client, ++ AvahiClientState state, ++ void *userdata) ++{ ++ struct context *ctx = userdata; ++ ++ ctx->client = client; ++ ++ switch (state) { ++ ++ case AVAHI_CLIENT_S_RUNNING: ++ ++ /* The server has startup successfully and registered its host ++ * name on the network, so it's time to create our services */ ++ if (!ctx->group) ++ register_stuff(ctx); ++ break; ++ ++ case AVAHI_CLIENT_S_COLLISION: ++ ++ if (ctx->group) ++ avahi_entry_group_reset(ctx->group); ++ break; ++ ++ case AVAHI_CLIENT_FAILURE: { ++ ++ if (avahi_client_errno(client) == AVAHI_ERR_DISCONNECTED) { ++ int error; ++ ++ avahi_client_free(ctx->client); ++ ctx->client = NULL; ++ ctx->group = NULL; ++ ++ /* Reconnect to the server */ ++ ++#ifndef HAVE_AVAHI_THREADED_POLL ++ if (!(ctx->client = avahi_client_new(avahi_simple_poll_get(ctx->simple_poll), ++#else ++ if (!(ctx->client = avahi_client_new(avahi_threaded_poll_get(ctx->threaded_poll), ++#endif ++ AVAHI_CLIENT_NO_FAIL, ++ client_callback, ++ ctx, ++ &error))) { ++ ++ msyslog(LOG_ERR, "Failed to contact server: %s\n", avahi_strerror(error)); ++ ++ avahi_client_free (ctx->client); ++#ifndef HAVE_AVAHI_THREADED_POLL ++ avahi_simple_poll_quit(ctx->simple_poll); ++#else ++ avahi_threaded_poll_quit(ctx->threaded_poll); ++#endif ++ } ++ ++ } else { ++ msyslog(LOG_ERR, "Client failure: %s\n", avahi_strerror(avahi_client_errno(client))); ++ ++ avahi_client_free (ctx->client); ++#ifndef HAVE_AVAHI_THREADED_POLL ++ avahi_simple_poll_quit(ctx->simple_poll); ++#else ++ avahi_threaded_poll_quit(ctx->threaded_poll); ++#endif ++ } ++ ++ break; ++ } ++ ++ case AVAHI_CLIENT_S_REGISTERING: ++ case AVAHI_CLIENT_CONNECTING: ++ ; ++ } ++} ++ ++/* ++ * Tries to setup the Zeroconf thread and any ++ * neccessary config setting. ++ */ ++void* av_zeroconf_setup(unsigned long port, const char *name) { ++ struct context *ctx = NULL; ++ ++ /* default service name, if there's none in ++ * the config file. ++ */ ++ char service[256] = "NTP Server on "; ++ int error, ret; ++ ++ /* initialize the struct that holds our ++ * config settings. ++ */ ++ ctx = malloc(sizeof(struct context)); ++ assert(ctx); ++ ctx->client = NULL; ++ ctx->group = NULL; ++#ifndef HAVE_AVAHI_THREADED_POLL ++ ctx->simple_poll = NULL; ++#else ++ ctx->threaded_poll = NULL; ++#endif ++ ctx->thread_running = 0; ++ ctx->port = port; ++ pthread_mutex_init(&ctx->mutex, NULL); ++ ++ /* Prepare service name */ ++ if (!name) { ++ msyslog(LOG_INFO, "Assigning default service name.\n"); ++ gethostname(service+14, sizeof(service)-15); ++ service[sizeof(service)-1] = 0; ++ ++ ctx->name = strdup(service); ++ } ++ else { ++ ctx->name = strdup(name); ++ } ++ ++ assert(ctx->name); ++ ++/* first of all we need to initialize our threading env */ ++#ifdef HAVE_AVAHI_THREADED_POLL ++ if (!(ctx->threaded_poll = avahi_threaded_poll_new())) { ++ return; ++ } ++#else ++ avahi_simple_poll_set_func(ctx->simple_poll, poll_func, &ctx->mutex); ++ ++ if (!(ctx->simple_poll = avahi_simple_poll_new())) { ++ msyslog(LOG_ERR, "Failed to create event loop object.\n"); ++ goto fail; ++ } ++#endif ++ ++/* now we need to acquire a client */ ++#ifdef HAVE_AVAHI_THREADED_POLL ++ if (!(ctx->client = avahi_client_new(avahi_threaded_poll_get(ctx->threaded_poll), ++ AVAHI_CLIENT_NO_FAIL, ++ client_callback, ++ ctx, ++ &error))) { ++ msyslog(LOG_ERR, ++ "Failed to create client object: %s\n", ++ avahi_strerror(avahi_client_errno(ctx->client))); ++ goto fail; ++ } ++#else ++ if (!(ctx->client = avahi_client_new(avahi_simple_poll_get(ctx->simple_poll), ++ AVAHI_CLIENT_NO_FAIL, ++ client_callback, ++ ctx, ++ &error))) { ++ msyslog(LOG_ERR, ++ "Failed to create client object: %s\n", ++ avahi_strerror(avahi_client_errno(ctx->client))); ++ goto fail; ++ } ++#endif ++ ++ return ctx; ++ ++fail: ++ ++ if (ctx) ++ av_zeroconf_unregister(ctx); ++ ++ return NULL; ++} ++ ++/* ++ * This function finally runs the loop impl. ++ */ ++int av_zeroconf_run(void *u) { ++ struct context *ctx = u; ++ int ret; ++ ++#ifdef HAVE_AVAHI_THREADED_POLL ++ /* Finally, start the event loop thread */ ++ if (avahi_threaded_poll_start(ctx->threaded_poll) < 0) { ++ msyslog(LOG_ERR, ++ "Failed to create thread: %s\n", ++ avahi_strerror(avahi_client_errno(ctx->client))); ++ goto fail; ++ } else { ++ msyslog(LOG_INFO, "Successfully started avahi loop.\n"); ++ } ++#else ++ /* Create the mDNS event handler */ ++ if ((ret = pthread_create(&ctx->thread_id, NULL, thread, ctx)) < 0) { ++ msyslog(LOG_ERR, "Failed to create thread: %s\n", strerror(ret)); ++ goto fail; ++ } else { ++ msyslog(LOG_INFO, "Successfully started avahi loop.\n"); ++ } ++#endif ++ ++ ctx->thread_running = 1; ++ ++ return 0; ++ ++fail: ++ ++ if (ctx) ++ av_zeroconf_unregister(ctx); ++ ++ return -1; ++} ++ ++/* ++ * Used to lock access to the loop. ++ * Currently unused. ++ */ ++void av_zeroconf_lock(void *u) { ++ struct context *ctx = u; ++ ++ avahi_threaded_poll_lock(ctx->threaded_poll); ++} ++ ++/* ++ * Used to unlock access to the loop. ++ * Currently unused. ++ */ ++void av_zeroconf_unlock(void *u) { ++ struct context *ctx = u; ++ ++ avahi_threaded_poll_unlock(ctx->threaded_poll); ++} ++ ++/* ++ * Tries to shutdown this loop impl. ++ * Call this function from outside this thread. ++ */ ++void av_zeroconf_shutdown(void *u) { ++ struct context *ctx = u; ++ ++ /* Call this when the app shuts down */ ++#ifdef HAVE_AVAHI_THREADED_POLL ++ avahi_threaded_poll_stop(ctx->threaded_poll); ++ avahi_free(ctx->name); ++ avahi_client_free(ctx->client); ++ avahi_threaded_poll_free(ctx->threaded_poll); ++#else ++ av_zeroconf_unregister(ctx); ++#endif ++} ++ ++/* ++ * Tries to shutdown this loop impl. ++ * Call this function from inside this thread. ++ */ ++int av_zeroconf_unregister(void *u) { ++ struct context *ctx = u; ++ ++ if (ctx->thread_running) { ++#ifndef HAVE_AVAHI_THREADED_POLL ++ pthread_mutex_lock(&ctx->mutex); ++ avahi_simple_poll_quit(ctx->simple_poll); ++ pthread_mutex_unlock(&ctx->mutex); ++ ++ pthread_join(ctx->thread_id, NULL); ++#else ++ /* First, block the event loop */ ++ avahi_threaded_poll_lock(ctx->threaded_poll); ++ ++ /* Than, do your stuff */ ++ avahi_threaded_poll_quit(ctx->threaded_poll); ++ ++ /* Finally, unblock the event loop */ ++ avahi_threaded_poll_unlock(ctx->threaded_poll); ++#endif ++ ctx->thread_running = 0; ++ } ++ ++ avahi_free(ctx->name); ++ ++ if (ctx->client) ++ avahi_client_free(ctx->client); ++ ++#ifndef HAVE_AVAHI_THREADED_POLL ++ if (ctx->simple_poll) ++ avahi_simple_poll_free(ctx->simple_poll); ++ ++ pthread_mutex_destroy(&ctx->mutex); ++#else ++ if (ctx->threaded_poll) ++ avahi_threaded_poll_free(ctx->threaded_poll); ++#endif ++ ++ free(ctx); ++ ++ return 0; ++} ++ ++#endif /* USE_AVAHI */ +--- ../ntp-dev-org/ntpd/ntpd_avahi.h 2006-03-07 09:54:57.000000000 +0100 ++++ ntpd/ntpd_avahi.h 2006-03-07 09:57:03.000000000 +0100 +@@ -0,0 +1,60 @@ ++/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ ++/* ++ * Author: Daniel S. Haischt <me@daniel.stefan.haischt.name> ++ * Purpose: Avahi based Zeroconf support ++ * Docs: http://avahi.org/download/doxygen/ ++ * ++ */ ++ ++#ifndef _NTPD_AVAHI_H ++#define _NTPD_AVAHI_H ++ ++#include <stdlib.h> ++#include <assert.h> ++#include <string.h> ++ ++#include <avahi-client/client.h> ++#include <avahi-client/publish.h> ++ ++#include <avahi-common/alternative.h> ++ ++#ifndef HAVE_AVAHI_THREADED_POLL ++#include <avahi-common/simple-watch.h> ++#else ++#include <avahi-common/thread-watch.h> ++#endif ++ ++#include <avahi-common/malloc.h> ++#include <avahi-common/error.h> ++ ++#include "ntp_syslog.h" /* mysyslog() */ ++ ++#define NTP_DNS_SERVICE_TYPE "_ntp._udp" ++ ++struct context { ++ int thread_running; ++ pthread_t thread_id; ++ pthread_mutex_t mutex; ++ char *name; ++#ifndef HAVE_AVAHI_THREADED_POLL ++ AvahiSimplePoll *simple_poll; ++#else ++ AvahiThreadedPoll *threaded_poll; ++#endif ++ AvahiClient *client; ++ AvahiEntryGroup *group; ++ unsigned long port; ++}; ++ ++/* prototype definitions */ ++void* av_zeroconf_setup(unsigned long, const char *); ++int av_zeroconf_run(void*); ++int av_zeroconf_unregister(void*); ++void av_zeroconf_shutdown(void*); ++void av_zeroconf_lock(void *); ++void av_zeroconf_unlock(void *); ++static void publish_reply(AvahiEntryGroup *g, ++ AvahiEntryGroupState state, ++ void *userdata); ++ ++#endif /* _NTPD_AVAHI_H */ +--- ../ntp-dev-org/ntpd/ntpd_bonjour.h 2006-03-07 09:55:02.000000000 +0100 ++++ ntpd/ntpd_bonjour.h 2006-03-07 09:58:13.000000000 +0100 +@@ -0,0 +1,39 @@ ++/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ ++/* ++ * Author: Daniel S. Haischt <me@daniel.stefan.haischt.name> ++ * Purpose: Bonjour based Zeroconf support ++ * Docs: http://developer.apple.com/documentation/Networking/Reference/DNSServiceDiscovery_CRef/dns_sd/ ++ * ++ */ ++ ++#ifndef _NTPD_BONJOUR_H ++#define _NTPD_BONJOUR_H ++ ++#include <stdlib.h> ++#include <assert.h> ++#include <string.h> ++ ++#include <dns_sd.h> /* DNSServiceRegister(), DNSServiceDiscoveryDeallocate() */ ++ ++#include "ntp_syslog.h" /* mysyslog() */ ++ ++#define NTP_DNS_SERVICE_TYPE "_ntp._udp" ++ ++/* prototype definitions */ ++void* bo_zeroconf_setup(unsigned long, const char *); ++int bo_zeroconf_unregister(void); ++int bo_zeroconf_run(void); ++#ifdef SYS_WINNT ++static void DNSSD_API ++#else ++static void ++#endif ++publish_reply(DNSServiceRef, ++ const DNSServiceFlags, ++ DNSServiceErrorType, ++ const char *, ++ const char *, ++ const char *, ++ void *); ++ ++#endif /* _NTPD_BONJOUR_H */ +--- ../ntp-dev-org/ntpd/ntpd_bonjour.c 2006-03-07 09:55:01.000000000 +0100 ++++ ntpd/ntpd_bonjour.c 2006-03-07 09:57:54.000000000 +0100 +@@ -0,0 +1,103 @@ ++/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ ++/* ++ * Author: Daniel S. Haischt <me@daniel.stefan.haischt.name> ++ * Purpose: Bonjour based Zeroconf support ++ * Docs: http://developer.apple.com/documentation/Networking/Reference/DNSServiceDiscovery_CRef/dns_sd/ ++ * ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include <config.h> ++#endif ++ ++#ifdef HAVE_BONJOUR ++ ++#include "ntpd_bonjour.h" ++ ++DNSServiceRef publish_session = NULL; ++ ++static void DNSSD_API ++publish_reply (DNSServiceRef sdRef, ++ const DNSServiceFlags flags, ++ DNSServiceErrorType errorCode, ++ const char *name, ++ const char *regtype, ++ const char *domain, ++ void *context) ++{ ++} ++ ++void* bo_zeroconf_setup(unsigned long port, const char *name) { ++ DNSServiceErrorType err; ++ char service[256] = "NTP Server on "; ++ ++ /* Prepare service name */ ++ if (!name) { ++ out_log(LEVEL_INFO, "Assigning default service name.\n"); ++ gethostname(service+14, sizeof(service)-15); ++ service[sizeof(service)-1] = 0; ++ ++ name = strdup(service); ++ } ++ ++ assert(name); ++ assert(port); ++ ++ err = DNSServiceRegister (&publish_session, ++ 0, /* flags */ ++ 0, /* interface; 0 for all */ ++ name, /* name */ ++ FTP_DNS_SERVICE_TYPE, /* type */ ++ NULL, /* domain */ ++ NULL, /* hostname */ ++ htons (port), /* port in network byte order */ ++ 0, /* text record length */ ++ NULL, /* text record */ ++ publish_reply, /* callback */ ++ NULL); /* context */ ++ ++ if (err == kDNSServiceErr_NoError) { ++ out_log(LEVEL_INFO, "Adding service '%s'\n", name); ++ } else { ++ out_log(LEVEL_CRITICAL, "Adding service '%s' failed\n", name); ++ bo_zeroconf_unregister(); ++ } ++} ++ ++int bo_zeroconf_run(void) { ++ fd_set set; ++ int fd; ++ struct timeval timeout; ++ ++ /* Initialize the file descriptor set. */ ++ FD_ZERO (&set); ++ FD_SET (fd, &set); ++ ++ /* Initialize the timeout data structure. */ ++ /* TODO: Should the value for sec be configurable? */ ++ timeout.tv_sec = 10; ++ timeout.tv_usec = 0; ++ ++ if (publish_session != NULL) { ++ fd = DNSServiceRefSockFD(publish_session); ++ ++ if (select(FD_SETSIZE, ++ &set, NULL, NULL, ++ &timeout) > 0) { ++ DNSServiceProcessResult(publish_session); ++ } ++ } ++ ++ return 0; ++} ++ ++int bo_zeroconf_unregister(void) { ++ if (publish_session != NULL) { ++ DNSServiceRefDeallocate(publish_session); ++ publish_session = NULL; ++ } ++ ++ return 0; ++} ++ ++#endif /* HAVE_BONJOUR */ +--- ../ntp-dev-org/ntpd/ntpd_howl.c 2006-03-07 09:55:05.000000000 +0100 ++++ ntpd/ntpd_howl.c 2006-03-07 09:58:52.000000000 +0100 +@@ -0,0 +1,86 @@ ++/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ ++/* ++ * Author: Daniel S. Haischt <me@daniel.stefan.haischt.name> ++ * Purpose: Howl based Zeroconf support ++ * Doc: http://www.porchdogsoft.com/products/howl/docs/ ++ * ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include <config.h> ++#endif ++ ++#ifdef HAVE_HOWL ++ ++#include "ntpd_howl.h" ++ ++sw_discovery discovery = NULL; ++ ++static sw_result HOWL_API publish_reply(sw_discovery discovery, ++ sw_discovery_oid oid, ++ sw_discovery_publish_status status, ++ sw_opaque extra) { ++ static sw_string ++ status_text[] = ++ { ++ "Started", ++ "Stopped", ++ "Name Collision", ++ "Invalid" ++ }; ++ ++ msyslog(LOG_INFO, "publish reply: %s\n", status_text[status]); ++ return SW_OKAY; ++} ++ ++void* ho_zeroconf_setup(unsigned long port, const char *name) { ++ sw_result result; ++ sw_discovery_publish_id id; ++ char service[256] = "NTP Server on "; ++ ++ if (sw_discovery_init (&discovery) != SW_OKAY) { ++ msyslog(LOG_ERR, ++ "NTPD could not be started. \nTry running mDNSResponder."); ++ return; ++ } ++ ++ /* Prepare service name */ ++ if (!name) { ++ msyslog(LOG_INFO, "Assigning default service name.\n"); ++ gethostname(service+14, sizeof(service)-15); ++ service[sizeof(service)-1] = 0; ++ ++ name = strdup(service); ++ } ++ ++ assert(name); ++ ++ if (!(result = sw_discovery_publish (discovery, ++ 0, ++ name, ++ NTP_DNS_SERVICE_TYPE, ++ NULL, ++ NULL, ++ port, ++ NULL, ++ 0, ++ publish_reply, ++ NULL, ++ &id)) != SW_OKAY) { ++ msyslog(LOG_INFO, "Adding service '%s'\n", name); ++ } else { ++ msyslog(LOG_ERR, "Adding service '%s' failed\n", name); ++ ho_zeroconf_unregister(); ++ } ++} ++ ++void* ho_zeroconf_run(void) { ++ sw_discovery_run(discovery); ++} ++ ++void* ho_zeroconf_unregister(void) { ++ sw_discovery_stop_run(discovery); ++ sw_discovery_fina(discovery); ++} ++ ++#endif /* USE_HOWL */ +--- ../ntp-dev-org/ntpd/ntpd_howl.h 2006-03-07 09:55:05.000000000 +0100 ++++ ntpd/ntpd_howl.h 2006-03-07 09:59:06.000000000 +0100 +@@ -0,0 +1,31 @@ ++/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ ++/* ++ * Author: Daniel S. Haischt <me@daniel.stefan.haischt.name> ++ * Purpose: Howl based Zeroconf support ++ * Doc: http://www.porchdogsoft.com/products/howl/docs/ ++ * ++ */ ++ ++#ifndef _NTPD_HOWL_H ++#define _NTPD_HOWL_H ++ ++#include <stdlib.h> ++#include <assert.h> ++#include <string.h> ++ ++#include <howl.h> ++ ++#include "ntp_syslog.h" /* mysyslog() */ ++ ++#define NTP_DNS_SERVICE_TYPE "_ntp._udp" ++ ++/* prototype definitions */ ++void* ho_zeroconf_setup(unsigned long, const char *); ++void* ho_zeroconf_unregister(void); ++void* ho_zeroconf_run(void); ++static sw_result HOWL_API publish_reply(sw_discovery, ++ sw_discovery_oid, ++ sw_discovery_publish_status, ++ sw_opaque); ++ ++#endif /* _NTPD_HOWL_H */ +--- ../ntp-dev-org/ntpd/ntpd_zeroconf.h 2006-03-07 09:55:09.000000000 +0100 ++++ ntpd/ntpd_zeroconf.h 2006-03-07 09:59:51.000000000 +0100 +@@ -0,0 +1,41 @@ ++/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ ++/* ++ * Author: Daniel S. Haischt <me@daniel.stefan.haischt.name> ++ * Purpose: Zeroconf facade, that abstracts access to a ++ * particular Zeroconf implementation ++ * Doc: http://www.dns-sd.org/ ++ * ++ */ ++ ++#ifndef _NTPD_ZEROCONF_H ++#define _NTPD_ZEROCONF_H ++ ++#include <netinet/in.h> /* htons() */ ++ ++#include "ntp_fp.h" ++#include "ntp.h" /* NTP_PORT */ ++#include "ntp_stdlib.h" /* mysyslog() */ ++ ++# ifdef HAVE_BONJOUR ++# include "ntpd_bonjour.h" ++# elif defined (HAVE_HOWL) ++# include "ntpd_howl.h" ++# elif defined (HAVE_AVAHI) ++# include "ntpd_avahi.h" ++# endif ++ ++/* ++ * Prototype Definitions ++ */ ++ ++/* ++ * registers the ntpd service with a particular Zerconf implemenation. ++ */ ++void zeroconf_register(void); ++ ++/* ++ * de-registers the ntpd service with a particular Zerconf implemenation. ++ */ ++void zeroconf_deregister(void); ++ ++#endif /* _NTPD_ZEROCONF_H */ +--- ../ntp-dev-org/ntpd/ntpd_zeroconf.c 2006-03-07 09:55:08.000000000 +0100 ++++ ntpd/ntpd_zeroconf.c 2006-03-07 10:00:04.000000000 +0100 +@@ -0,0 +1,56 @@ ++/* -*- Mode: C; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */ ++/* ++ * Author: Daniel S. Haischt <me@daniel.stefan.haischt.name> ++ * Purpose: Zeroconf facade, that abstracts access to a ++ * particular Zeroconf implementation ++ * Doc: http://www.dns-sd.org/ ++ * ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include <config.h> ++#endif ++ ++#include "ntpd_zeroconf.h" ++ ++/* ++ * Global Definitions ++ */ ++#ifdef HAVE_AVAHI ++struct context *ctx = NULL; ++#endif ++ ++/* ++ * Functions (actually they are just facades) ++ */ ++void zeroconf_register(void) ++{ ++#ifdef HAVE_BONJOUR ++ msyslog(LOG_INFO, "Attemping to register mDNS using Apple's Bonjour\n"); ++ bo_zeroconf_setup(htons(NTP_PORT), NULL); ++ bo_zeroconf_run(); ++#elif defined (HAVE_HOWL) ++ msyslog(LOG_INFO, "Attemping to register mDNS using Porchdog's Howl\n"); ++ ho_zeroconf_setup(NTP_PORT, NULL); ++ bo_zeroconf_run(); ++#elif defined (HAVE_AVAHI) ++ msyslog(LOG_INFO, "Attemping to register mDNS using Avahi\n"); ++ ctx = av_zeroconf_setup(htons(NTP_PORT), NULL); ++ av_zeroconf_run(ctx); ++#endif ++} ++ ++void zeroconf_deregister(void) ++{ ++#ifdef HAVE_BONJOUR ++ msyslog(LOG_INFO, "Attemping to de-register mDNS using Apple's Bonjour\n"); ++ bo_zeroconf_unregister(); ++#elif defined (HAVE_HOWL) ++ msyslog(LOG_INFO, "Attemping to de-register mDNS using Porchdog's Howl\n"); ++ ho_zeroconf_unregister(); ++#elif defined (HAVE_AVAHI) ++ msyslog(LOG_INFO, "Attemping to de-register mDNS using Avahi\n"); ++ if (ctx) ++ av_zeroconf_shutdown(ctx); ++#endif ++} +--- ../ntp-dev-org/ntpd/ntpd.c 2006-03-07 09:42:37.000000000 +0100 ++++ ntpd/ntpd.c 2006-03-06 15:02:02.000000000 +0100 +@@ -130,9 +130,12 @@ + # define SIGDIE4 SIGTERM + #endif /* SYS_WINNT */ + ++/* ++ * setup zero configuration networking ++ * if the system supports it. ++ */ + #ifdef HAVE_DNSREGISTRATION +-#include <dns_sd.h> +-DNSServiceRef mdns; ++# include "ntpd_zeroconf.h" + #endif + + /* +@@ -477,10 +480,7 @@ + ntp_srandom((int)(now.l_i * now.l_uf)); + + #ifdef HAVE_DNSREGISTRATION +- msyslog(LOG_INFO, "Attemping to register mDNS\n"); +- if ( DNSServiceRegister (&mdns, 0, 0, NULL, "_ntp._udp", NULL, NULL, htons(NTP_PORT), 0, NULL, NULL, NULL) != kDNSServiceErr_NoError ) { +- msyslog(LOG_ERR, "Unable to register mDNS\n"); +- } ++ zeroconf_register(); + #endif + + #if !defined(VMS) +@@ -991,8 +991,7 @@ + + msyslog(LOG_NOTICE, "ntpd exiting on signal %d", sig); + #ifdef HAVE_DNSREGISTRATION +- if (mdns != NULL) +- DNSServiceRefDeallocate(mdns); ++ zeroconf_deregister(); + #endif + + switch (sig) diff --git a/net-misc/ntp/files/CVS/Entries b/net-misc/ntp/files/CVS/Entries new file mode 100644 index 0000000..fd9a81e --- /dev/null +++ b/net-misc/ntp/files/CVS/Entries @@ -0,0 +1,33 @@ +/4.1.2-droproot.patch/1.1/Wed Aug 6 07:42:24 2003// +/4.2.0-droproot.patch/1.1/Sat Feb 14 22:58:02 2004// +/4.2.0-linux-config-phone.patch/1.1/Sat Feb 14 22:58:02 2004// +/4.2.0-ntpdate-quiet.patch/1.1/Sat Feb 14 22:58:02 2004// +/broadcastclient.patch/1.1/Wed Aug 6 07:42:24 2003// +/linux-config-phone.patch/1.1/Thu Jan 2 03:00:50 2003// +/ntp-client-4.1.2.rc/1.2/Thu Jul 15 00:05:46 2004// +/ntpd-4.1.2.rc/1.3/Thu Jul 15 00:05:46 2004// +/ntp-4.1.1b-syscall-libc.patch/1.2/Wed Nov 17 03:10:19 2004// +/ntp.conf/1.17/Wed Jan 19 16:30:48 2005// +/ntp-4.2.0-gcc4.patch/1.1/Fri Apr 15 22:22:19 2005// +/4.2.0.20040617-hostname.patch/1.1/Fri May 6 16:57:58 2005// +/4.2.0.20040617-ipv6-fixes.patch/1.1/Fri May 6 16:57:58 2005// +/ntp-client.rc/1.8/Tue May 24 21:05:32 2005// +/4.2.0.20040617-debug-fix.patch/1.2/Sun Jul 24 02:47:13 2005// +/4.2.0.20040617-errno-fix.patch/1.2/Sun Jul 24 02:47:13 2005// +/4.2.0.20040617-freebsd.patch/1.2/Sun Jul 24 02:47:13 2005// +/ntp-4.2.0.20050303-rlimit-memlock.patch/1.1/Tue Aug 16 03:24:36 2005// +/ntp-client.confd/1.11/Sun Aug 21 00:13:31 2005// +/ntpd-4.1.2.confd/1.3/Sun Aug 21 00:13:31 2005// +/ntpd.confd/1.16/Sun Aug 21 00:13:31 2005// +/ntpd.rc/1.22/Sun Aug 21 00:13:31 2005// +/ntp-4.2.0-ntpd-using-wrong-group.patch/1.1/Thu Aug 25 22:10:40 2005// +/ntp.logrotate/1.1/Fri Jan 20 00:56:08 2006// +/digest-ntp-4.1.2/1.2/Mon Jul 31 21:30:30 2006// +/digest-ntp-4.2.0-r2/1.3/Mon Jul 31 21:30:30 2006// +/digest-ntp-4.2.0.20040617-r3/1.2/Mon Jul 31 21:30:30 2006// +/digest-ntp-4.2.0.20050303-r1/1.2/Mon Jul 31 21:30:30 2006// +/digest-ntp-4.2.0.20060224/1.1/Thu May 4 01:10:07 2006// +/digest-ntp-4.2.2/1.1/Sat Jun 17 07:42:34 2006// +/digest-ntp-4.2.2_p2/1.1/Sun Jul 16 07:03:01 2006// +/ntp-4.2.2_p2-sntp-header.patch/1.1/Sun Jul 16 07:03:01 2006// +D diff --git a/net-misc/ntp/files/CVS/Repository b/net-misc/ntp/files/CVS/Repository new file mode 100644 index 0000000..5588f4b --- /dev/null +++ b/net-misc/ntp/files/CVS/Repository @@ -0,0 +1 @@ +gentoo-x86/net-misc/ntp/files diff --git a/net-misc/ntp/files/CVS/Root b/net-misc/ntp/files/CVS/Root new file mode 100644 index 0000000..3295473 --- /dev/null +++ b/net-misc/ntp/files/CVS/Root @@ -0,0 +1 @@ +dberkholz@cvs.gentoo.org:/var/cvsroot diff --git a/net-misc/ntp/files/digest-ntp-4.2.2_p2 b/net-misc/ntp/files/digest-ntp-4.2.2_p2 new file mode 100644 index 0000000..9bf17bb --- /dev/null +++ b/net-misc/ntp/files/digest-ntp-4.2.2_p2 @@ -0,0 +1,6 @@ +MD5 d42b28df83b9c08850f5b92d4f17a8a3 ntp-4.2.2p2-manpages.tar.bz2 48744 +RMD160 e684f7e0fc285b0cd469346859e9daf8ead413fc ntp-4.2.2p2-manpages.tar.bz2 48744 +SHA256 1ca88851575e7cb2fc9c48409e26da89048ac78e4098f5a4f6d504846de28690 ntp-4.2.2p2-manpages.tar.bz2 48744 +MD5 5c6ca6fab651c9cb21754a6478b8650e ntp-4.2.2p2.tar.gz 2563137 +RMD160 3c4c01c902be0afe92dd15d52c746549bd26d27f ntp-4.2.2p2.tar.gz 2563137 +SHA256 38105050bd0c6852e5ce03ee541ac726e75a838fe4925df1a8d63c016e26c923 ntp-4.2.2p2.tar.gz 2563137 diff --git a/net-misc/ntp/files/ntp-4.2.2_p2-sntp-header.patch b/net-misc/ntp/files/ntp-4.2.2_p2-sntp-header.patch new file mode 100644 index 0000000..039a566 --- /dev/null +++ b/net-misc/ntp/files/ntp-4.2.2_p2-sntp-header.patch @@ -0,0 +1,11 @@ +--- ntp-4.2.2p2/sntp/socket.c 2006-07-09 07:01:46.000000000 -0400 ++++ ntp-4.2.2/sntp/socket.c 2006-06-06 16:17:16.000000000 -0400 +@@ -8,8 +8,6 @@ + + + +-#include "config.h" +- + #include "header.h" + #include "internet.h" + #include <fcntl.h> diff --git a/net-misc/ntp/files/ntp-client-4.1.2.rc b/net-misc/ntp/files/ntp-client-4.1.2.rc new file mode 100755 index 0000000..2d80a4e --- /dev/null +++ b/net-misc/ntp/files/ntp-client-4.1.2.rc @@ -0,0 +1,32 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/ntp/files/ntp-client-4.1.2.rc,v 1.2 2004/07/15 00:05:46 agriffis Exp $ + +depend() { + before cron + need net + use dns logger +} + +checkconfig() { + if [ ! -x "`which ${NTPCLIENT_CMD} 2>/dev/null`" ] ; then + eerror "Please edit /etc/conf.d/ntp-client" + eerror "Unable to locate the client command ${NTPCLIENT_CMD}!" + return 1 + fi + if [ -z "${NTPCLIENT_OPTS}" ] ; then + eerror "Please edit /etc/conf.d/ntp-client" + eerror "I need to know what server/options to use!" + return 1 + fi + return 0 +} + +start() { + checkconfig || return $? + + ebegin "Setting clock via the ntp client '${NTPCLIENT_CMD}'" + ${NTPCLIENT_CMD} >/dev/null ${NTPCLIENT_OPTS} + eend $? "Failed to set clock" +} diff --git a/net-misc/ntp/files/ntp-client.confd b/net-misc/ntp/files/ntp-client.confd new file mode 100644 index 0000000..44affac --- /dev/null +++ b/net-misc/ntp/files/ntp-client.confd @@ -0,0 +1,20 @@ +# /etc/conf.d/ntp-client + +# Command to run to set the clock initially +# Most people should just leave this line alone ... +# however, if you know what you're doing, and you +# want to use ntpd to set the clock, change this to 'ntpd' +NTPCLIENT_CMD="ntpdate" + +# Options to pass to the above command +# This default setting should work fine but you should +# change the default 'pool.ntp.org' to something closer +# to your machine. See http://www.pool.ntp.org/ or +# try running `netselect -s 3 pool.ntp.org`. +NTPCLIENT_OPTS="-Q -b -u pool.ntp.org" + +# How long to wait (in seconds) before giving up. +# Useful for when you boot and DNS/internet isn't +# really available but you have your net interface +# come up with say a static IP. +NTPCLIENT_TIMEOUT=30 diff --git a/net-misc/ntp/files/ntp-client.rc b/net-misc/ntp/files/ntp-client.rc new file mode 100644 index 0000000..d8b86ba --- /dev/null +++ b/net-misc/ntp/files/ntp-client.rc @@ -0,0 +1,35 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/ntp/files/ntp-client.rc,v 1.8 2005/05/14 19:12:04 vapier Exp $ + +depend() { + before cron portmap + need net + use dns logger +} + +checkconfig() { + if [ ! -x "`which ${NTPCLIENT_CMD} 2>/dev/null`" ] ; then + eerror "Please edit /etc/conf.d/ntp-client" + eerror "Unable to locate the client command ${NTPCLIENT_CMD}!" + return 1 + fi + if [ -z "${NTPCLIENT_OPTS}" ] ; then + eerror "Please edit /etc/conf.d/ntp-client" + eerror "I need to know what server/options to use!" + return 1 + fi + return 0 +} + +start() { + checkconfig || return $? + + ebegin "Setting clock via the NTP client '${NTPCLIENT_CMD}'" + ${NTPCLIENT_CMD} ${NTPCLIENT_OPTS} >/dev/null & + local pid=$! + (sleep ${NTPCLIENT_TIMEOUT:-30}; kill -9 ${pid} >&/dev/null) & + wait ${pid} + eend $? "Failed to set clock" +} diff --git a/net-misc/ntp/files/ntp.conf b/net-misc/ntp/files/ntp.conf new file mode 100644 index 0000000..93fc919 --- /dev/null +++ b/net-misc/ntp/files/ntp.conf @@ -0,0 +1,47 @@ +# NOTES: +# - you should only have to update the server line below +# - if you start getting lines like 'restrict' and 'fudge' +# and you didnt add them, AND you run dhcpcd on your +# network interfaces, be sure to add '-Y -N' to the +# dhcpcd_ethX variables in /etc/conf.d/net + +# Name of the servers ntpd should sync with +# Please respect the access policy as stated by the responsible person. +#server ntp.example.tld iburst + +server pool.ntp.org + +## +# A list of available servers can be found here: +# http://www.pool.ntp.org/ +# http://www.pool.ntp.org/#use +# A good way to get servers for your machine is: +# 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: +#restrict default ignore + + +# To deny other machines from changing the +# configuration but allow localhost: +restrict default nomodify nopeer +restrict 127.0.0.1 + + +# To allow machines within your network to synchronize +# their clocks with your server, but ensure they are +# not allowed to configure the server or used as peers +# to synchronize against, uncomment this line. +# +#restrict 192.168.0.0 mask 255.255.255.0 nomodify nopeer notrap diff --git a/net-misc/ntp/files/ntp.logrotate b/net-misc/ntp/files/ntp.logrotate new file mode 100644 index 0000000..22ce592 --- /dev/null +++ b/net-misc/ntp/files/ntp.logrotate @@ -0,0 +1,5 @@ +/var/log/ntp.log { + daily + rotate 7 + nocompress +} diff --git a/net-misc/ntp/files/ntpd.confd b/net-misc/ntp/files/ntpd.confd new file mode 100644 index 0000000..c651e80 --- /dev/null +++ b/net-misc/ntp/files/ntpd.confd @@ -0,0 +1,6 @@ +# /etc/conf.d/ntpd + +# Options to pass to the ntpd process +# Most people should leave this line alone ... +# however, if you know what you're doing, feel free to tweak +NTPD_OPTS="-u ntp:ntp" diff --git a/net-misc/ntp/files/ntpd.rc b/net-misc/ntp/files/ntpd.rc new file mode 100644 index 0000000..7345947 --- /dev/null +++ b/net-misc/ntp/files/ntpd.rc @@ -0,0 +1,38 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/ntp/files/ntpd.rc,v 1.22 2005/08/20 04:10:15 vapier Exp $ + +depend() { + need net + use dns logger + after ntp-client +} + +checkconfig() { + if [ ! -f /etc/ntp.conf ] ; then + eerror "Please create /etc/ntp.conf" + eerror "Sample conf: /usr/share/ntp/ntp.conf" + return 1 + fi + return 0 +} + +start() { + checkconfig || return $? + + ebegin "Starting ntpd" + /usr/sbin/ntpd -p /var/run/ntpd.pid ${NTPD_OPTS} + eend $? "Failed to start ntpd" +} + +stop() { + ebegin "Stopping ntpd" + start-stop-daemon --stop \ + --pidfile /var/run/ntpd.pid \ + --exec /usr/sbin/ntpd + local ret=$? + eend ${ret} "Failed to stop ntpd" + rm -f /var/run/ntpd.pid + return ${ret} +} diff --git a/net-misc/ntp/ntp-4.2.2_p2.ebuild b/net-misc/ntp/ntp-4.2.2_p2.ebuild new file mode 100644 index 0000000..94ee9d9 --- /dev/null +++ b/net-misc/ntp/ntp-4.2.2_p2.ebuild @@ -0,0 +1,146 @@ +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/ntp/ntp-4.2.2_p2.ebuild,v 1.1 2006/07/16 07:03:01 vapier Exp $ + +inherit eutils toolchain-funcs + +MY_P=${P/_p/p} +DESCRIPTION="Network Time Protocol suite/programs" +HOMEPAGE="http://www.ntp.org/" +SRC_URI="http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-${PV:0:3}/${MY_P}.tar.gz + mirror://gentoo/${MY_P}-manpages.tar.bz2" + +LICENSE="as-is" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sh ~sparc ~x86 ~x86-fbsd" +IUSE="logrotate parse-clocks caps selinux ssl ipv6 openntpd debug" + +RDEPEND=">=sys-libs/ncurses-5.2 + >=sys-libs/readline-4.1 + kernel_linux? ( caps? ( sys-libs/libcap ) ) + !openntpd? ( !net-misc/openntpd ) + ssl? ( dev-libs/openssl ) + selinux? ( sec-policy/selinux-ntp )" +DEPEND="${RDEPEND} + >=sys-apps/portage-2.0.51" +PDEPEND="openntpd? ( net-misc/openntpd )" + +S=${WORKDIR}/${MY_P} + +hax_bitkeeper() { + # the makefiles have support for bk ... + # basically we have to do this or bk will try to write + # to files in /opt/bitkeeper causing sandbox violations ;( + mkdir "${T}"/fakebin + echo "#!/bin/sh"$'\n'"exit 1" > "${T}"/fakebin/bk + chmod a+x "${T}"/fakebin/bk + export PATH="${T}/fakebin:${PATH}" +} + +pkg_setup() { + enewgroup ntp 123 + enewuser ntp 123 -1 /dev/null ntp +} + +src_unpack() { + unpack ${A} + cd "${S}" + + # Needs to be ported ... + #epatch "${FILESDIR}"/4.2.0.20040617-hostname.patch + + epatch "${FILESDIR}"/${P}-sntp-header.patch + epatch "${FILESDIR}"/${PV}-zeroconf-enhanced.patch + + sed -i \ + -e 's:md5\.h:touch_not_my_md5:g' \ + -e 's:-lelf:-la_doe_a_deer_a_female_deer:g' \ + -e 's:-lmd5:-li_dont_want_no_stinkin_md5:g' \ + configure || die "sed failed" +} + +src_compile() { + hax_bitkeeper + econf \ + $(use_enable caps linuxcaps) \ + $(use_enable parse-clocks) \ + $(use_enable ipv6) \ + $(use_enable debug debugging) \ + $(use_with ssl crypto) \ + || die + emake || die +} + +src_install() { + hax_bitkeeper + make install DESTDIR="${D}" || die "install failed" + # move ntpd/ntpdate to sbin #66671 + dodir /usr/sbin + mv "${D}"/usr/bin/{ntpd,ntpdate} "${D}"/usr/sbin/ || die "move to sbin" + + dodoc ChangeLog INSTALL NEWS README TODO WHERE-TO-START + doman "${WORKDIR}"/man/*.[58] + dohtml -r html/* + + insinto /usr/share/ntp + doins "${FILESDIR}"/ntp.conf + cp -r scripts/* "${D}"/usr/share/ntp/ + chmod -R go-w "${D}"/usr/share/ntp + find "${D}"/usr/share/ntp \ + '(' \ + -name '*.in' -o \ + -name 'Makefile*' -o \ + -name 'rc[12]' -o \ + -name support \ + ')' \ + -exec rm -r {} \; + + insinto /etc + doins "${FILESDIR}"/ntp.conf + newinitd "${FILESDIR}"/ntpd.rc ntpd + newconfd "${FILESDIR}"/ntpd.confd ntpd + newinitd "${FILESDIR}"/ntp-client.rc ntp-client + newconfd "${FILESDIR}"/ntp-client.confd ntp-client + use caps || dosed "s|-u ntp:ntp||" /etc/conf.d/ntpd + dosed "s:-Q::" /etc/conf.d/ntp-client # no longer needed + dosed "s:/usr/bin:/usr/sbin:" /etc/init.d/ntpd + + keepdir /var/lib/ntp + fowners ntp:ntp /var/lib/ntp + + if use logrotate ; then + insinto /etc/logrotate.d + newins "${FILESDIR}"/ntp.logrotate ntp + fi + + if use openntpd ; then + cd "${D}" + rm usr/sbin/ntpd + rm -r var/lib + rm etc/{conf,init}.d/ntpd + fi +} + +pkg_preinst() { + if [[ -e ${ROOT}/etc/ntp.conf ]] ; then + rm -f "${D}"/etc/ntp.conf + fi +} + +pkg_postinst() { + ewarn "You can find an example /etc/ntp.conf in /usr/share/ntp/" + ewarn "Review /etc/ntp.conf to setup server info." + ewarn "Review /etc/conf.d/ntpd to setup init.d info." + echo + einfo "The way ntp sets and maintains your system time has changed." + einfo "Now you can use /etc/init.d/ntp-client to set your time at" + einfo "boot while you can use /etc/init.d/ntpd to maintain your time" + einfo "while your machine runs" + if [[ -n $(egrep '^[^#].*notrust' "${ROOT}"/etc/ntp.conf) ]] ; then + echo + eerror "The notrust option was found in your /etc/ntp.conf!" + ewarn "If your ntpd starts sending out weird responses," + ewarn "then make sure you have keys properly setup and see" + ewarn "http://bugs.gentoo.org/41827" + fi +} |