New init script so we don't stop ifplugd processes launched by other
authorRoy Marples <uberlord@gentoo.org>
Thu, 8 Sep 2005 14:37:32 +0000 (14:37 +0000)
committerRoy Marples <uberlord@gentoo.org>
Thu, 8 Sep 2005 14:37:32 +0000 (14:37 +0000)
  scripts and we don't start ifplugd on an interface where it is already
  running.

  Punted older ebuilds.

Package-Manager: portage-2.0.51.22-r2

sys-apps/ifplugd/ChangeLog
sys-apps/ifplugd/Manifest
sys-apps/ifplugd/files/digest-ifplugd-0.26-r1 [deleted file]
sys-apps/ifplugd/files/digest-ifplugd-0.28-r2 [moved from sys-apps/ifplugd/files/digest-ifplugd-0.28-r1 with 100% similarity]
sys-apps/ifplugd/files/ifplugd.init
sys-apps/ifplugd/ifplugd-0.26-r1.ebuild [deleted file]
sys-apps/ifplugd/ifplugd-0.28-r2.ebuild [moved from sys-apps/ifplugd/ifplugd-0.28-r1.ebuild with 96% similarity]

index d71ddc380b359d7ac5a1fc528f3a82d5b185600f..7d5d72e3cd3274d24105564e78c8d3fb7fd21149 100644 (file)
@@ -1,6 +1,16 @@
 # ChangeLog for sys-apps/ifplugd
 # Copyright 2000-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/ifplugd/ChangeLog,v 1.26 2005/09/02 06:46:40 uberlord Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/ifplugd/ChangeLog,v 1.27 2005/09/08 14:37:32 uberlord Exp $
+
+*ifplugd-0.28-r2 (08 Sep 2005)
+
+  08 Sep 2005; Roy Marples <uberlord@gentoo.org> files/ifplugd.init,
+  -ifplugd-0.26-r1.ebuild, -ifplugd-0.28-r1.ebuild, +ifplugd-0.28-r2.ebuild:
+  New init script so we don't stop ifplugd processes launched by other
+  scripts and we don't start ifplugd on an interface where it is already
+  running.
+
+  Punted older ebuilds.
 
   02 Sep 2005; Roy Marples <uberlord@gentoo.org> ifplugd-0.28-r1.ebuild:
   Install ifplugd.action to /usr/sbin and not /etc/init.d
index 37113d226b4229d6b6efa1b9ebafa7f8bf139fa9..3239d824bf426804e43ee12610759fae729af3df 100644 (file)
@@ -1,16 +1,14 @@
-MD5 eea9c2646810c03b0d44be3d40d7f841 ChangeLog 4819
-MD5 5852549e44605cf7b0a348dc3ca2b2ce ifplugd-0.28-r1.ebuild 1301
+MD5 aa52a3d6cec02302e5223291dddf0486 ifplugd-0.28-r2.ebuild 1301
+MD5 54f5a06d95ccfbca878aae6a6385ae49 ChangeLog 5178
 MD5 50ddf6de7cdf5ef045d0189c47e4e452 metadata.xml 258
 MD5 e6ac7d869a0eb46fcd8069766bcf9370 ifplugd-0.28.ebuild 1445
-MD5 937bc5d89438a647988f8e77b4215f69 ifplugd-0.26-r1.ebuild 1446
-MD5 0f11772693878629fb851b68920004c5 files/gentoo-ifplugd.action-v2 703
 MD5 e4322329d76406800bd7810f7d1869cd files/ifplugd-0.28-gentoo.diff 1119
-MD5 c110adefe6c3d268c4c1e861d120fe3a files/digest-ifplugd-0.28 64
-MD5 c110adefe6c3d268c4c1e861d120fe3a files/digest-ifplugd-0.28-r1 64
-MD5 35a51405ec02cf2cf0116b7b75d98294 files/ifplugd-0.26-gentoo.diff 1547
-MD5 5b166f9bb496cef12fa2fa44a12c8c62 files/ifplugd.init 2956
+MD5 0f11772693878629fb851b68920004c5 files/gentoo-ifplugd.action-v2 703
 MD5 35e218c1d5eadc7f98f2759eecb9c651 files/gentoo-ifplugd-init-v3 2685
-MD5 6f22a4f464e4c07ea9220fb81ba6848a files/digest-ifplugd-0.26-r1 64
 MD5 aaff46e0cdc7f78ba616e8093700cadf files/ifplugd.conf 2255
