1 |
commit: 9fdb3acb257e7103a89e8f47fe8cb23e614efe84 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Aug 2 10:44:56 2020 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Aug 2 22:40:14 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=9fdb3acb |
7 |
|
8 |
Make use of expand_file() for --linuxrc option |
9 |
|
10 |
Bug: https://bugs.gentoo.org/483146 |
11 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
12 |
|
13 |
gen_determineargs.sh | 13 +++++++++++++ |
14 |
gen_initramfs.sh | 13 +++++-------- |
15 |
genkernel.conf | 3 +++ |
16 |
3 files changed, 21 insertions(+), 8 deletions(-) |
17 |
|
18 |
diff --git a/gen_determineargs.sh b/gen_determineargs.sh |
19 |
index 0a404ee..3a7882d 100755 |
20 |
--- a/gen_determineargs.sh |
21 |
+++ b/gen_determineargs.sh |
22 |
@@ -353,6 +353,7 @@ determine_real_args() { |
23 |
set_config_with_override BOOL RAMDISKMODULES CMD_RAMDISKMODULES "yes" |
24 |
set_config_with_override BOOL ALLRAMDISKMODULES CMD_ALLRAMDISKMODULES "no" |
25 |
set_config_with_override STRING INITRAMFS_OVERLAY CMD_INITRAMFS_OVERLAY |
26 |
+ set_config_with_override STRING LINUXRC CMD_LINUXRC |
27 |
set_config_with_override BOOL MOUNTBOOT CMD_MOUNTBOOT "yes" |
28 |
set_config_with_override BOOL BUILD_STATIC CMD_STATIC "no" |
29 |
set_config_with_override BOOL SAVE_CONFIG CMD_SAVE_CONFIG "yes" |
30 |
@@ -1145,6 +1146,18 @@ determine_real_args() { |
31 |
fi |
32 |
fi |
33 |
|
34 |
+ if [ -n "${LINUXRC}" ] |
35 |
+ then |
36 |
+ LINUXRC=$(expand_file "${CMD_LINUXRC}" 2>/dev/null) |
37 |
+ if [ -z "${LINUXRC}" ] |
38 |
+ then |
39 |
+ gen_die "--linuxrc value '${CMD_LINUXRC}' failed to expand!" |
40 |
+ elif [ ! -e "${LINUXRC}" ] |
41 |
+ then |
42 |
+ gen_die "--linuxrc file '${LINUXRC}' does not exist!" |
43 |
+ fi |
44 |
+ fi |
45 |
+ |
46 |
need_tar=yes |
47 |
fi |
48 |
|
49 |
|
50 |
diff --git a/gen_initramfs.sh b/gen_initramfs.sh |
51 |
index 24ddcb5..3cd535c 100755 |
52 |
--- a/gen_initramfs.sh |
53 |
+++ b/gen_initramfs.sh |
54 |
@@ -1795,18 +1795,14 @@ append_auxilary() { |
55 |
done |
56 |
|
57 |
local mylinuxrc= |
58 |
- if [ -f "${CMD_LINUXRC}" ] |
59 |
+ if [ -n "${LINUXRC}" ] |
60 |
then |
61 |
- mylinuxrc="${CMD_LINUXRC}" |
62 |
+ mylinuxrc="${LINUXRC}" |
63 |
print_info 2 "$(get_indent 2)>> Copying user specified linuxrc '${mylinuxrc}' to '/init' ..." |
64 |
- cp -aL "${mylinuxrc}" "${TDIR}"/init 2>/dev/null \ |
65 |
- || gen_die "Failed to copy '${mylinuxrc}' to '${TDIR}/init'!" |
66 |
elif isTrue "${NETBOOT}" |
67 |
then |
68 |
mylinuxrc="${GK_SHARE}/netboot/linuxrc.x" |
69 |
print_info 2 "$(get_indent 2)>> Copying netboot specific linuxrc '${mylinuxrc}' to '/init' ..." |
70 |
- cp -aL "${mylinuxrc}" "${TDIR}"/init 2>/dev/null \ |
71 |
- || gen_die "Failed to copy '${mylinuxrc}' to '${TDIR}/init'!" |
72 |
else |
73 |
if [ -f "${GK_SHARE}/arch/${ARCH}/linuxrc" ] |
74 |
then |
75 |
@@ -1816,10 +1812,11 @@ append_auxilary() { |
76 |
fi |
77 |
|
78 |
print_info 2 "$(get_indent 2)>> Copying '${mylinuxrc}' to '/init' ..." |
79 |
- cp -aL "${mylinuxrc}" "${TDIR}"/init 2>/dev/null \ |
80 |
- || gen_die "Failed to copy '${mylinuxrc}' to '${TDIR}/init'!" |
81 |
fi |
82 |
|
83 |
+ cp -aL "${mylinuxrc}" "${TDIR}"/init 2>/dev/null \ |
84 |
+ || gen_die "Failed to copy '${mylinuxrc}' to '${TDIR}/init'!" |
85 |
+ |
86 |
# Make sure it's executable |
87 |
chmod 0755 "${TDIR}"/init || gen_die "Failed to chmod of '${TDIR}/init' to 0755!" |
88 |
|
89 |
|
90 |
diff --git a/genkernel.conf b/genkernel.conf |
91 |
index 93cf8e7..654f185 100644 |
92 |
--- a/genkernel.conf |
93 |
+++ b/genkernel.conf |
94 |
@@ -363,6 +363,9 @@ DEFAULT_KERNEL_SOURCE="/usr/src/linux" |
95 |
#MODULES_group1="some-module" |
96 |
#MODULES_group2="" # Load no modules for this group |
97 |
|
98 |
+# Override the default used linuxrc script. |
99 |
+#LINUXRC="/path/to/custom/linuxrc" |
100 |
+ |
101 |
# Archive file created using tar containing modules after |
102 |
# the callbacks have run |
103 |
#MODULESPACKAGE="/path/to/file.tar.xz" |