commit:     f6bf1e2ee59f836b0c9cfd64617dea29f89891ed
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  1 18:56:45 2020 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sat Aug  1 20:48:35 2020 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=f6bf1e2e

gen_determineargs.sh: determine_real_args(): Check if we can write into 
/etc/kernels when --save-config is set

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 gen_determineargs.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index 75dc151..d9056e4 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -891,6 +891,21 @@ determine_real_args() {
                                gen_die "--module-rebuild-cmd 
'${MODULEREBUILD_CMD}' contains at least one of the following disallowed 
characters: '\$&|>()'!"
                        fi
                fi
+
+               if isTrue "${SAVE_CONFIG}"
+               then
+                       local kconf_savedir=/etc/kernels
+                       if [ ! -d "${kconf_savedir}" ]
+                       then
+                               kconf_savedir=/etc
+                               [ ! -d "${kconf_savedir}" ] && kconf_savedir=/
+                       fi
+
+                       if [ ! -w "${kconf_savedir}" ]
+                       then
+                               gen_die "Cannot write to '${kconf_savedir}' but 
--save-config is set!"
+                       fi
+               fi
        fi
 
        if isTrue "${BUILD_RAMDISK}"

Reply via email to