5 ms·
- FLAVOR: Ubuntu Server - HEADLINE: First boot post-install hook - DESCRIPTION: There is currently no clean way to have a script run only once post-install, f
by carlisle_ 10y ago
- FLAVOR: Ubuntu Server
- HEADLINE: First boot post-install hook
- DESCRIPTION: There is currently no clean way to have a script run only once post-install, first boot. There are hacks for making this work to a degree, including things like self-deleting init scripts. I would most prefer to see this hook officially supported in robust way.
- ROLE/AFFILIATION: Systems Engineer
- JdeBP 10y agoDo you mean like ConditionFirstBoot? * http://manpages.ubuntu.com/manpages/zesty/man5/systemd.unit.5.html http://manpages.ubuntu.com/manpages/zesty/man5/systemd.unit....
- stephenr 10y agoThe docs say the test is if /etc is empty. Most packages provide some kind of defaults in /etc when they're installed - wouldn't that mean this never triggers?
- majewsky 10y agoNo, it will work even if stuff is installed in /etc. The actual check is `test -f /etc/machine-id`: https://github.com/systemd/systemd/blob/5978bdd05fed013d301f6d8b089c7c7ea8c0ef8e/src/core/main.c#L1743-L1745 https://github.com/systemd/systemd/blob/5978bdd05fed013d301f... I'll file a bugreport with systemd about the inaccurate documentation. EDIT: Here it is: https://github.com/systemd/systemd/issues/5696 https://github.com/systemd/systemd/issues/5696
- stephenr 10y agoGood to know, thanks.
- JdeBP 10y agoMore immediately, the actual check is a test for one of the flag files that I mentioned at https://news.ycombinator.com/item?id=13473273 https://news.ycombinator.com/item?id=13473273 : /run/systemd/first-boot . This file is initially created/unlinked to correspond with the result of the check that you mention, but is also modified later on. A prior bug report discussing the "misleading" doco in this very area was https://github.com/systemd/systemd/issues/5562 https://github.com/systemd/systemd/issues/5562 , which was closed as "not a bug".
- dustinkirkland 10y agocloud-init? cloud-init.org