-MD5 046da68d6aa7665b0d3a9fd9e5a67b6a files/gentoo-ifplugd-conf-v3 2248
 MD5 6279601f12e6444faa6c118df03e1e3c files/ifplugd.action 999
+MD5 fe09c9793c01678c251ee8a988009151 files/ifplugd.init 3948
+MD5 35a51405ec02cf2cf0116b7b75d98294 files/ifplugd-0.26-gentoo.diff 1547
+MD5 c110adefe6c3d268c4c1e861d120fe3a files/digest-ifplugd-0.28 64
+MD5 c110adefe6c3d268c4c1e861d120fe3a files/digest-ifplugd-0.28-r2 64
+MD5 046da68d6aa7665b0d3a9fd9e5a67b6a files/gentoo-ifplugd-conf-v3 2248
diff --git a/sys-apps/ifplugd/files/digest-ifplugd-0.26-r1 b/sys-apps/ifplugd/files/digest-ifplugd-0.26-r1
deleted file mode 100644 (file)
index 3e81a2b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-MD5 f0ceac6690b02928015aa00c0d3e663b ifplugd-0.26.tar.gz 138914
index 77558bdc162d4551a18d858b2ebb4464a2aebffc..fff6f04f3bd223fb4766f5c09b7b384227f69f18 100644 (file)
@@ -1,7 +1,7 @@
 #!/sbin/runscript
 # Copyright 1999-2004 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/ifplugd/files/ifplugd.init,v 1.1 2005/09/01 15:33:28 uberlord Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/ifplugd/files/ifplugd.init,v 1.2 2005/09/08 14:37:32 uberlord Exp $
 
 #NB: Config is in /etc/conf.d/ifplugd
 
@@ -23,6 +23,16 @@ get_start_interfaces() {
        if [[ -f /proc/net/wireless && ${WIRELESS_INTERFACES} == "no" ]]; then
                exclude=$(sed -ne 's/^[ \t]*\(.*\):.*/\1/p' /proc/net/wireless | xargs)
        fi
+       
+       # Exclude ifplugd started by other scripts - like net.xxx
+       if [[ -d "${svcdir}/daemons" ]]; then
+               exclude="${exclude} $(
+                       grep "\"/var/run/ifplugd.*.pid\"" "${svcdir}"/daemons/* 2>/dev/null \
+                       | grep -v "${svcdir}/daemons/ifplugd:" \
+                       | sed -n -e 's/.*ifplugd\.\(.*\)\.pid.*/\1/p'
+               )"
+       fi
+       
        exclude=" lo ${exclude} "
        for iface in ${exclude}; do
                INTERFACES="${INTERFACES// ${iface} / }"
