[Pm-utils] [PATCH 07/17] Added an additional check for NetworkManager, removed redundant exit call.

Dan Nicholson dbn.lists at gmail.com
Fri Feb 15 08:30:49 PST 2008


On Fri, Feb 15, 2008 at 7:43 AM, Victor Lowther
<victor.lowther at gmail.com> wrote:
>
> On Fri, Feb 15, 2008 at 06:38:09AM -0800, Dan Nicholson wrote:
>  > On Mon, Feb 11, 2008 at 1:50 PM, Victor Lowther
>  > <victor.lowther at gmail.com> wrote:
>  > > ---
>  > >   pm/sleep.d/10NetworkManager |    4 +---
>  > >   1 files changed, 1 insertions(+), 3 deletions(-)
>  > >
>  > >  diff --git a/pm/sleep.d/10NetworkManager b/pm/sleep.d/10NetworkManager
>  > >  index d1ad677..5c526eb 100755
>  > >  --- a/pm/sleep.d/10NetworkManager
>  > >  +++ b/pm/sleep.d/10NetworkManager
>  > >  @@ -2,7 +2,7 @@
>  > >
>  > >   . "${PM_FUNCTIONS}"
>  > >
>  > >  -command_exists dbus-send || exit 1
>  > >  +command_exists dbus-send && command_exists NetworkManager || exit
>  >
>  > I'm not a big fan of this change. Using dbus-send is already a more
>  > powerful way to contact NetworkManager then relying on $PATH. What if
>  > I'm playing around with NM and my daemon is in /opt/nm-testing/sbin?
>  > What if I'm running a daemon I called NetworkManager2?
>
>  Fair enough.  The change was intended to cover the situation in which
>  dbus is installed and NetworkManager is not.  If this patch is
>  insufficently generic, I have no problem dropping it.

Yes, I should have expanded my comment a bit. dbus-send essentially
becomes our "command_exists" in this case. What we care about is if an
application is listening on the org.freedesktop.NetworkManager
connection, not if we can find the NetworkManager binary. The
dbus-send call is very quick and doesn't block or print an error if
nothing happens with that signal (from what I can tell).

--
Dan


More information about the Pm-utils mailing list