linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Pitt <martin.pitt@ubuntu.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: can i use udev rules to send a dbus signal
Date: Wed, 08 Dec 2010 15:04:36 +0000	[thread overview]
Message-ID: <20101208150436.GH2431@piware.de> (raw)
In-Reply-To: <4CFF3C7A.4010608@gmail.com>

Hello shaoning,

shaoning [2010-12-08 16:06 +0800]:
> ACTION="add", ENV{ID_FS_TYPE}="ntfs",
> ENV{mount_options}="relatime,utf8,gid\x100,umask\02", RUN+="/bin/mkdir
> -p /media/%E{dir_name}", RUN+="/bin/mount -t ntfs-3g -o
> $env{mount_options} /dev/%k /media/%E{dir_name}",
> RUN+="/usr/bin/nautilus --no-desktop /media/%E{dir_name}",
> RUN+="/bin/dbus-send --session --type=signal /
> com.zhou.dbustest.sayhelloworld"

This isn't going to work like this. udev rules are executed as root,
so this tries to start nautilus and dbus-send as root, neither of
which makes sense. root doesn't have a session d-bus running, so the
dbus-send will just shout into the void.

udev isn't meant to run stuff for users, that needs to happen in the
user's session. It's possible to use su, read xauth cookies etc. to
pick the first X.org session and run stuff there, but all these are
horrible, horrible hacks.

If you are already using GNOME components, what's wrong with using
udisks and running nautilus as the automount daemon? If you can't do
that in your setup, you could also use a lightweight automount daemon
like [1].

Martin

[1] http://www.piware.de/2010/09/simple-udisks-based-automount-daemon/

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)

      reply	other threads:[~2010-12-08 15:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-08  7:58 can i use udev rules to send a dbus signal shaoning
2010-12-08 15:04 ` Martin Pitt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101208150436.GH2431@piware.de \
    --to=martin.pitt@ubuntu.com \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).