@@ -31,7 +41,23 @@ get_start_interfaces() {
 }
 
 get_running_interfaces() {
-       ( cd /var/run; ls ifplugd.*.pid | sed -n -e 's/^ifplugd.\(.*\).pid$/\1/p' )
+       local exclude="" INTERFACES=$(
+               cd /var/run
+               ls ifplugd.*.pid 2>/dev/null | sed -n -e 's/^ifplugd.\(.*\).pid$/\1/p' | xargs
+       )
+       if [[ -d "${svcdir}/daemons" ]]; then
+               local exclude=$(
+                       grep "\"/var/run/ifplugd.*.pid\"" "${svcdir}"/daemons/* 2>/dev/null \
+                       | grep -v "${svcdir}/daemons/ifplugd:" \
+                       | sed -n -e 's/.*ifplugd\.\(.*\)\.pid.*/\1/p'
+               )
+       fi
+
+       INTERFACES=" ${INTERFACES} "
+       for iface in ${exclude}; do
+               INTERFACES=${INTERFACES// ${iface} / }
+       done
+       echo "${INTERFACES}"
 }
 
 # Check if an option is set for a given interface.
@@ -57,14 +83,24 @@ start() {
        
        for iface in $(get_start_interfaces); do
                ebegin "${iface}"
-               local args=
+               local args="" pidfile="/var/run/ifplugd.${iface}.pid"
+
+               if [[ -e ${pidfile} ]] ; then
+                       if is_daemon_running /usr/sbin/ifplugd "${pidfile}" ; then
+                               eindent
+                               einfo "ifplugd is already running on ${iface}"
+                               eend 0
+                               eoutdent
+                               oneworked=true
+                               continue
+                       fi
+               fi
                
                is_set "${iface}" AUTO yes || args="${args}a"
                is_set "${iface}" BEEP yes || args="${args}b"
                is_set "${iface}" IGNORE_FAIL yes && args="${iargs}f"
                is_set "${iface}" IGNORE_FAIL_POSITIVE no && args="${iargs}F"
                is_set "${iface}" IGNORE_RETVAL yes && args="${iargs}I"
-               is_set "${iface}" SHUTDOWN yes || args="${iargs}q"
                is_set "${iface}" WAIT_ON_FORK yes && args="${iargs}w"
                is_set "${iface}" MONITOR no && args="${iargs}M"
 
@@ -100,7 +136,7 @@ stop() {
        for iface in $(get_running_interfaces); do
                ebegin "${iface}"
                start-stop-daemon --stop --exec /usr/sbin/ifplugd \
-                       --pidfile "/var/run/ifplugd.${iface}.pid"
+                       --pidfile "/var/run/ifplugd.${iface}.pid" --signal SIGQUIT
                eend $? || allstopped=false
        done
 
@@ -110,6 +146,8 @@ stop() {
 status() {
        local iface
 
+       service_started "${myservice}" || return 0
+
        for iface in $(get_running_interfaces); do
                einfo "$(/usr/sbin/ifplugstatus ${iface})"
        done
diff --git a/sys-apps/ifplugd/ifplugd-0.26-r1.ebuild b/sys-apps/ifplugd/ifplugd-0.26-r1.ebuild
deleted file mode 100644 (file)
index 81686c3..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright 1999-2005 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/ifplugd/ifplugd-0.26-r1.ebuild,v 1.3 2005/05/01 17:19:20 hansmi Exp $
-
-inherit eutils
-
-DESCRIPTION="Brings up/down ethernet ports automatically with cable detection"
-HOMEPAGE="http://0pointer.de/lennart/projects/ifplugd/"
-SRC_URI="http://0pointer.de/lennart/projects/ifplugd/${P}.tar.gz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="x86 amd64 ppc"
-IUSE="doc"
-
-DEPEND="dev-util/pkgconfig
-       doc? ( www-client/lynx )"
-RDEPEND=">=dev-libs/libdaemon-0.5"
-
-# Gentoo-provided scripts. Version is for the scripts, not ifplugd.
-INITSCRIPT=${FILESDIR}/gentoo-ifplugd-init-v3
-ACTIONSCRIPT=${FILESDIR}/gentoo-ifplugd.action-v2
-CONFFILE=${FILESDIR}/gentoo-ifplugd-conf-v3
-
-src_unpack() {
-       unpack ${A}
-       cd ${S}
-       epatch ${FILESDIR}/${P}-gentoo.diff
-}
-
-src_compile() {
-       econf $(use_enable doc lynx) \
-               --with-initdir=/etc/init.d \
-               --disable-xmltoman \
-               --disable-subversion \
-               || die "econf failed"
-       emake || die "emake failed"
-}
-
-src_install() {
-       make DESTDIR="${D}" install || die "make install failed"
-       newsbin ${ACTIONSCRIPT} ifplugd.action
-
-       # Fix init.d configuration
-       rm -fr ${D}/etc/ifplugd ${D}/etc/init.d/ifplugd
-
-       insinto /etc/conf.d ; newins ${CONFFILE} ${PN} || die
-       exeinto /etc/init.d ; newexe ${INITSCRIPT} ${PN} || die
-
-       cd ${S}/doc
-       dodoc README SUPPORTED_DRIVERS
-       use doc && dohtml *.{html,css}
-}
similarity index 96%
rename from sys-apps/ifplugd/ifplugd-0.28-r1.ebuild
rename to sys-apps/ifplugd/ifplugd-0.28-r2.ebuild
index eefc81fcec95ac4c9898be07281bfad9ee00c987..ee9ac34dc1860da72dbfb2cfa2ebf6d10a5b25af 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2005 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/ifplugd/ifplugd-0.28-r1.ebuild,v 1.2 2005/09/02 06:46:40 uberlord Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/ifplugd/ifplugd-0.28-r2.ebuild,v 1.1 2005/09/08 14:37:32 uberlord Exp $
 
 inherit eutils