Get serial number or XO name from command line or python
Bert Freudenberg
bert at freudenbergs.de
Sat May 28 06:25:43 EDT 2011
On 28.05.2011, at 08:55, LASKE, Lionel (C2S) wrote:
>
> Hi all,
>
> Thanks for all your answers. The serial was exactly what I expected. Great.
> About the "XO name", my question was not clear. What I'm looking for is the name in the Sugar Control Panel (Me).
> Any way to get it ?
Depends on the Sugar version, and is quite hard to make work universally.
In older versions, you could ask the PresenceService for the "ownerBuddy", and access its nick. Or directly access the file:
${HOME}/.sugar/${$SUGAR_PROFILE}/config
In newer versions, it's stored in gconf:
gconftool-2 -g /desktop/sugar/user/nick
Both of these assume you are logged in as the Sugar user. If you are running the script as root, you need to guess the user name. On an XO the user normally is "olpc", on SoaS it typically is "liveuser". If all else fails you could look for all user homes that have a ".sugar" directory. If there is only one you are lucky, otherwise you should fail and ask for the right one.
Also, watch out for non-ascii nick names, and funny characters. Kids frequently use them, unaware there may be problems in command line scripts.
- Bert -
More information about the Devel
mailing list