[systemd-devel] [PATCH] fstab-generator: mask systemd-fsck-root for /sysroot unit
harald at redhat.com
harald at redhat.com
Fri Feb 20 03:24:33 PST 2015
From: Harald Hoyer <harald at redhat.com>
If the fstab-generator generates a mount unit for /sysroot, we shall not
run systemd-fsck-root in the real root.
---
Makefile.am | 1 +
src/fstab-generator/fstab-generator.c | 11 +++++++++++
2 files changed, 12 insertions(+)
diff --git a/Makefile.am b/Makefile.am
index ba63f68..f28a984 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2427,6 +2427,7 @@ systemd_fstab_generator_SOURCES = \
src/core/mount-setup.c
systemd_fstab_generator_LDADD = \
+ libsystemd-units.la \
libsystemd-label.la \
libsystemd-shared.la
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 5662b5f..a5e763c 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -37,6 +37,7 @@
#include "generator.h"
#include "strv.h"
#include "virt.h"
+#include "install.h"
static const char *arg_dest = "/tmp";
static bool arg_fstab_enabled = true;
@@ -388,6 +389,10 @@ static int parse_fstab(bool initrd) {
static int add_root_mount(void) {
_cleanup_free_ char *what = NULL;
const char *opts;
+ int r;
+ const char *const files[] = { "systemd-fsck-root.service", NULL };
+ UnitFileChange *changes = NULL;
+ unsigned n_changes = 0;
if (isempty(arg_root_what)) {
log_debug("Could not find a root= entry on the kernel command line.");
@@ -409,6 +414,12 @@ static int add_root_mount(void) {
opts = arg_root_options;
log_debug("Found entry what=%s where=/sysroot type=%s", what, strna(arg_root_fstype));
+
+ /* mask systemd-fsck-root.service */
+ r = unit_file_mask(UNIT_FILE_SYSTEM, true, NULL, (char**) files, true, &changes, &n_changes);
+ if (r < 0)
+ log_error("Failed to mask systemd-fsck-root.service: %m");
+
return add_mount(what,
"/sysroot",
arg_root_fstype,
--
2.3.0
More information about the systemd-devel
mailing list