Ruben Safir | 4 Dec 2008 10:11

Re: Per-user network up and down scripts

Nathaniel Smith wrote:
> On Wed, Nov 26, 2008 at 8:40 AM, Don Marti <dmarti <at> zgp.org> wrote:
>   
>> There's other stuff that I want to do when the net
>> comes up or down that should run as me, not root.
>> (Sync my IMAP mail, open ssh "master" connections
>> which are tied to me, and so on.)
>>     
>
> Another approach (used by a number of desktop apps these days) is to
> listen for D-Bus signals from NetworkManager.  For a slightly
> different use case mostly (Firefox switching between "offline" and
> "online" mode, Pidgin triggering an automatic reconnection attempt,
> etc.) where the interested apps are already resident in memory, and of
> course it assumes you're using NetworkManager, but one could create a
> little session daemon who just listens for such events and then runs
> scripts, for instance.
>
> -- Nathaniel
> _______________________________________________
> linux-elitists mailing list
> linux-elitists <at> zgp.org
> http://allium.zgp.org/cgi-bin/mailman/listinfo/linux-elitists
>
>   

How do you get them into user space and there is no standard command 
line tools of either HAL
or D-Bus

(Continue reading)

Greg KH | 4 Dec 2008 18:01
Gravatar

Re: Per-user network up and down scripts

On Thu, Dec 04, 2008 at 04:11:00AM -0500, Ruben Safir wrote:
> 
> How do you get them into user space and there is no standard command 
> line tools of either HAL
> or D-Bus

You can write simple python scripts to listen to, and react to dbus
messages, try doing that.

> I'll be darn if I can figure how to do this without nautalus, and not 
> just the network but also usb drives
> Its harder now than it was 5 years ago.

Well, we do a whole lot more things than we did 5 years ago now, the
world doesn't stop getting more and more complex.  You're free to go
back and use your 5 year old distro if you want to :)

good luck,

greg k-h
Ruben Safir | 5 Dec 2008 09:27

Re: Per-user network up and down scripts

Greg KH wrote:
> On Thu, Dec 04, 2008 at 04:11:00AM -0500, Ruben Safir wrote:
>   
>> How do you get them into user space and there is no standard command 
>> line tools of either HAL
>> or D-Bus
>>     
>
> You can write simple python scripts to listen to, and react to dbus
> messages, try doing that.
>
>   
>> I'll be darn if I can figure how to do this without nautalus, and not 
>> just the network but also usb drives
>> Its harder now than it was 5 years ago.
>>     
>
> Well, we do a whole lot more things than we did 5 years ago now, the
> world doesn't stop getting more and more complex.  You're free to go
> back and use your 5 year old distro if you want to :)
>
> good luck,
>
>   

It is doing a hell of a lot less now.  I hate DBUS and HAL

Ruben

> greg k-h
(Continue reading)

Greg KH | 5 Dec 2008 16:19
Gravatar

Re: Per-user network up and down scripts

On Fri, Dec 05, 2008 at 03:27:19AM -0500, Ruben Safir wrote:
> It is doing a hell of a lot less now.  I hate DBUS and HAL

Then go back to a 5 year old distro and see how well it works for
dynamic devices and proper multi-user permissions on those devices.

Good luck,

greg k-h

p.s. HAL is currently being rewritten, but I'm sure you will hate the
next iteration as well.
Rick Moen | 5 Dec 2008 20:06
Favicon

Re: Per-user network up and down scripts

Quoting Greg KH (greg <at> kroah.com):

> Then go back to a 5 year old distro and see how well it works for
> dynamic devices and proper multi-user permissions on those devices.

Succinctly put.

A system events such as loading a module, pressing a hotkey, closing a
laptop lid, inserting or removing a dynamic device occurs.  With the
last of those as an example, attaching or removing a USB flash drive
triggers kobject uevent() or kobject uevent env() in the kernel, which
transmits the event to udevd, which registers it in an abstract socket,
managing device nodes according to rules in /etc/udev.  HAL reads that
event, coreates a device object under /org/freedesktop/Hal/devices/, and
emits a DeviceAdded signal.  Which signal applications can then notice
via the D-BUS system bus.  Right?

That's all fine.  Where I have a problem is the need to run some
squirrely automounter just to be able to deal with the occasional
comings and goings of USB flash drives, printers, and so on.  I don't
acquire and throw away printers like tissue paper, and mount/umount for 
dynamic drive volumes with proper user permissions suits me just fine.
You set it up in /etc/fstab, if necessary with UUID references, and it
Just Works.

As such, I really don't want to go visit GNOME Desktop -> Preferences ->
Removable Drives and Media to configure what gnome-volume-manager/pmount-hal 
do when that flash drive comes or goes -- because more than likely I
don't want GNOME Desktop and all of its kin.  Nor the kio_media stuff,
nor Thunar/gamin/pmount.
(Continue reading)

Greg KH | 5 Dec 2008 20:42
Gravatar

Re: Per-user network up and down scripts

