You are not logged in.

#1 2010-05-18 19:25:33

DPX-Infinity
Member
From: Russia
Registered: 2009-10-16
Posts: 35

UDisksEvt - UDisks events handler

Hi all.

[ For those who doesn't know: UDisks is a part of DeviceKit project (some kind of HAL replacement), which handles disks and other storage devices. It can do many useful things with them - mounting, unmounting, formattin, partitioning, even benchmarking. ]
Some time ago I've installed UDisks, and it turned out that it is very useful and simple comparing to HAL. It has (of course) no HAL dependency (though polkit and consolekit are needed), one easy to use CLI utility for manual mounting/unmounting/etc, VERY clean DBus protocol and no configuration! It works flawlessy with any kind of storage devices even over network (but I don't see for what it can be used in such way though).
But, sadly, it has no lightweight frontends for automounting and notifications yet, so it is rather difficult to build automounting system using UDisks in systems without heavy DE like Gnome.

So I've written a program which, I hope, can change this situation. It listens for UDisks D-Bus signals and performs preconfigured actions on them - just like famous halevt program. It has no runtime dependencies - you can launch it even without UDisks installed, though it makes no sense.
However, to be a complete automounting system it needs frontend like traydevice. I think I'll make such program soon.
UDisksEvt is in very early stage of development. It supports now only four predefined triggers. I will add more complicated signal matching abilities in future versions.

Here is repository: http://github.com/dpx-infinity/udisksevt . UDisksEvt is written in Haskell.

Unfortunately, there is no way currently to build it using only system-wide haskell libraries. UDisksEvt uses dbus-core and dbus-client packages, which depend on parsec>=3. These packages don't want to install from AUR. I had to install them, along with parsec-3.0.1, using cabal-install. Because of this my package has to be configured with --user option. Use makefile to build it. I can make binary package if needed.

Any feedback is welcome.

Last edited by DPX-Infinity (2010-06-05 13:29:07)

Offline

#2 2010-05-31 07:45:39

shpelda
Member
Registered: 2008-08-07
Posts: 59

Re: UDisksEvt - UDisks events handler

DeviceKit backed version of traydevice is close to be released smile.

Offline

#3 2010-06-05 13:28:51

DPX-Infinity
Member
From: Russia
Registered: 2009-10-16
Posts: 35

Re: UDisksEvt - UDisks events handler

shpelda wrote:

DeviceKit backed version of traydevice is close to be released smile.

thanks, that's a good news smile

I can't work properly on the program right now because of university exams, but after them I'll continue the development.

Offline

#4 2010-06-12 17:19:18

DPX-Infinity
Member
From: Russia
Registered: 2009-10-16
Posts: 35

Re: UDisksEvt - UDisks events handler

I've made development PKGBUILD for udisksevt and uploaded it onto AUR: http://aur.archlinux.org/packages.php?ID=38042 . It's also in my repository. If you want to use it, please read the instruction in it before.

Offline

#5 2010-06-12 20:13:33

Runiq
Member
From: Germany
Registered: 2008-10-29
Posts: 1,053

Re: UDisksEvt - UDisks events handler

Ooh, Haskell.

*downloads*

Offline

#6 2010-07-04 09:19:34

DPX-Infinity
Member
From: Russia
Registered: 2009-10-16
Posts: 35

Re: UDisksEvt - UDisks events handler

I've completed the 1.0 version of UDisksEvt.
Configuration file syntax has slightly changed; you can use now any UDisks device property for substitution in run commands and notifications. See README file for more information.
Now UDisksEvt with the new version of Traydevice enables complete DE-independent hal-less automounting system.
You can use old PKGBUILD - http://bbs.archlinux.org/viewtopic.php?id=84792 - to build the new version. I'll make separate package soon.

Last edited by DPX-Infinity (2010-07-04 09:30:58)

Offline

#7 2010-07-06 09:27:52

DPX-Infinity
Member
From: Russia
Registered: 2009-10-16
Posts: 35

Re: UDisksEvt - UDisks events handler

I've written the PKGBUILD for 1.0 version. Here it is: http://aur.archlinux.org/packages.php?ID=38723 . Read the note in PKGBUILD on the haskell libraries installation.

Offline

#8 2010-07-27 21:21:48

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,302

Re: UDisksEvt - UDisks events handler

Thanks to have developped that program.
But I cannot build your AUR package.
You explain in the PKGBUILD to make a 'haskell-parsec3' package using cabal2arch, and then build the AUR 'haskell-dbus-core' 0.8 package with it.
But 'haskell-dbus-core' 0.8 has 'haskell-parsec>=3.0.0' as a dependency not 'haskell-parsec3'.
And adding in the 'haskell-parsec3' PKGBUILD the line :
provides=('haskell-parsec')
doesn't solve the problem.
Because 'haskell-dbus-core' has also 'haskell-network' as dependency.
And 'haskell-network' from Extra has 'haskell-parsec=2.1.0.1' among its dependencies.

