[arch-commits] Commit in ifplugd/trunk (PKGBUILD ifplugd)

Dave Reisner dreisner at archlinux.org
Sat Apr 28 14:49:33 EDT 2012


    Date: Saturday, April 28, 2012 @ 14:49:33
  Author: dreisner
Revision: 157469

upgpkg: ifplugd 0.28-9

- fix a few latent bugs from ifplugd script testing

Modified:
  ifplugd/trunk/PKGBUILD
  ifplugd/trunk/ifplugd

----------+
 PKGBUILD |   13 ++++++++-----
 ifplugd  |   41 +++++++++++++++++++----------------------
 2 files changed, 27 insertions(+), 27 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2012-04-28 17:53:35 UTC (rev 157468)
+++ PKGBUILD	2012-04-28 18:49:33 UTC (rev 157469)
@@ -5,7 +5,7 @@
 
 pkgname=ifplugd
 pkgver=0.28
-pkgrel=8
+pkgrel=9
 pkgdesc="A daemon which brings up/down network interfaces upon cable insertion/removal."
 arch=('i686' 'x86_64')
 url="http://0pointer.de/lennart/projects/ifplugd"
@@ -14,10 +14,13 @@
 backup=('etc/ifplugd/ifplugd.conf' 'etc/ifplugd/ifplugd.action')
 options=('!makeflags')
 source=($url/${pkgname}-${pkgver}.tar.gz 'ifplugd' 'ifplugd.action' 'ifplugd-0.28-interface.patch' 'ifdown.01-route.sh' 'ifup.01-route.sh' 'ifup.02-ntpdate.sh')
-md5sums=('df6f4bab52f46ffd6eb1f5912d4ccee3' '70d66121ae5163348855236951e069a2'\
-         'e91a3d77d707ae79fbc10146848032dc' '54eb22844b5aeed161c0b80aa9008570'\
-	 'd6ce6c7bd481a0b3944c944c5b277c0b' 'c35f0a637911b747f8dc3bd3c6156a1b'\
-	 'f8690ee18a5ca72555585ee96826c2cf')
+md5sums=('df6f4bab52f46ffd6eb1f5912d4ccee3'
+         'ef27f40434ca85ccaf57a7e388eb001e'
+         '6f98767c4ea2cf0580f73ced81efd21a'
+         '54eb22844b5aeed161c0b80aa9008570'
+         'd6ce6c7bd481a0b3944c944c5b277c0b'
+         'c35f0a637911b747f8dc3bd3c6156a1b'
+         'f8690ee18a5ca72555585ee96826c2cf')
 
 build() {
   cd ${srcdir}/${pkgname}-${pkgver}

Modified: ifplugd
===================================================================
--- ifplugd	2012-04-28 17:53:35 UTC (rev 157468)
+++ ifplugd	2012-04-28 18:49:33 UTC (rev 157469)
@@ -10,7 +10,7 @@
 # env vars
 daemonname=ifplugd
 cfg=/etc/ifplugd/ifplugd.conf
-PID=$(pgrep -ox ifplugd)
+PID=$(pidof -o %PPID ifplugd)
 
 # source configuration file
 [[ -r $cfg ]] && . "$cfg"
@@ -18,24 +18,25 @@
 # discover interfaces to monitor
 # (replacing INTERFACES with net_ifs, since AL
 # already uses it in /etc/rc.conf)
-if [[ -z $net_ifs ]]; then 
+if [[ -z $net_ifs ]]; then
   net_ifs=(/sys/class/net/!(lo))
   net_ifs=("${net_ifs[@]##*/}")
 fi
 
 case $1 in
   start)
-    stat_busy "Starting $daemonname"
-    if [[ $PID ]]; then
-      stat_fail
-      exit 1
-    fi
+    stat_busy "Starting $daemonname: ${net_ifs[*]}"
 
     for nic in "${net_ifs[@]}"; do
-      args=ARGS_$nic
-      [[ -z ${!args} ]] && args=$ARGS || args=${!args}
-      ifplugd -i "$nic" $args || (( ++err ))
-      printf ' %s' "$nic"
+      # only start if a PID doesn't already exist
+      if [[ ! -f /var/run/ifplugd.$nic.pid ]]; then
+        args=ARGS_$nic
+        [[ -z ${!args} ]] && args=$ARGS || args=${!args}
+        ifplugd -i "$nic" $args
+
+        # use presence of PID file to check for start success
+        [[ -f /var/run/ifplugd.$nic.pid ]] || (( ++err ))
+      fi
     done
     unset nic
 
@@ -48,15 +49,13 @@
     fi
     ;;
   stop)
-    stat_busy "Stopping $daemonname"
-    if [[ -z $PID ]]; then
-      stat_fail
-      exit 1
-    fi
+    stat_busy "Stopping $daemonname: ${net_ifs[*]}"
 
-    for nic in "${net_ifs[@]}"; do
+    for nic in /var/run/ifplugd.*.pid; do
+      [[ -f $nic ]] || { (( ++err )); break; }
+      nic=${nic%.pid}
+      nic=${nic##*.}
       ifplugd -k -i "$nic" || (( ++err ))
-      printf ' %s' "$nic"
     done
 
     if (( err )); then
@@ -79,10 +78,9 @@
     unset nic
     ;;
   suspend)
-    stat_busy "Suspending $daemonname"
+    stat_busy "Suspending $daemonname: ${net_ifs[*]}"
     for nic in "${net_ifs[@]}"; do
       ifplugd -S -i $nic || (( ++err ))
-      printf ' %s' "$nic"
     done
     unset nic
 
@@ -94,11 +92,10 @@
     fi
     ;;
   resume)
-    stat_busy "Resuming $daemonname"
+    stat_busy "Resuming $daemonname ${net_ifs[*]}"
 
     for nic in "${net_ifs[@]}"; do
       ifplugd -R -i $nic || (( ++err ))
-      printf ' %s' "$nic"
     done
     unset nic
 



More information about the arch-commits mailing list