diff options
Diffstat (limited to 'net-misc/dhcdbd')
-rw-r--r-- | net-misc/dhcdbd/dhcdbd-3.0.ebuild | 44 | ||||
-rw-r--r-- | net-misc/dhcdbd/files/dhcdbd-2.5-fixes.patch | 56 | ||||
-rw-r--r-- | net-misc/dhcdbd/files/dhcdbd-2.8-daemon.patch | 46 | ||||
-rw-r--r-- | net-misc/dhcdbd/files/dhcdbd-3.0-daemon.patch | 46 | ||||
-rw-r--r-- | net-misc/dhcdbd/files/dhcdbd-3.0-dbus.patch | 82 | ||||
-rw-r--r-- | net-misc/dhcdbd/files/dhcdbd-3.0-fix_open_missing_mode.diff | 12 | ||||
-rw-r--r-- | net-misc/dhcdbd/files/dhcdbd.confd | 4 | ||||
-rw-r--r-- | net-misc/dhcdbd/files/dhcdbd.init | 22 |
8 files changed, 312 insertions, 0 deletions
diff --git a/net-misc/dhcdbd/dhcdbd-3.0.ebuild b/net-misc/dhcdbd/dhcdbd-3.0.ebuild new file mode 100644 index 0000000..1f54eef --- /dev/null +++ b/net-misc/dhcdbd/dhcdbd-3.0.ebuild @@ -0,0 +1,44 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcdbd/dhcdbd-3.0.ebuild,v 1.5 2008/02/29 03:12:57 ranger Exp $ + +inherit eutils + +DESCRIPTION="DHCP D-BUS daemon (dhcdbd) controls dhclient sessions with D-BUS, stores and presents DHCP options." +HOMEPAGE="http://people.redhat.com/dcantrel/dhcdbd" +HOMEPAGE="http://dcantrel.fedorapeople.org/dhcdbd" +SRC_URI="http://dcantrel.fedorapeople.org/dhcdbd/${P}.tar.bz2" + +LICENSE="public-domain" +SLOT="0" +KEYWORDS="amd64 ppc ~ppc64 x86" +IUSE="debug" + +DEPEND="sys-apps/dbus + >=net-misc/dhcp-3.0.3-r7" + +src_unpack() { + unpack ${A} + cd ${S} + epatch ${FILESDIR}/${PN}-2.5-fixes.patch + # Create a pidfile immediately after daemonizing so we're more robust + # with baselayout-2. + epatch ${FILESDIR}/${PN}-3.0-daemon.patch + # We don't and won't have dbus snapshots in the tree + epatch ${FILESDIR}/${PN}-3.0-dbus.patch + + epatch ${FILESDIR}/${PN}-3.0-fix_open_missing_mode.diff +} + +src_install() { + make DESTDIR="${D}" install || die "make install failed" + dodoc README include/dhcp_options.h + newinitd ${FILESDIR}/dhcdbd.init dhcdbd + newconfd ${FILESDIR}/dhcdbd.confd dhcdbd +} + +pkg_postinst() { + einfo "dhcdbd is used by NetworkManager in order to use it" + einfo "you can add it to runlevels by writing on your terminal" + einfo "rc-update add dhcdbd default" +} diff --git a/net-misc/dhcdbd/files/dhcdbd-2.5-fixes.patch b/net-misc/dhcdbd/files/dhcdbd-2.5-fixes.patch new file mode 100644 index 0000000..aa0e56c --- /dev/null +++ b/net-misc/dhcdbd/files/dhcdbd-2.5-fixes.patch @@ -0,0 +1,56 @@ +diff -ruN dhcdbd-2.5.orig/include/dhcdbd.h dhcdbd-2.5/include/dhcdbd.h +--- dhcdbd-2.5.orig/include/dhcdbd.h 2007-02-15 12:39:30.000000000 -0600 ++++ dhcdbd-2.5/include/dhcdbd.h 2007-02-15 15:07:23.000000000 -0600 +@@ -64,12 +64,12 @@ + #endif + + #ifndef DHCDBD_DHCLIENT_CONF_PFX +-#define DHCDBD_DHCLIENT_CONF_PFX "/etc/dhclient" ++#define DHCDBD_DHCLIENT_CONF_PFX "/etc/dhcp/dhclient" + #endif + +-#ifndef DHCDBD_DHCLIENT_CONF_SEP ++/*#ifndef DHCDBD_DHCLIENT_CONF_SEP*/ + #define DHCDBD_DHCLIENT_CONF_SEP "-" +-#endif ++/*#endif*/ + + #ifndef DHCDBD_DHCLIENT_CONF_SFX + #define DHCDBD_DHCLIENT_CONF_SFX ".conf" +diff -ruN dhcdbd-2.5.orig/src/dbus_service.c dhcdbd-2.5/src/dbus_service.c +--- dhcdbd-2.5.orig/src/dbus_service.c 2007-02-15 12:39:30.000000000 -0600 ++++ dhcdbd-2.5/src/dbus_service.c 2007-02-15 12:44:43.000000000 -0600 +@@ -1216,7 +1216,7 @@ + return (cs); + + give_up: +- dbus_connection_close(connection); ++ dbus_connection_unref(connection); + dbus_shutdown(); + + return (0L); +@@ -1250,7 +1250,7 @@ + tdestroy(cs->roots, free_root); + cs->roots = 0L; + +- dbus_connection_close(cs->connection); ++ dbus_connection_unref(cs->connection); + dbus_shutdown(); + free(cs); + } +diff -ruN dhcdbd-2.5.orig/src/dhcdbd.c dhcdbd-2.5/src/dhcdbd.c +--- dhcdbd-2.5.orig/src/dhcdbd.c 2007-02-15 12:39:30.000000000 -0600 ++++ dhcdbd-2.5/src/dhcdbd.c 2007-02-15 15:06:11.000000000 -0600 +@@ -833,9 +833,8 @@ + ) { + dhcdbd_debug ("Running dhclient for IF_UP %s", d_if->name); + +- snprintf (dhc_if_conf_file, 1024, "%s%s%s%s", +- DHCDBD_DHCLIENT_CONF_PFX, DHCDBD_DHCLIENT_CONF_SEP, +- d_if->name, DHCDBD_DHCLIENT_CONF_SFX); ++ snprintf (dhc_if_conf_file, 1024, "%s%s", ++ DHCDBD_DHCLIENT_CONF_PFX, DHCDBD_DHCLIENT_CONF_SFX); + + if (access (dhc_if_conf_file, R_OK) == 0) + n_args += 2; +Files dhcdbd-2.5.orig/src/.dhcdbd.c.swp and dhcdbd-2.5/src/.dhcdbd.c.swp differ diff --git a/net-misc/dhcdbd/files/dhcdbd-2.8-daemon.patch b/net-misc/dhcdbd/files/dhcdbd-2.8-daemon.patch new file mode 100644 index 0000000..342ce0d --- /dev/null +++ b/net-misc/dhcdbd/files/dhcdbd-2.8-daemon.patch @@ -0,0 +1,46 @@ +diff -ur a b +--- a/src/dhcdbd.c 2007-07-08 17:31:50.000000000 +0100 ++++ b/src/dhcdbd.c 2007-07-08 17:38:39.000000000 +0100 +@@ -2778,9 +2778,6 @@ + char path[1024]; + int fd, l; + +- if (dhcdbd_daemonize && (daemon (0, 0) == -1)) +- return errno; +- + openlog ("dhcdbd", LOG_NDELAY | LOG_CONS, LOG_USER); + + dbus = dbus_svc_init (bus, dhcdbd_destination, dhcdbd_log, 0L); +@@ -2821,6 +2818,17 @@ + (dbus, dhcdbd_object_path, path, dhcdbd_if_subscribe, dhco)) + return (1); + ++ /* Daemonize and write the pidfile write away, to avoid races */ ++ if (dhcdbd_daemonize && (daemon (0, 0) == -1)) ++ return errno; ++ unlink (DHCDBD_PID_FILE); ++ if ((fd = open (DHCDBD_PID_FILE, O_WRONLY | O_CREAT)) == -1) ++ exit (errno); ++ l = sprintf (path, "%u", getpid ()); ++ l = write (fd, path, l); ++ fsync (fd); ++ close (fd); ++ + memset (&sa, '\0', sizeof (struct sigaction)); + sa.sa_sigaction = dhc_reaper; + sa.sa_flags = SA_SIGINFO; /* NO RESTART, NO DEFER, CLDSTOP */ +@@ -2828,13 +2836,7 @@ + dhcdbd_log ("sigaction failed: %s\n", strerror (errno)); + return (1); + } +- unlink (DHCDBD_PID_FILE); +- if ((fd = open (DHCDBD_PID_FILE, O_WRONLY | O_CREAT)) == -1) +- exit (errno); +- l = sprintf (path, "%u", getpid ()); +- l = write (fd, path, l); +- fsync (fd); +- close (fd); ++ + dhcdbd_log ("Started up."); + dbus_svc_main_loop (dbus, dhcdbd_work); + dhcdbd_debug ("Main Loop Exited."); diff --git a/net-misc/dhcdbd/files/dhcdbd-3.0-daemon.patch b/net-misc/dhcdbd/files/dhcdbd-3.0-daemon.patch new file mode 100644 index 0000000..23534d3 --- /dev/null +++ b/net-misc/dhcdbd/files/dhcdbd-3.0-daemon.patch @@ -0,0 +1,46 @@ +diff -ruN dhcdbd-3.0.orig/src/dhcdbd.c dhcdbd-3.0/src/dhcdbd.c +--- dhcdbd-3.0.orig/src/dhcdbd.c 2007-09-04 10:31:45.000000000 -0500 ++++ dhcdbd-3.0/src/dhcdbd.c 2007-09-04 10:35:52.000000000 -0500 +@@ -2769,9 +2769,6 @@ + char path[1024]; + int fd, l; + +- if (dhcdbd_daemonize && (daemon (0, 0) == -1)) +- return errno; +- + openlog ("dhcdbd", LOG_NDELAY | LOG_CONS, LOG_USER); + + dbus = dbus_svc_init (bus, dhcdbd_destination, dhcdbd_log, 0L); +@@ -2812,6 +2809,17 @@ + (dbus, dhcdbd_object_path, path, dhcdbd_if_subscribe, dhco)) + return (1); + ++ /* Daemonize and write the pidfile write away, to avoid races */ ++ if (dhcdbd_daemonize && (daemon (0, 0) == -1)) ++ return errno; ++ unlink (DHCDBD_PID_FILE); ++ if ((fd = open (DHCDBD_PID_FILE, O_WRONLY | O_CREAT)) == -1) ++ exit (errno); ++ l = sprintf (path, "%u", getpid ()); ++ l = write (fd, path, l); ++ fsync (fd); ++ close (fd); ++ + memset (&sa, '\0', sizeof (struct sigaction)); + sa.sa_sigaction = dhc_reaper; + sa.sa_flags = SA_SIGINFO; /* NO RESTART, NO DEFER, CLDSTOP */ +@@ -2819,13 +2827,7 @@ + dhcdbd_log ("sigaction failed: %s\n", strerror (errno)); + return (1); + } +- unlink (DHCDBD_PID_FILE); +- if ((fd = open (DHCDBD_PID_FILE, O_WRONLY | O_CREAT, 0644)) == -1) +- exit (errno); +- l = sprintf (path, "%u", getpid ()); +- l = write (fd, path, l); +- fsync (fd); +- close (fd); ++ + dhcdbd_log ("Started up."); + dbus_svc_main_loop (dbus, dhcdbd_work); + dhcdbd_debug ("Main Loop Exited."); diff --git a/net-misc/dhcdbd/files/dhcdbd-3.0-dbus.patch b/net-misc/dhcdbd/files/dhcdbd-3.0-dbus.patch new file mode 100644 index 0000000..3c96d45 --- /dev/null +++ b/net-misc/dhcdbd/files/dhcdbd-3.0-dbus.patch @@ -0,0 +1,82 @@ +diff -ruN dhcdbd-3.0.orig/src/dbus_service.c dhcdbd-3.0/src/dbus_service.c +--- dhcdbd-3.0.orig/src/dbus_service.c 2007-09-04 11:08:45.000000000 -0500 ++++ dhcdbd-3.0/src/dbus_service.c 2007-09-04 12:00:38.000000000 -0500 +@@ -1024,7 +1024,11 @@ + + static void set_watch_fds(DBusWatch * watch, DBusConnectionState * cs) { + uint8_t flags = dbus_watch_get_flags(watch); ++#if (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MINOR == 1 && DBUS_VERSION_MICRO >= 1) || (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MAJOR > 1) || (DBUS_VERSION_MAJOR > 1) + int fd = dbus_watch_get_unix_fd(watch); ++#else ++ int fd = dbus_watch_get_fd(watch); ++#endif + + if (cs->n <= fd) + cs->n = fd + 1; +@@ -1057,7 +1061,11 @@ + dbus_watch_set_data(watch, cs, no_free); + + if (cs->dh != 0L) ++#if (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MINOR == 1 && DBUS_VERSION_MICRO >= 1) || (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MAJOR > 1) || (DBUS_VERSION_MAJOR > 1) + (*(cs->dh)) ("add_watch: %d", dbus_watch_get_unix_fd (watch)); ++#else ++ (*(cs->dh)) ("add_watch: %d", dbus_watch_get_fd(watch)); ++#endif + + if (tsearch((const void *) watch, &(cs->watches), ptr_key_comparator) == 0L) { + if (cs->eh != 0L) +@@ -1074,14 +1082,22 @@ + static void remove_watch(DBusWatch * watch, void *csp) + { + DBusConnectionState *cs = csp; ++#if (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MINOR == 1 && DBUS_VERSION_MICRO >= 1) || (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MAJOR > 1) || (DBUS_VERSION_MAJOR > 1) + int fd = dbus_watch_get_unix_fd(watch); ++#else ++ int fd = dbus_watch_get_fd(watch); ++#endif + + if (tdelete((const void *) watch, &(cs->watches), ptr_key_comparator) == 0L) + if (cs->eh != 0L) + (*(cs->eh)) ("remove_watch: can't happen?!?: watch not found"); + + if (cs->dh != 0L) ++#if (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MINOR == 1 && DBUS_VERSION_MICRO >= 1) || (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MAJOR > 1) || (DBUS_VERSION_MAJOR > 1) + (*(cs->dh)) ("remove_watch: %d", dbus_watch_get_unix_fd(watch)); ++#else ++ (*(cs->dh)) ("remove_watch: %d", dbus_watch_get_fd(watch)); ++#endif + + FD_CLR(fd, &(cs->r_fds)); + FD_CLR(fd, &(cs->w_fds)); +@@ -1092,7 +1108,11 @@ + DBusConnectionState *cs = csp; + + if (cs->dh != 0L) ++#if (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MINOR == 1 && DBUS_VERSION_MICRO >= 1) || (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MAJOR > 1) || (DBUS_VERSION_MAJOR > 1) + (*(cs->dh)) ("toggle_watch: %d", dbus_watch_get_unix_fd(watch)); ++#else ++ (*(cs->dh)) ("toggle_watch: %d", dbus_watch_get_fd(watch)); ++#endif + + set_watch_fds(watch, cs); + } +@@ -1114,11 +1134,19 @@ + if (!dbus_watch_get_enabled(w)) + return; + ++#if (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MINOR == 1 && DBUS_VERSION_MICRO >= 1) || (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MAJOR > 1) || (DBUS_VERSION_MAJOR > 1) + fd = dbus_watch_get_unix_fd(w); ++#else ++ fd = dbus_watch_get_fd(w); ++#endif + flags = dbus_watch_get_flags(w); + + if (cs->dh != 0L) ++#if (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MINOR == 1 && DBUS_VERSION_MICRO >= 1) || (DBUS_VERSION_MAJOR == 1 && DBUS_VERSION_MAJOR > 1) || (DBUS_VERSION_MAJOR > 1) + (*(cs->dh)) ("handle_watch: %d", dbus_watch_get_unix_fd(w)); ++#else ++ (*(cs->dh)) ("handle_watch: %d", dbus_watch_get_fd(w)); ++#endif + + if ((flags & DBUS_WATCH_READABLE) && (FD_ISSET(fd, &(cs->s_r_fds)))) + dbus_watch_handle(w, DBUS_WATCH_READABLE); diff --git a/net-misc/dhcdbd/files/dhcdbd-3.0-fix_open_missing_mode.diff b/net-misc/dhcdbd/files/dhcdbd-3.0-fix_open_missing_mode.diff new file mode 100644 index 0000000..9a4abf2 --- /dev/null +++ b/net-misc/dhcdbd/files/dhcdbd-3.0-fix_open_missing_mode.diff @@ -0,0 +1,12 @@ +diff -urN dhcdbd-3.0.orig/temp/environment dhcdbd-3.0/temp/environment +--- dhcdbd-3.0.orig/work/dhcdbd-3.0/src/dhcdbd.c 2009-02-09 13:54:24.533255364 +0000 ++++ dhcdbd-3.0/work/dhcdbd-3.0/src/dhcdbd.c 2009-02-09 14:01:02.868255071 +0000 +@@ -2813,7 +2813,7 @@ + if (dhcdbd_daemonize && (daemon (0, 0) == -1)) + return errno; + unlink (DHCDBD_PID_FILE); +- if ((fd = open (DHCDBD_PID_FILE, O_WRONLY | O_CREAT)) == -1) ++ if ((fd = open (DHCDBD_PID_FILE, O_WRONLY || O_CREAT)) == -1) + exit (errno); + l = sprintf (path, "%u", getpid ()); + l = write (fd, path, l); diff --git a/net-misc/dhcdbd/files/dhcdbd.confd b/net-misc/dhcdbd/files/dhcdbd.confd new file mode 100644 index 0000000..ae833ec --- /dev/null +++ b/net-misc/dhcdbd/files/dhcdbd.confd @@ -0,0 +1,4 @@ +# Configuration file for dhcdbd +# +# Arguments to pass to the dhcdbd daemon. +DHCDBD_ARGS="--system" diff --git a/net-misc/dhcdbd/files/dhcdbd.init b/net-misc/dhcdbd/files/dhcdbd.init new file mode 100644 index 0000000..9bf0cfe --- /dev/null +++ b/net-misc/dhcdbd/files/dhcdbd.init @@ -0,0 +1,22 @@ +#!/sbin/runscript +# Copyright 2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need net dbus +} + +start() { + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --exec /sbin/dhcdbd \ + --pidfile /var/run/dhcdbd.pid \ + -- ${DHCDBD_ARGS} + eend $? +} + +stop() { + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --exec /sbin/dhcdbd \ + --pidfile /var/run/dhcdbd.pid + eend $? +} |