I don't know if 'haskell-network' can be rebuilt with the 'haskell-parsec3' 3.1.0 version.

And there is also 'haskell-http' which has erroneously the same 'haskell-parsec=2.1.0.1' dependency (I am not sure if it is used among the many dependencies).

So I don't see how the dependency problem could be resolved with the current haskell packages in Extra and AUR.

I choose to use Bauerbill and it cannot resolve that problem.
Neither can I manually.

Can you tell me if 'haskell-network' can be rebuilt with the 'haskell-parsec3' 3.1.0, if there is no difficulties with that.
As I don't know anything about haskell... presently.

I think that without some packages in Extra or AUR, it is not practical to build your package as it is now.
Maybe your package need more work to be ready in AUR.

I really would like to try to replace halevt with your new udisksevt program.

Offline

#9 2010-07-28 16:35:43

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,302

Re: UDisksEvt - UDisks events handler

I finally succeeded to build the udisksevt package.
I did as explained in the PKGBUILD to build a 'haskell-parsec3' 3.1.0 package.
I had to manually build the 'haskell-dbus-core' 0.8-1 from AUR, but changing in the PKGBUILD :

from
depends=(... 'haskell-parsec>=3.0.0' ...)
to
depends=(... 'haskell-parsec3' ...)

The other dependencies were installed by bauerbill in a preceding try to install it, which failed but let the dependencies behind.

Then I used :
bauerbill -S udisksevt

The first try failed because of a missing 'haskell-stm' in the makedepends line of the PKGBUILD.
I had to install it manually from Extra, and the second try succeeded to build and installed the package!

In fact the two versions of 'haskell-parsec' are needed, which needs two packages with a different name.
(not a very elegant solution to my opinion)

I then uninstalled all the remaining manually installed packages used to build it, which should not be used for runtime.

I now have to configure and use it and see how it can effectively replace halevt.

Last edited by berbae (2010-07-28 21:39:14)

Offline

#10 2010-07-28 19:16:31

jck
Member
From: USA
Registered: 2009-05-08
Posts: 98

Re: UDisksEvt - UDisks events handler

how is this better than a simple udev rule?

Offline

#11 2010-07-28 21:31:53

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,302

Re: UDisksEvt - UDisks events handler

jck wrote:

how is this better than a simple udev rule?

Because udev cannot use traydevice to have a notification in a systray in the graphical environment.
I also want to unmount the pluggable devices before plugging them out.
And I want to unmount them by clicking a menu entry, using the traydevice menu feature which is configurable to do just that.
Udev works at a lower layer of software, and I want to act at an upper one at the graphical level of the window manager, and independently of a file manager.
That was my usage of halevt, and with the deprecation of hal I am looking for a replacement of it, which seems to be udisksevt.

Offline

#12 2010-07-29 15:26:37

DPX-Infinity
Member
From: Russia
Registered: 2009-10-16
Posts: 35

Re: UDisksEvt - UDisks events handler

thanks for feedback, berbae)
indeed, I forgot about STM dependency smile I'll upload fixed PKGBUILD now. I also will add a note about dbus-core PKGBUILD modification.
and yes, unfortunately, haskell-dbus-core directly depends on haskell-parsec>=3.0 and indirectly depends (through haskell-network) on parsec-2.1. Moreover, dbus-core depends on another parsing library, polyparse smile this isn't a problem though, just strange - these libraries are very similar.
it is considered that the third version of parsec is several times slower than the second, thus Haskell Platform, official GHC + popular libraries bundle, won't migrate to third version. According to archlinux haskell mailing list, they are trying to provide exactly Haskell Platform packages in the main repository. So we will not upgrade to the new parsec version too. Because of all this I had to think out this package renaming trick (in fact, I've read about it on arch-haskell mailing list smile). Maybe I'll upload haskell-parsec3 and modified haskell-dbus-core packages to AUR, it will automate this PKGBUILD-editing.

there is an issue in the udisksevt invocation. I've found out that launching it in .xinitrc before dbus session will prevent it from normal work, because the environment variable DBUS_SESSION_BUS_ADDRESS isn't set when udisksevt starts. so you have to restart udisksevt manually. Solution is to launch D-Bus session before udisksevt like this:

if which dbus-launch >/dev/null 2>&1 && test -z "$DBUS_SESSION_BUS_ADDRESS"; then
    eval $(dbus-launch --sh-syntax --exit-with-session)
fi

I will add this note to the README file in repository.

PKGBUILD is uploaded, both for -git and plain versions. I also removed bogus dependency pth.

Last edited by DPX-Infinity (2010-07-29 15:46:23)

Offline

#13 2010-07-30 08:48:57

