SHA256
1
0
forked from pool/systemd
systemd/modules_on_boot.patch
Frederic Crozat e2e7dc10df Accepting request 87530 from home:fcrozat:systemd
- Shadow single sysv service, it was breaking runlevel 1.
- Add modules_on_boot.patch to handle /etc/sysconfig/kernel
  MODULES_ON_BOOT variable (bnc#721662).

OBS-URL: https://build.opensuse.org/request/show/87530
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=215
2011-10-12 13:43:49 +00:00

80 lines
2.8 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(-)
diff --git a/src/modules-load.c b/src/modules-load.c
index 8dd98f7..73ef5f5 100644
--- a/src/modules-load.c
+++ b/src/modules-load.c
@@ -36,6 +36,9 @@ int main(int argc, char *argv[]) {
char **arguments = NULL;
unsigned n_arguments = 0, n_allocated = 0;
char **files, **fn;
+#if defined(TARGET_SUSE)
+ char *modules_on_boot = NULL;
+#endif
if (argc > 1) {
log_error("This program takes no argument.");
@@ -126,6 +129,42 @@ int main(int argc, char *argv[]) {
}
strv_free(files);
+#if defined(TARGET_SUSE)
+ 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));
+ }
+ if (modules_on_boot) {
+ char **modules = strv_split(modules_on_boot,WHITESPACE);
+ char **module;
+ if (modules) {
+ STRV_FOREACH(module, modules) {
+ if (n_arguments >= n_allocated) {
+ char **a;
+ unsigned m;
+
+ m = MAX(16U, n_arguments*2);
+
+ if (!(a = realloc(arguments, sizeof(char*) * (m+1)))) {
+ log_error("Failed to increase module array size.");
+ free(*module);
+ r = EXIT_FAILURE;
+ continue;
+ }
+
+ arguments = a;
+ n_allocated = m;
+ }
+ log_debug("adding module: %s\n", *module);
+ arguments[n_arguments++] = strdup(*module);
+ }
+ }
+ strv_free(modules);
+ }
+#endif
+
finish:
if (n_arguments > 3) {
@@ -138,6 +177,9 @@ finish:
}
strv_free(arguments);
+#if defined(TARGET_SUSE)
+ free(modules_on_boot);
+#endif
return r;
}
--
1.7.3.4