register bash script as dbus object

Александр Лавриненко lavrinenko_alex at mail.ru
Fri Dec 12 05:16:18 PST 2008


В сообщении от Пятница 12 декабря 2008 Thiago Macieira написал(a):
> On Friday 12 December 2008 13:22:54 Matthew Johnson wrote:
> > On Fri Dec 12 15:06, Александр Лавриненко wrote:
> > > Why no way? Say, connect to dbus, announce itself and wait for methods
> > > from clients could be done with:
> > >
> > > ...
> > > connect-dbus-object-from-script bla-bla-bla......| while (read string ;
> > > do
> > >
> > > but there's no "connect-dbus-object-from-script" or similar program to
> > > use from scripts (nevermind the syntax - this is just conceptual
> > > example).
> >
> > Precisely, this is why I said there's no way to do it, because there's no
> > such program at the moment, because noone has needed one yet.
>
> Please note that proper D-Bus support would require bi-directional
> communication. So a pipe won't be enough:
Sure it is. Main loop can be done around 'some-program-object', that upon 
connect to bus prints some comm. ID first. Script saves this ID and uses 
later with 'some-another-program-to-send-signals-and-replies'.

> 	some-program | while read line; do .... done
>
> So what happens is that you need a generic D-Bus program whose scripting
> language is bash.
>
> It's doable, but no one has done that yet. It's probably because it takes
> more time to write that program to interface with a shell script than to
> write the entire operation in C, C++, Python, Java, or whatever.
I agree, in C/C++ it might be easier. But since dbus is used virtually 
everywere across the system, some OS utilities/tasks that where previousely 
implemented as scripts (*NIX way) now tend to be ELF exes. And this is not 
correct IMHO.


Best regards,
-- 
Alexander Lavrinenko


More information about the dbus mailing list