On Fri, Dec 05, 2008 at 11:06:11AM -0800, Rick Moen wrote:
> Quoting Greg KH (greg <at> kroah.com):
> 
> > Then go back to a 5 year old distro and see how well it works for
> > dynamic devices and proper multi-user permissions on those devices.
> 
> Succinctly put.
> 
> A system events such as loading a module, pressing a hotkey, closing a
> laptop lid, inserting or removing a dynamic device occurs.  With the
> last of those as an example, attaching or removing a USB flash drive
> triggers kobject uevent() or kobject uevent env() in the kernel, which
> transmits the event to udevd, which registers it in an abstract socket,
> managing device nodes according to rules in /etc/udev.  HAL reads that
> event, coreates a device object under /org/freedesktop/Hal/devices/, and
> emits a DeviceAdded signal.  Which signal applications can then notice
> via the D-BUS system bus.  Right?

right.

> That's all fine.  Where I have a problem is the need to run some
> squirrely automounter just to be able to deal with the occasional
> comings and goings of USB flash drives, printers, and so on.

printers are not automounted.

But you do need persistant device naming for your printers, that is why
the whole udev thing was started in the first place (consider 2 USB
printers plugged into one machine, they need to have the same name no
matter which one is seen first by the box, and they will be found in
(Continue reading)

Rick Moen | 5 Dec 2008 21:41
Favicon

Re: Per-user network up and down scripts

Quoting Greg KH (greg <at> kroah.com):

> But you do need persistant device naming for your printers, that is why
> the whole udev thing was started in the first place

I appreciate that.  Specifically, _USB_ printers, since no prior interface
suffered USB's hapless ambiguity about addressing.  (That is one of
several reasons I'd far rather have a network printer, generally.)

Of course, two USB printers on one box is seldom seen.

> How does it "just work"?  I have about 10 different usb storage devices
> here, and more collect every day.  You need some type of "automount"
> system to be able to do this properly

No, you don't.

Again, "collecting more each day" is another edge case.  Even seriously
geeky people at most have two or three banging around their pockets,
changing that population only once in a blue moon.

So, you go do "mount /dev/sdb1 /media/blah", hmm, doesn't work, 
"mount /dev/sdc1 /media/blah".  If that still doesn't work, peek at the
end of the logfile, resubmit mount invocation, done.

If the above gets to be a hassle, add their UUIDs to /etc/fstab.

You don't think that's "properly":  To me, it fits the operational
definition of "just works".

(Continue reading)

D. Joe Anderson | 5 Dec 2008 22:02

Re: Per-user network up and down scripts

On Fri, Dec 05, 2008 at 12:41:23PM -0800, Rick Moen wrote:

> > Oh, and are you going to tell my daughter to go edit
> > /etc/fstab just to plug in her new usb drive that she bought
> > at the store?
> 
> I don't think your daughter and I have even been formally
> introduced, Greg.  ;->
> 
> Meanwhile, my machines are not built for your daughter's
> convenience, but rather mine.  In my world, automounters tend
> to cause more trouble than they merit.

Seems that it should have been clear for some time now that KDE
and GNOME are *not* built for the convenience of elitists (as
that term is understood in the context of this mailing list).

Those of us who think little of firing up sudo $EDITOR /etc/fstab
are the edge case, to those projects. 

Why this is so, and whether it should be so, and if and how to
make it not be so, seem to be more the honest heart of the
discussion.

Or, to put it another way:

You know, I hear that there's absolutely *nothing* standing in
the way of setting up your own top-level domain!  How *cool* is
that?

(Continue reading)

Rick Moen | 5 Dec 2008 22:15
Favicon

Re: Per-user network up and down scripts

Quoting D. Joe Anderson (deejoe <at> etrumeus.com):

> Why this is so, and whether it should be so, and if and how to
> make it not be so, seem to be more the honest heart of the
> discussion.

I'm unclear on what specifically in _that_ area merits discussion, though
perhaps you aim to illustrate, i.e., by saying something interesting about it.
So, I look forward to seeing your exception to the general rule of tedious
advocacy and doubtful pop psychology.
Greg KH | 5 Dec 2008 23:25
Gravatar

Re: Per-user network up and down scripts

On Fri, Dec 05, 2008 at 12:41:23PM -0800, Rick Moen wrote:
> Quoting Greg KH (greg <at> kroah.com):
> 
> > But you do need persistant device naming for your printers, that is why
> > the whole udev thing was started in the first place
> 
> I appreciate that.  Specifically, _USB_ printers, since no prior interface
> suffered USB's hapless ambiguity about addressing.  (That is one of
> several reasons I'd far rather have a network printer, generally.)
> 
> Of course, two USB printers on one box is seldom seen.

Perhaps in your household, not in mine.  Actually it's quite common on a
print server, which would be that network printer device there :)

> > How does it "just work"?  I have about 10 different usb storage devices
> > here, and more collect every day.  You need some type of "automount"
> > system to be able to do this properly
> 
> No, you don't.
> 
> Again, "collecting more each day" is another edge case.  Even seriously
> geeky people at most have two or three banging around their pockets,
> changing that population only once in a blue moon.

Have you not visited a trade show recently?  They are given out more
than candy these days.

> So, you go do "mount /dev/sdb1 /media/blah", hmm, doesn't work, 
> "mount /dev/sdc1 /media/blah".  If that still doesn't work, peek at the
(Continue reading)


Gmane