On Wed, 17.04.13 17:09, Lennart Poettering (lenn...@poettering.net) wrote: > > On Tue, 16.04.13 09:11, Koen Kooi (k...@dominion.thruhere.net) wrote: > > > Hi, > > > > To help with flashing the onboard eMMC of a 100000 boards I'm using > > systemd-nspawn to run package postinstall scripts that generate UUIDs and > > some other things and it's working great for that! Every board now has a > > unique value in /etc/machine-id instead it being empty and systemd > > randomizing it on startup. > > > > What doesn't work however is something like this: > > > > systemd-nspawn -D ${PART2MOUNT} /usr/bin/timedatectl set-timezone > > Europe/Paris > > > > or this: > > > > systemd-nspawn -D ${PART2MOUNT} /usr/bin/hostnamectl set-hostname > > BeagleBoneBlack > > > > I know I can run the lowlevel 'ln -sf <zoneinfo> /etc/timezone' or echo the > > name into /etc/hostname, but I'd like to use the *ctl commands because they > > work and have error handling built-in. > > it looks like I would need -b to get the *ctl commands to work, but -b > > doesn't support running single commands and exiting. > > timedatectl is just a frontend to timedated. So, without running > timedated inside of the container this is not going to be easy to do.
Ah, I missed that you'd actually be OK with booting up the whole thing for this command... You'd just need a nice way to run something after boot-up is complete, and that immeidately shuts down the container afterwards, right? Hmm, here's an idea: we could add a generator to systemd which looks for "systemd.run=" or so on the kernel cmdline and simply generates throw-away unit files from that, that runs the specified command(s) and triggers a shutdown afterwards... Would that work for you? i.e. you'd then call: systemd-nspawn -bD /srv/foobar \ systemd.run='/usr/bin/timedatectl set-timezone Europe/Paris' \ systemd.run='/usr/bin/timedatectl set-hostname BeagleBoneBlack' and so on... I think that would be reasonably pretty? Lennart -- Lennart Poettering - Red Hat, Inc. _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel