SHA256
1
0
forked from pool/systemd
systemd/modules_on_boot.patch
2012-11-02 16:30:32 +00:00

72 lines
2.7 KiB
Diff

From 051e407e1af70e779c092c81733a98832c29d6b4 Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Wed, 12 Oct 2011 15:18:29 +0200
Subject: [PATCH] module-load: handle SUSE /etc/sysconfig/kernel module list
---
src/modules-load.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
Index: systemd-191/src/modules-load/modules-load.c
===================================================================
--- systemd-191.orig/src/modules-load/modules-load.c
+++ systemd-191/src/modules-load/modules-load.c
@@ -173,6 +173,9 @@ int main(int argc, char *argv[]) {
int r = EXIT_FAILURE, k;
char **files = NULL, **fn, **i;
struct kmod_ctx *ctx;
+#if defined(TARGET_SUSE)
+ char *modules_on_boot = NULL;
+#endif
if (argc > 1) {
log_error("This program takes no argument.");
@@ -256,9 +259,34 @@ int main(int argc, char *argv[]) {
fclose(f);
}
-
+#if defined(TARGET_SUSE)
+ log_debug("apply: /etc/sysconfig/kernel MODULES_LOADED_ON_BOOT");
+ if ((r = parse_env_file("/etc/sysconfig/kernel", NEWLINE,
+ "MODULES_LOADED_ON_BOOT", &modules_on_boot,
+ NULL)) < 0) {
+ if (r != -ENOENT)
+ log_warning("Failed to read /etc/sysconfig/kernel: %s", strerror(-r));
+ } else
+ r = EXIT_SUCCESS;
+ if (modules_on_boot) {
+ char **modules = strv_split(modules_on_boot,WHITESPACE);
+ char **module;
+
+ if (modules) {
+ STRV_FOREACH(module, modules) {
+ k = load_module(ctx, *module);
+ if (k < 0)
+ r = EXIT_FAILURE;
+ }
+ }
+ strv_free(modules);
+ }
+#endif
finish:
strv_free(files);
+#if defined(TARGET_SUSE)
+ free(modules_on_boot);
+#endif
kmod_unref(ctx);
strv_free(arg_proc_cmdline_modules);
Index: systemd-191/units/systemd-modules-load.service.in
===================================================================
--- systemd-191.orig/units/systemd-modules-load.service.in
+++ systemd-191/units/systemd-modules-load.service.in
@@ -13,6 +13,7 @@ Conflicts=shutdown.target
After=systemd-readahead-collect.service systemd-readahead-replay.service
Before=sysinit.target shutdown.target
ConditionCapability=CAP_SYS_MODULE
+ConditionPathExists=|/etc/sysconfig/kernel
ConditionDirectoryNotEmpty=|/lib/modules-load.d
ConditionDirectoryNotEmpty=|/usr/lib/modules-load.d
ConditionDirectoryNotEmpty=|/usr/local/lib/modules-load.d