summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <uberlord@gentoo.org>2007-07-16 13:40:13 +0000
committerRoy Marples <uberlord@gentoo.org>2007-07-16 13:40:13 +0000
commite0a6297fdd19084b906877f4f47fa11f157c8a26 (patch)
treee87052f886131aac1dd501a0a2b52e6baf004868 /net-misc
parentBetter link provided by gabrielp@simnet.is (diff)
downloadgentoo-2-e0a6297fdd19084b906877f4f47fa11f157c8a26.tar.gz
gentoo-2-e0a6297fdd19084b906877f4f47fa11f157c8a26.tar.bz2
gentoo-2-e0a6297fdd19084b906877f4f47fa11f157c8a26.zip
Create a pidfile immediately after daemonizing so we're more robust
with baselayout-2 (Portage version: 2.1.3_rc8)
Diffstat (limited to 'net-misc')
-rw-r--r--net-misc/dhcdbd/ChangeLog9
-rw-r--r--net-misc/dhcdbd/dhcdbd-2.8-r1.ebuild42
-rw-r--r--net-misc/dhcdbd/files/dhcdbd-2.8-daemon.patch46
-rw-r--r--net-misc/dhcdbd/files/digest-dhcdbd-2.8-r13
4 files changed, 99 insertions, 1 deletions
diff --git a/net-misc/dhcdbd/ChangeLog b/net-misc/dhcdbd/ChangeLog
index 111b88e353be..73bc3c5e459a 100644
--- a/net-misc/dhcdbd/ChangeLog
+++ b/net-misc/dhcdbd/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for net-misc/dhcdbd
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcdbd/ChangeLog,v 1.5 2007/06/14 17:51:24 steev Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcdbd/ChangeLog,v 1.6 2007/07/16 13:40:13 uberlord Exp $
+
+*dhcdbd-2.8-r1 (16 Jul 2007)
+
+ 16 Jul 2007; Roy Marples <uberlord@gentoo.org>
+ +files/dhcdbd-2.8-daemon.patch, +dhcdbd-2.8-r1.ebuild:
+ Create a pidfile immediately after daemonizing so we're more robust
+ with baselayout-2
*dhcdbd-2.8 (14 Jun 2007)
diff --git a/net-misc/dhcdbd/dhcdbd-2.8-r1.ebuild b/net-misc/dhcdbd/dhcdbd-2.8-r1.ebuild
new file mode 100644
index 000000000000..d4f993b21da0
--- /dev/null
+++ b/net-misc/dhcdbd/dhcdbd-2.8-r1.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-misc/dhcdbd/dhcdbd-2.8-r1.ebuild,v 1.1 2007/07/16 13:40:13 uberlord 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"
+SRC_URI="http://people.redhat.com/dcantrel/dhcdbd/${P}.tar.bz2"
+
+LICENSE="public-domain"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
+IUSE=""
+
+DEPEND="sys-apps/dbus
+ >=net-misc/dhcp-3.0.3-r7"
+
+src_unpack() {
+ unpack ${A}
+ cd ${S}
+ epatch ${FILESDIR}/${PN}-2.5-fixes.patch
+ # Commented out for the moment as I need to re-work this to make it cleaner.
+ #use debug && epatch ${FILESDIR}/${PN}-2.5-debug.patch
+
+ # Create a pidfile immediately after daemonizing so we're more robust
+ # with baselayout-2
+ epatch ${FILESDIR}/${P}-daemon.patch
+}
+
+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.8-daemon.patch b/net-misc/dhcdbd/files/dhcdbd-2.8-daemon.patch
new file mode 100644
index 000000000000..342ce0da8d70
--- /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/digest-dhcdbd-2.8-r1 b/net-misc/dhcdbd/files/digest-dhcdbd-2.8-r1
new file mode 100644
index 000000000000..2c7a83e05381
--- /dev/null
+++ b/net-misc/dhcdbd/files/digest-dhcdbd-2.8-r1
@@ -0,0 +1,3 @@
+MD5 c2c5a5c72182c3e88ae62eadb4874fc1 dhcdbd-2.8.tar.bz2 56792
+RMD160 e200683739f8f3f23fed64441231b99d72d48440 dhcdbd-2.8.tar.bz2 56792
+SHA256 eb4c566509ea98f393e3488d1861f3a74f97438fb24551703fe6b2d00593f2b4 dhcdbd-2.8.tar.bz2 56792