1 |
commit: db881955a5d03740db2dd55f33ffeeda373bf611 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Mar 29 02:53:53 2019 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Mar 29 04:12:22 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=db881955 |
7 |
|
8 |
determine_config_file(): add support for file path (tilde) expansion |
9 |
|
10 |
In addition, we make --kernel-config parameter more exclusive: |
11 |
|
12 |
Before this change, if user had set --kernel-config but value was invalid |
13 |
(i.e. file didn't exist) we silently fallback to default configuration. |
14 |
|
15 |
Now we will error out if --kernel-config is set but value is invalid |
16 |
(i.e. no file). |
17 |
|
18 |
Closes: https://bugs.gentoo.org/412321 |
19 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
20 |
|
21 |
gen_configkernel.sh | 67 ++++++++++++++++++++++++++++++++++------------------- |
22 |
1 file changed, 43 insertions(+), 24 deletions(-) |
23 |
|
24 |
diff --git a/gen_configkernel.sh b/gen_configkernel.sh |
25 |
index 541a3a8..34fdbe1 100755 |
26 |
--- a/gen_configkernel.sh |
27 |
+++ b/gen_configkernel.sh |
28 |
@@ -4,41 +4,60 @@ |
29 |
# Fills variable KERNEL_CONFIG |
30 |
determine_config_file() { |
31 |
print_info 2 "Checking for suitable kernel configuration..." |
32 |
- for f in \ |
33 |
- "${CMD_KERNEL_CONFIG}" \ |
34 |
- "/etc/kernels/kernel-config-${ARCH}-${KV}" \ |
35 |
- "${GK_SHARE}/arch/${ARCH}/kernel-config-${KV}" \ |
36 |
- "${GK_SHARE}/arch/${ARCH}/kernel-config-${VER}.${PAT}" \ |
37 |
- "${GK_SHARE}/arch/${ARCH}/generated-config" \ |
38 |
- "${GK_SHARE}/arch/${ARCH}/kernel-config" \ |
39 |
- "${DEFAULT_KERNEL_CONFIG}" |
40 |
- do |
41 |
- [ -z "${f}" ] && continue |
42 |
- |
43 |
- if [ -f "${f}" ] |
44 |
+ if [ -n "${CMD_KERNEL_CONFIG}" ] |
45 |
+ then |
46 |
+ KERNEL_CONFIG=$(expand_file "${CMD_KERNEL_CONFIG}") |
47 |
+ if [ -z "${KERNEL_CONFIG}" ] |
48 |
then |
49 |
- if grep -sq THIS_CONFIG_IS_BROKEN "$f" |
50 |
+ error_msg="No kernel .config: Cannot use '${CMD_KERNEL_CONFIG}' value. " |
51 |
+ error_msg+="Check --kernel-config value or unset " |
52 |
+ error_msg+="to use default kernel config provided by genkernel." |
53 |
+ gen_die "${error_msg}" |
54 |
+ fi |
55 |
+ else |
56 |
+ for f in \ |
57 |
+ "/etc/kernels/kernel-config-${ARCH}-${KV}" \ |
58 |
+ "${GK_SHARE}/arch/${ARCH}/kernel-config-${KV}" \ |
59 |
+ "${GK_SHARE}/arch/${ARCH}/kernel-config-${VER}.${PAT}" \ |
60 |
+ "${GK_SHARE}/arch/${ARCH}/generated-config" \ |
61 |
+ "${GK_SHARE}/arch/${ARCH}/kernel-config" \ |
62 |
+ "${DEFAULT_KERNEL_CONFIG}" |
63 |
+ do |
64 |
+ [ -z "${f}" ] && continue |
65 |
+ |
66 |
+ if [ -f "${f}" ] |
67 |
then |
68 |
- print_info 2 "$(getIndent 1)- '${f}' is marked as broken; Skipping..." |
69 |
+ if grep -sq THIS_CONFIG_IS_BROKEN "$f" |
70 |
+ then |
71 |
+ print_info 2 "$(getIndent 1)- '${f}' is marked as broken; Skipping..." |
72 |
+ else |
73 |
+ KERNEL_CONFIG="$f" && break |
74 |
+ fi |
75 |
else |
76 |
- KERNEL_CONFIG="$f" && break |
77 |
+ print_info 2 "$(getIndent 1)- '${f}' not found; Skipping..." |
78 |
fi |
79 |
- else |
80 |
- print_info 2 "$(getIndent 1)- '${f}' not found; Skipping..." |
81 |
- fi |
82 |
- done |
83 |
+ done |
84 |
|
85 |
- if [ -z "${KERNEL_CONFIG}" ] |
86 |
- then |
87 |
- gen_die 'No kernel .config specified, or file not found!' |
88 |
+ if [ -z "${KERNEL_CONFIG}" ] |
89 |
+ then |
90 |
+ gen_die 'No kernel .config specified, or file not found!' |
91 |
+ fi |
92 |
fi |
93 |
|
94 |
KERNEL_CONFIG="$(readlink -f "${KERNEL_CONFIG}")" |
95 |
|
96 |
# Validate the symlink result if any |
97 |
- if [ ! -f "${KERNEL_CONFIG}" ] |
98 |
+ if [ -z "${KERNEL_CONFIG}" -o ! -f "${KERNEL_CONFIG}" ] |
99 |
then |
100 |
- gen_die "No kernel .config: symlinked file '$KERNEL_CONFIG' not found!" |
101 |
+ if [ -n "${CMD_KERNEL_CONFIG}" ] |
102 |
+ then |
103 |
+ error_msg="No kernel .config: File '${CMD_KERNEL_CONFIG}' not found! " |
104 |
+ error_msg+="Check --kernel-config value or unset " |
105 |
+ error_msg+="to use default kernel config provided by genkernel." |
106 |
+ gen_die "${error_msg}" |
107 |
+ else |
108 |
+ gen_die "No kernel .config: symlinked file '${KERNEL_CONFIG}' not found!" |
109 |
+ fi |
110 |
fi |
111 |
} |