summaryrefslogtreecommitdiff
path: root/pcr/openrc/use-optional-modules-load-d.patch
blob: 7c91f032cf0ff9bd5abf92d414c8654b8814693e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
--- ../conf.d/modules.orig	2015-07-06 01:50:49.893895158 +0200
+++ ../conf.d/modules	2015-07-06 01:27:49.000000000 +0200
@@ -1,6 +1,11 @@
 # You can define a list modules for a specific kernel version,
 # a released kernel version, a main kernel version or just a list.
 # The most specific versioned variable will take precedence.
+
+# if openrc should make use of /etc/modules-load.d
+# systemd places stuff there
+use_modules_load_d=false
+
 #modules_2_6_23_gentoo_r5="ieee1394 ohci1394"
 #modules_2_6_23="tun ieee1394"
 #modules_2_6="tun"

--- ../init.d/modules.in.orig	2015-06-19 16:55:37.000000000 +0200
+++ ../init.d/modules.in	2015-07-06 01:30:29.154313412 +0200
@@ -16,6 +16,35 @@
 	# support compiled in ...
 	[ ! -f /proc/modules ] && return 0

+	if ${use_modules_load_d};then
+		local conf_s=/etc/modules-load.d
+		einfo "using ${conf_s}"
+		local conf_rc=/etc/conf.d/modules
+		mv ${conf_rc} ${conf_rc}.lastboot
+		touch ${conf_rc}
+		echo "use_modules_load_d=${use_modules_load_d}" >> ${conf_rc}
+		if [[ -d ${conf_s} ]] && [[ -f ${conf_s}/mhwd-gpu.conf ]]; then
+			local mods=() mhwd=() fn= kv=
+			for m in $(cat ${conf_s}/mhwd-gpu.conf | sed '/^.*#/d'); do
+				mhwd+=("$m")
+			done
+			for f in $(ls ${conf_s}/*.conf); do
+				if [[ $fn != mhwd-gpu ]];then
+					fn=${f##*/}
+					fn=${fn%%.conf}
+					kv=${fn//-*}
+					kv=${kv##linux}
+					for m in $(cat $f | sed '/^.*#/d'); do
+						mods+=("$m")
+					done
+					[[ $fn == linux${kv}-* ]] && echo 'modules_'${kv:0:1}'_'${kv:1:2}'="'${mods[@]} ${mhwd[@]}'"' >> ${conf_rc}
+					echo '' >> ${conf_rc}
+					mods=()
+				fi
+			done
+		fi
+	fi
+
 	local KV x y kv_variant_list
 	KV=$(uname -r)
 	# full $KV