[Sugar-devel] How to get sugar config values without a console?
pgf at laptop.org
pgf at laptop.org
Thu May 28 10:48:30 EDT 2009
martin wrote:
> I'm working on olpc-update-query, a script that runs without a tty
> (from NM hooks and cron) and needs to query Sugar configuration stuff.
> To make things more complicated, it runs as root :-/
>
> It's a good thing that we have sugar-control-panel, but at least on
> 0.82 it doesn't work unless you're in Terminal. Strangely enough, it
> tries to load gtk.
if you're root, use the force:
#!/bin/sh
get_x_credentials()
{
# fetch the local X server's XAUTHORITY variable
eval "$( xargs -n 1 -0 < /proc/$(pidof X)/environ | grep '^XAUTHORITY=')"
export XAUTHORITY
export DISPLAY=:0
}
test "$XAUTHORITY" || get_x_credentials
sugar-control-panel -blah
=---------------------
paul fox, pgf at laptop.org
More information about the Sugar-devel
mailing list