From: Lennart Poettering Date: Fri, 13 Jun 2014 11:10:30 +0000 (+0200) Subject: units: rebuild /etc/passwd, the udev hwdb and the journal catalog files on boot X-Git-Tag: v215~461 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=ecde7065f7b11a7a226d2f7b0e90e998a6347a59;hp=a55654d598c78f8e084aa6a18fec6eff900c9aed units: rebuild /etc/passwd, the udev hwdb and the journal catalog files on boot Only when necessary of course, nicely guarded with the new ConditionNeedsUpdate= condition we added. --- diff --git a/Makefile.am b/Makefile.am index 8fd933be5..abf8a2bb3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -491,6 +491,7 @@ nodist_systemunit_DATA = \ units/systemd-udevd.service \ units/systemd-udev-trigger.service \ units/systemd-udev-settle.service \ + units/systemd-udev-hwdb-update.service \ units/debug-shell.service \ units/initrd-parse-etc.service \ units/initrd-cleanup.service \ @@ -1783,10 +1784,17 @@ systemd_sysusers_LDADD = \ rootlibexec_PROGRAMS += \ systemd-sysusers +nodist_systemunit_DATA += \ + units/systemd-sysusers.service + +SYSINIT_TARGET_WANTS += \ + systemd-sysusers.service + nodist_sysusers_DATA = \ sysusers.d/systemd.conf EXTRA_DIST += \ + units/systemd-sysusers.service.in \ sysusers.d/systemd.conf.in INSTALL_DIRS += \ @@ -2753,19 +2761,23 @@ CLEANFILES += \ EXTRA_DIST += \ units/systemd-udevd.service.in \ units/systemd-udev-trigger.service.in \ - units/systemd-udev-settle.service.in + units/systemd-udev-settle.service.in \ + units/systemd-udev-hwdb-update.service.in CLEANFILES += \ units/systemd-udevd.service \ units/systemd-udev-trigger.service \ - units/systemd-udev-settle.service + units/systemd-udev-settle.service \ + units/systemd-udev-hwdb-update.service SOCKETS_TARGET_WANTS += \ systemd-udevd-control.socket \ systemd-udevd-kernel.socket + SYSINIT_TARGET_WANTS += \ systemd-udevd.service \ - systemd-udev-trigger.service + systemd-udev-trigger.service \ + systemd-udev-hwdb-update.service rootbin_PROGRAMS += \ udevadm @@ -3540,7 +3552,8 @@ dist_systemunit_DATA += \ nodist_systemunit_DATA += \ units/systemd-journald.service \ - units/systemd-journal-flush.service + units/systemd-journal-flush.service \ + units/systemd-journal-catalog-update.service dist_pkgsysconf_DATA += \ src/journal/journald.conf @@ -3557,11 +3570,13 @@ SOCKETS_TARGET_WANTS += \ SYSINIT_TARGET_WANTS += \ systemd-journald.service \ - systemd-journal-flush.service + systemd-journal-flush.service \ + systemd-journal-catalog-update.service EXTRA_DIST += \ units/systemd-journald.service.in \ units/systemd-journal-flush.service.in \ + units/systemd-journal-catalog-update.service.in \ src/journal/journald-gperf.gperf CLEANFILES += \ diff --git a/units/.gitignore b/units/.gitignore index 45ddab72e..8ae6ca894 100644 --- a/units/.gitignore +++ b/units/.gitignore @@ -32,6 +32,7 @@ /systemd-initctl.service /systemd-journal-flush.service /systemd-journal-gatewayd.service +/systemd-journal-catalog-update.service /systemd-journald.service /systemd-kexec.service /systemd-localed.service @@ -54,12 +55,14 @@ /systemd-shutdownd.service /systemd-suspend.service /systemd-sysctl.service +/systemd-sysusers.service /systemd-timedated.service /systemd-timesyncd.service /systemd-tmpfiles-clean.service /systemd-tmpfiles-setup-dev.service /systemd-tmpfiles-setup.service /systemd-tmpfiles.service +/systemd-udev-hwdb-update.service /systemd-udev-settle.service /systemd-udev-trigger.service /systemd-udevd.service diff --git a/units/systemd-journal-catalog-update.service.in b/units/systemd-journal-catalog-update.service.in new file mode 100644 index 000000000..d45381d47 --- /dev/null +++ b/units/systemd-journal-catalog-update.service.in @@ -0,0 +1,22 @@ +# 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=Rebuild Journal Catalog +Documentation=man:systemd-journald.service(8) man:journald.conf(5) +DefaultDependencies=no +Conflicts=shutdown.target +After=systemd-readahead-collect.service systemd-readahead-replay.service local-fs.target +Before=sysinit.target shutdown.target systemd-update-done.service +RefuseManualStart=yes +RefuseManualStop=yes +ConditionNeedsUpdate=/etc + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=@rootbindir@/journalctl --update-catalog diff --git a/units/systemd-networkd.service.in b/units/systemd-networkd.service.in index 48f4d63a8..57c3fbff5 100644 --- a/units/systemd-networkd.service.in +++ b/units/systemd-networkd.service.in @@ -9,7 +9,7 @@ Description=Network Service Documentation=man:systemd-networkd.service(8) DefaultDependencies=no -After=dbus.service network-pre.target +After=dbus.service network-pre.target systemd-sysusers.service Before=network.target Wants=network.target ConditionCapability=CAP_NET_ADMIN diff --git a/units/systemd-sysusers.service.in b/units/systemd-sysusers.service.in new file mode 100644 index 000000000..e123f398a --- /dev/null +++ b/units/systemd-sysusers.service.in @@ -0,0 +1,22 @@ +# 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=Create System Users +Documentation=man:sysusers.d(5) man:systemd-sysusers.service(8) +DefaultDependencies=no +Conflicts=shutdown.target +After=systemd-readahead-collect.service systemd-readahead-replay.service systemd-remount-fs.service +Before=sysinit.target shutdown.target systemd-update-done.service +RefuseManualStart=yes +RefuseManualStop=yes +ConditionNeedsUpdate=/etc + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=@rootlibexecdir@/systemd-sysusers diff --git a/units/systemd-timesyncd.service.in b/units/systemd-timesyncd.service.in index 3a1bc48a9..a20621dd5 100644 --- a/units/systemd-timesyncd.service.in +++ b/units/systemd-timesyncd.service.in @@ -11,7 +11,7 @@ Documentation=man:systemd-timesyncd.service(8) ConditionCapability=CAP_SYS_TIME DefaultDependencies=off RequiresMountsFor=/var/lib/systemd/clock -After=systemd-remount-fs.service systemd-tmpfiles-setup.service +After=systemd-remount-fs.service systemd-tmpfiles-setup.service systemd-sysusers.service Before=sysinit.target shutdown.target Conflicts=shutdown.target Wants=time-sync.target diff --git a/units/systemd-tmpfiles-setup.service.in b/units/systemd-tmpfiles-setup.service.in index 747c9a8d6..d3c6da88c 100644 --- a/units/systemd-tmpfiles-setup.service.in +++ b/units/systemd-tmpfiles-setup.service.in @@ -10,7 +10,7 @@ Description=Create Volatile Files and Directories Documentation=man:tmpfiles.d(5) man:systemd-tmpfiles(8) DefaultDependencies=no Conflicts=shutdown.target -After=systemd-readahead-collect.service systemd-readahead-replay.service local-fs.target +After=systemd-readahead-collect.service systemd-readahead-replay.service local-fs.target systemd-sysusers.service Before=sysinit.target shutdown.target RefuseManualStart=yes RefuseManualStop=yes diff --git a/units/systemd-udev-hwdb-update.service.in b/units/systemd-udev-hwdb-update.service.in new file mode 100644 index 000000000..4e7b845ea --- /dev/null +++ b/units/systemd-udev-hwdb-update.service.in @@ -0,0 +1,22 @@ +# 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=Rebuild Hardware Database +Documentation=man:udev(7) man:systemd-udevd.service(8) +DefaultDependencies=no +Conflicts=shutdown.target +After=systemd-readahead-collect.service systemd-readahead-replay.service systemd-remount-fs.service +Before=sysinit.target shutdown.target systemd-update-done.service +RefuseManualStart=yes +RefuseManualStop=yes +ConditionNeedsUpdate=/etc + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=@rootbindir@/udevadm hwdb --update diff --git a/units/systemd-udevd.service.in b/units/systemd-udevd.service.in index ddee01537..f6acd6fe4 100644 --- a/units/systemd-udevd.service.in +++ b/units/systemd-udevd.service.in @@ -10,7 +10,7 @@ Description=udev Kernel Device Manager Documentation=man:systemd-udevd.service(8) man:udev(7) DefaultDependencies=no Wants=systemd-udevd-control.socket systemd-udevd-kernel.socket -After=systemd-udevd-control.socket systemd-udevd-kernel.socket +After=systemd-udevd-control.socket systemd-udevd-kernel.socket systemd-udev-hwdb-update.service systemd-sysusers.service Before=sysinit.target ConditionPathIsReadWrite=/sys