GVFS in CLI



Hello,

I want to write a little script, placed in /etc/NetworkManager/dispatcher.d/

When network-manager gets an event, it launch scripts that were placed there. I wanted to manage a sort of automount : I ping a server (specifying a short timeout to my ping command). If it succeed thant the share is mounted with GFVS.

The problem is : these scripts are launched by root. And being root I can't use gvfs-mount (I get some errors). I tried : su - user -c "gvfs-mount mount_point" but it don't work (it seems gvfs-mount dont take care about su).

-> do someone have an idea about either :
    - using gvfs-mount to mount as root a share to a user
- if gvfs-mount can't be used like that, is someone know a way to do a sort of automount well integrated with gnome/network-manager?

My situation and final purpose is :
I move a lot with my laptop and I change a lot of subnets. I also use a lot the sleeping mode so tricks with a script launched by the starting process of the gnome session don't interest me. So I want some defined share to be connected automatically when I'm in the right subnet/place.

Thank you a lot,
nm

ps : I see probably a way to do it with an application launched at the session startup and go to background as a daemon (and so launched with the user permissions). Linked with d-bus to received network event. And do the same thing than above (ping and gvfs-mount). But this is a little complicated for the purpose I want to do I think. And bash is my friend ;)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]