[Sugar-devel] how to run script upon/after XO's 1st boot?

James Cameron quozl at laptop.org
Thu Jan 7 21:14:27 EST 2016


On Thu, Jan 07, 2016 at 03:47:39PM -0500, Adam Holt wrote:
> 1) Can a script be run at the end of Sugar's first boot?  Or really
> anytime after gsettings name/gender/grade stuff?  (After every boot
> if nec.)
> 
> I tried inserting a script very late within /usr/bin/sugar (however
> that runs too early during Sugar's 1st boot) but I'm now remember an
> autoexec.bat-style / home/olpc/.olpc-<something?> file Quozl
> mentioned earlier which is auto-run for testing --- hopefully near
> the end of Sugar's launch, does anyone recall such/ similar?

No, Sugar does not have an execution hook at that point, but with
careful programming it could be added.

We used to have one for the Welcome activity, but that wasn't taken by
Sugar Labs upstream.  You might look through the patches in Sugar Labs
trac or OLPC trac for "welcome".

> (Crazy Talk: might be there be some way to trigger off the creation
> of /home/ olpc/.olpc-configured which apparently happens during 1st
> boot?  In any case, 1st boot or any-subsequent-boot can be resolved
> trivially, given a suitable trigger/callout we need near the end of
> Sugar's every bootup sequence, regardless whether 1st-boot or
> every-subsequent-boot...)

That's not a Sugar question, but is relevant to OLPC OS.
olpc-configure is part of the olpc-utils package, and uses
.olpc-configured to figure out if it should run again.

If you want a script you write to run once, then make a marker and
test for it, e.g.

	[ -e .adam-configured ] && exit
	# (add here the things you want done once)
	touch .adam-configured

See man [, search for -e

See man bash, search for &&

> 2) Much Harder Question, which might not be solvable:
> 
> Resetting ("gsettings reset ...") or renaming Sugar's nick from
> Terminal using "gsettings set org.sugarlabs.user nick
> TEST-MACHINE-XYZ" works!  But scripting this doesn't work using 'su
> - olpc -c "gsettings set org.sugarlabs.user nick
> DEFAULT-MACHINE-XYZ" ' fails, with error:
> 
> ** (process:2326): CRITICAL **: unable to create directory
> 'run/user/0/dconf': Permission denied. dconf not working properly.
> 
> ** (process:2326): WARNING **: failed to commit changes to dconf:
> Error spawning command line 'dbus-launch --autolaunch=
> 7115ce3ab0574964a6590ee50e4be226 --binary-syntax --close-stderr':
> Child process exited with code 1
> 
> (Might there be any other ways to script this / skin this cat?)

You haven't described the use case.  Perhaps Sugar Labs would like to
make this easier in future, whatever it is you are doing.

You want to change a gconf setting, for which you've used gsettings
rather than changing schema.

gsettings tries to update the older dconf key storage area.

dconf isn't happy with your context; e.g. maybe you are in the wrong
seat or some environment variables are missing.

My guess is that the gconf setting has been changed anyway; can you
confirm by doing "gsettings get" on it?

Does the "gsettings set" work in a Terminal activity started from
within Sugar?  I think it does.

Or it is a matter of decoding the source code for dconf to find
out why it is failing.

-- 
James Cameron
http://quozl.netrek.org/


More information about the Sugar-devel mailing list