From e096487e309a09d72d64a5a223ea8f38b90bf2af Mon Sep 17 00:00:00 2001 From: José Abílio Oliveira Matos Date: May 31 2010 16:06:52 +0000 Subject: - Add action readability patch (thanks to Niels de Vos) (bz#597866) --- diff --git a/ifplugd.spec b/ifplugd.spec index d8995d4..2508d73 100644 --- a/ifplugd.spec +++ b/ifplugd.spec @@ -1,13 +1,14 @@ Summary: Detect and take action when an ethernet cable is unplugged Name: ifplugd Version: 0.28 -Release: 14%{?dist} +Release: 15%{?dist} License: GPLv2+ Group: System Environment/Daemons URL: http://0pointer.de/lennart/projects/ifplugd Source0: http://0pointer.de/lennart/projects/ifplugd/%{name}-%{version}.tar.gz Patch0: interface_c.patch +Patch1: ifplugd_action-readability.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: libdaemon BuildRequires: libdaemon-devel, pkgconfig @@ -22,6 +23,7 @@ when a cable is really connected. %prep %setup -q %patch0 -p1 +%patch1 -p0 %build %configure --prefix=/ --disable-lynx --disable-xmltoman --disable-subversion --with-initdir=%{_initrddir} @@ -59,6 +61,9 @@ rm -rf $RPM_BUILD_ROOT /sbin/chkconfig --del ifplugd %changelog +* Mon May 31 2010 José Matos - 0.28-15 +- Add action readability patch (thanks to Niels de Vos) (bz#597866) + * Thu Jul 30 2009 Jesse Keating - 0.28-14 - Rebuild for F12 mass rebuild diff --git a/ifplugd_action-readability.patch b/ifplugd_action-readability.patch new file mode 100644 index 0000000..a8fff00 --- /dev/null +++ b/ifplugd_action-readability.patch @@ -0,0 +1,28 @@ +improve readability of ifplugd.action + +$1 and $2 are easily mistaken and are not documented in the header +of the file. Assigning clear variable names improved readability and +makes it easier to change the script. + +Signed-off-by: Niels de Vos +--- conf/ifplugd.action.orig 2010-05-30 21:12:30.251833801 +0100 ++++ conf/ifplugd.action 2010-05-30 21:14:11.601958801 +0100 +@@ -19,12 +19,15 @@ + + set -e + +-if [ -z "$1" ] || [ -z "$2" ] ; then ++NETDEV="$1" ++ACTION="$2" ++ ++if [ -z "$NETDEV" ] || [ -z "$ACTION" ] ; then + echo "Wrong arguments" > /dev/stderr + exit 1 + fi + +-[ "$2" = "up" ] && exec /sbin/ifup $1 +-[ "$2" = "down" ] && exec /sbin/ifdown $1 ++[ "$ACTION" = "up" ] && exec /sbin/ifup "$NETDEV" ++[ "$ACTION" = "down" ] && exec /sbin/ifdown "$NETDEV" + + exit 1