Berseker
Member
From: Near Lecco, Italy
Registered: 2008-04-24
Posts: 258

Re: UDisksEvt - UDisks events handler

DPX i would like to try you work (i used in the past halevt that was great, and now I hope to find in this what I need wink ) but sadly i can't build it since the dependency shown here is unsesolvable (like bauerbill says)

WARNING: unresolved dependencies: udisksevt-git -> haskell-dbus-client -> haskell-dbus-core -> haskell-parsec>=3.0.0 (not found)
:: Do you want to ignore the above packages for this operation? [Y/n]

also -git version of udisksevt is affected by this. do you have any suggestion for me?

Sorry I just noticed the discussion on this matter in the above posts, I'm reading them now

Last edited by Berseker (2010-07-30 08:51:48)

Offline

#14 2010-07-30 11:57:43

jck
Member
From: USA
Registered: 2009-05-08
Posts: 98

Re: UDisksEvt - UDisks events handler

I use udev to send a notification using notify-send. i don't see why it can't use traydevice.

Offline

#15 2010-07-30 21:49:41

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,302

Re: UDisksEvt - UDisks events handler

jck wrote:

I use udev to send a notification using notify-send. i don't see why it can't use traydevice.

I don't think it's a good practice to use graphical applications from a layer of programs under the graphical layer.
Udev works at a level between the kernel and the Xorg server, but under Xorg, not at the same level.
Udev is good to run commands which function at the console level, without a graphical environment.
And notification programs work above Xorg in the graphical environment.
So I don't think it is a good idea to use notify-send or traydevice from udev.
But you do as you want, it's just my opinion.

Last edited by berbae (2010-07-30 22:23:35)

Offline

#16 2010-07-30 22:14:36

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,302

Re: UDisksEvt - UDisks events handler

DPX-Infinity wrote:

Because of all this I had to think out this package renaming trick (in fact, I've read about it on arch-haskell mailing list smile). Maybe I'll upload haskell-parsec3 and modified haskell-dbus-core packages to AUR, it will automate this PKGBUILD-editing.

Thank you for the betterment you intend to make to the build procedure of the udisksevt package, because as it is now it cannot be realized directly and automatically by bauerbill.
It would be nice if it can be realized without manual interventions at all.
In fact for that to be possible, only three things are required :
1) the existence of a AUR haskell-parsec3 3.1.0 package
2) the change in the AUR haskell-dbus-core PKGBUILD as shown in my above post
3) the addition of the missing makedepends haskell-stm package in the udisksevt PKGBUILD
With that bauerbill should be able to build the package and to uninstall the unneeded packages used in the build process.
That should be nice for future releases of your package.

Concerning the udisksevt invocation issue you mentioned,
I did not encounter it because I launch udisksevt from the ~/.config/openbox/autostart.sh of openbox :

# D-bus
if which dbus-launch >/dev/null 2>&1 && test -z "$DBUS_SESSION_BUS_ADDRESS"; then
   eval `dbus-launch --sh-syntax --exit-with-session`
fi

# Programs to launch at startup
numlockx on &
# To set the <leftwindow> key as the Compose key
setxkbmap -model pc105 -layout fr -option compose:lwin

/usr/lib/notification-daemon-1.0/notification-daemon &

udisksevt -d
...

For now I will give feedback concerning my usage of that nice program to replace halevt in future posts.
Thanks again.

Last edited by berbae (2010-07-30 22:18:40)

Offline

#17 2010-08-04 13:32:53

DPX-Infinity
Member
From: Russia
Registered: 2009-10-16
Posts: 35

Re: UDisksEvt - UDisks events handler

berbae, thanks for feedback)
I uploaded PKGBUILD with missing haskell-stm dependency added.
I couldn't have done other dependency-related stuff because I was in some place with little internet in there smile I'll do your 1st and 2nd items today or tomorrow.
and, of course, the WM-specific way to launch programs is better than .xinitrc. But some WMs don't support launching programs on startup, e.g. awesome, and it is important to launch programs in correct sequence smile

Offline

#18 2010-08-04 13:42:16

DPX-Infinity
Member
From: Russia
Registered: 2009-10-16
Posts: 35

Re: UDisksEvt - UDisks events handler

jck wrote:

I use udev to send a notification using notify-send. i don't see why it can't use traydevice.

it's not very simple e.g. to launch traydevice under the correct user - the one who is using the computer right in the moment of device insertion. AFAIK this can be done using consolekit, which is UDisks indirect dependency (udisks-daemon can be launched without it, but it won't work). it is also inconvenient in case of multiple parallel X servers. and I think exactly the same as berbae does. udev rules should not be used to do user-level tasks.

Last edited by DPX-Infinity (2010-08-04 13:43:11)

Offline

#19 2010-08-06 10:01:13

DPX-Infinity
Member
From: Russia
Registered: 2009-10-16
Posts: 35

