summaryrefslogtreecommitdiff
path: root/units
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-06-13 12:43:49 +0200
committerLennart Poettering <lennart@poettering.net>2014-06-13 13:26:32 +0200
commit8ea48dfcd33e8db0c01bf8c57c3bbcfdc3c86d4b (patch)
tree474a196fe6cea93499ede05e35af8ba6ae526a65 /units
parentdc92e62c6c34f242aa54aa187e50a94ed7695c51 (diff)
update-done: add minimal tool to manage system updates for /etc and /var, if /usr has changed
In order to support offline updates to /usr, we need to be able to run certain tasks on next boot-up to bring /etc and /var in line with the updated /usr. Hence, let's devise a mechanism how we can detect whether /etc or /var are not up-to-date with /usr anymore: we keep "touch files" in /etc/.updated and /var/.updated that are mtime-compared with /usr. This means: Whenever the vendor OS tree in /usr is updated, and any services that shall be executed at next boot shall be triggered, it is sufficient to update the mtime of /usr itself. At next boot, if /etc/.updated and/or /var/.updated is older than than /usr (or missing), we know we have to run the update tools once. After that is completed we need to update the mtime of these files to the one of /usr, to keep track that we made the necessary updates, and won't repeat them on next reboot. A subsequent commit adds a new ConditionNeedsUpdate= condition that allows checking on boot whether /etc or /var are outdated and need updating. This is an early step to allow booting up with an empty /etc, with automatic rebuilding of the necessary cache files or user databases therein, as well as supporting later updates of /usr that then propagate to /etc and /var again.
Diffstat (limited to 'units')
-rw-r--r--units/.gitignore1
-rw-r--r--units/systemd-update-done.service.in21
2 files changed, 22 insertions, 0 deletions
diff --git a/units/.gitignore b/units/.gitignore
index b8c0845956..45ddab72e8 100644
--- a/units/.gitignore
+++ b/units/.gitignore
@@ -65,6 +65,7 @@
/systemd-udevd.service
/systemd-update-utmp-runlevel.service
/systemd-update-utmp.service
+/systemd-update-done.service
/systemd-user-sessions.service
/systemd-vconsole-setup.service
/user@.service
diff --git a/units/systemd-update-done.service.in b/units/systemd-update-done.service.in
new file mode 100644
index 0000000000..dccb5137d2
--- /dev/null
+++ b/units/systemd-update-done.service.in
@@ -0,0 +1,21 @@
+# This file is part of systemd.
+#
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+
+[Unit]
+Description=Update is Completed
+Documentation=man:sysusers.d(5) man:systemd-sysusers(8)
+DefaultDependencies=no
+Conflicts=shutdown.target
+After=systemd-readahead-collect.service systemd-readahead-replay.service local-fs.target
+Before=sysinit.target shutdown.target
+RefuseManualStart=yes
+RefuseManualStop=yes
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=@rootlibexecdir@/systemd-update-done