From 50072ccf1bfee8a53563a083a3a52b26f0d5678f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 16 Oct 2022 22:45:17 +0200 Subject: units: rework growfs units to be just a regular unit that is instantiated The systemd-growfs@.service units are currently written in full for each file system to grow. Which is kinda pointless given that (besides an optional ordering dep) they contain always the same definition. Let's fix that and add a static template for this logic, that the generator simply instantiates (and adds an ordering dep for). This mimics how systemd-fsck@.service is handled. Similar to the wait that for root fs there's a special instance systemd-fsck-root.service we also add a special instance systemd-growfs-root.service for the root fs, since it has slightly different deps. Fixes: #20788 See: #10014 --- units/meson.build | 2 ++ units/systemd-growfs-root.service.in | 22 ++++++++++++++++++++++ units/systemd-growfs@.service.in | 23 +++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 units/systemd-growfs-root.service.in create mode 100644 units/systemd-growfs@.service.in (limited to 'units') diff --git a/units/meson.build b/units/meson.build index 48b24f05c1..62ce438a3f 100644 --- a/units/meson.build +++ b/units/meson.build @@ -267,6 +267,8 @@ in_units = [ 'sysinit.target.wants/'], ['systemd-pcrmachine.service', 'HAVE_GNU_EFI HAVE_OPENSSL HAVE_TPM2', 'sysinit.target.wants/'], + ['systemd-growfs-root.service', ''], + ['systemd-growfs@.service', ''], ] add_wants = [] diff --git a/units/systemd-growfs-root.service.in b/units/systemd-growfs-root.service.in new file mode 100644 index 0000000000..295bafd5af --- /dev/null +++ b/units/systemd-growfs-root.service.in @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# 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=Grow Root File System +Documentation=man:systemd-growfs-root.service(8) +DefaultDependencies=no +Conflicts=shutdown.target +After=systemd-repart.service systemd-remount-fs.service +Before=shutdown.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart={{ROOTLIBEXECDIR}}/systemd-growfs / +TimeoutSec=0 diff --git a/units/systemd-growfs@.service.in b/units/systemd-growfs@.service.in new file mode 100644 index 0000000000..7154e4ca76 --- /dev/null +++ b/units/systemd-growfs@.service.in @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# 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=Grow File System on %f +Documentation=man:systemd-growfs@.service(8) +DefaultDependencies=no +BindsTo=%i.mount +Conflicts=shutdown.target +After=systemd-repart.service %i.mount +Before=shutdown.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart={{ROOTLIBEXECDIR}}/systemd-growfs %f +TimeoutSec=0 -- cgit v1.2.1