Re: UDisksEvt - UDisks events handler

OK, I've uploaded haskell-parsec3 and haskell-dbus-core-parsec3 packages to AUR. haskell-dbus-core-parsec3 package $provides haskell-dbus-core. It should work now. udisksevt itself depends on parsec-2 so there's no changes in it. Please test smile

Offline

#20 2010-08-06 12:18:17

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,221
Website

Re: UDisksEvt - UDisks events handler

I presume this application does the same as the new libfm in the pcmanfm-project: http://blog.lxde.org/?p=768 ?

Offline

#21 2010-08-06 14:12:06

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,302

Re: UDisksEvt - UDisks events handler

I intend to use bauerbill to build the package, it resolves the dependencies automatically, and at the end, removes the packages which were only used in the build process.
But if there is, in the udisksevt PKGBUILD, the package 'haskell-dbus-core' in the makedepends line, bauerbill will use that package, because it exists in the AUR, it will not use the new 'haskell-dbus-core-parcsec3' you created, even with the provides line in it.
The provides line will not be used at this stage, because the package is not yet built and installed.
So it is necessary to have 'haskell-dbus-core-parcsec3' in the makedepends line of the udisksevt PKGBUILD :
from
makedepends=('git' 'ghc' 'haskell-dbus-core' 'haskell-dbus-client' 'haskell-text' 'haskell-stm')
to
makedepends=('git' 'ghc' 'haskell-dbus-core-parsec3' 'haskell-dbus-client' 'haskell-text' 'haskell-stm')

to force bauerbill to fetch the good package in the AUR.

Sorry to ask for another modification, but this is necessary to obtain a full automation of the build process by bauerbill.

I will test the build process again after that change.Thanks.

For the usage of the program, it works as expected without errors, as far as my present tests went.

Last edited by berbae (2010-08-06 14:12:32)

Offline

#22 2010-08-06 15:11:43

DPX-Infinity
Member
From: Russia
Registered: 2009-10-16
Posts: 35

Re: UDisksEvt - UDisks events handler

I should have tested that smile thanks, I've uploaded correct git and simple versions of PKGBUILDs. Should work fine now.

Offline

#23 2010-08-06 15:54:36

DPX-Infinity
Member
From: Russia
Registered: 2009-10-16
Posts: 35

Re: UDisksEvt - UDisks events handler

I think I found another glitch, though it is not the program itself. Rather it is in the X-specific programs launching way. What I mean is that when udisks is launched earlier that the window manager or, more correctly, the consolekit session, its subprocesses (including anything that is launched using run config command) also don't belong to the session, so they cannot do anything with udisks, e.g. if traydevice is configured to use udisks, it won't work. If udisksevt is launched using WM's method, all should work fine. I don't know the solution yet. Will try to think something out.
Maybe I'm wrong and there is something with my configuration, because unmounting using traydevice works fine,..

seems it is my config problem, same setup on the notebook works well.

Last edited by DPX-Infinity (2010-08-06 16:08:34)

Offline

#24 2010-08-07 13:24:05

berbae
Member
From: France
Registered: 2007-02-12
Posts: 1,302

Re: UDisksEvt - UDisks events handler

I am sorry but there is another problem in the build process.

udisksevt has haskell-dbus-client as a makedepends package, and haskell-dbus-client has haskell-dbus-core>=0.8 as dependency.
So when bauerbill wants to prepare the building of haskell-dbus-client, it wants again to use haskell-dbus-core 0.8-1, and not haskell-dbus-core-parsec3 from AUR, for that package.
So we are again in the previous difficulty.
Because haskell-dbus-core-parsec3 is not yet built/installled at this stage, and the provide line is not detected yet.

So a haskell-dbus-client-parsec3 package is necessary in the AUR which has haskell-dbus-core-parsec3 as dependency instead of haskell-dbus-core>=0.8.

And the udisksevt PKGBUILD needs to be modified again at the makedepends line :
from
makedepends=('ghc' 'haskell-dbus-core-parsec3' 'haskell-dbus-client' 'haskell-text' 'haskell-stm')
to
makedepends=('ghc' 'haskell-dbus-core-parsec3' 'haskell-dbus-client-parsec3' 'haskell-text' 'haskell-stm')

So I am led again to ask for your nice intervention  to do these changes, to reach a smooth and fully automatic building of the package with bauerbill.

Thanks you very much for your patience about that matter.
But if the build process of your package can be facilitated and fully automatic, more users will want to try and use it.

Offline

#25 2010-08-09 16:33:09

DPX-Infinity
Member
From: Russia
Registered: 2009-10-16
Posts: 35

Re: UDisksEvt - UDisks events handler

how could I forget about that) sorry for inconvenience, the packages has been updated now.

Offline

Board footer

Powered by FluxBB