From 1f9af7822e7c606f549792f834b6ea970b9a3ab6 2018-12-04 17:28:26 From: Unknown Date: 2018-12-04 17:28:26 Subject: [PATCH] - cleanup of exports - easy functions for setting and unsetting kernel params --- diff --git a/functions.sh b/functions.sh index 74ca846..bc10b49 100644 --- a/functions.sh +++ b/functions.sh @@ -3,6 +3,17 @@ cleanup (){ set +x set +e + + # Remove exports from nexmon + unset KERNEL + unset ARCH + unset SUBARCH + unset CCPLUGIN + unset ZLIBFLATE + unset Q + unset NEXMON_SETUP_ENV + unset HOSTUNAME + unset PLATFORMUNAME # Identify and kill all processes still using files echo "killing processes using mount point ..." @@ -75,3 +86,20 @@ chroot_remove_cc() { COMPILER_PACKAGES="" fi } +# GPL v2.0 - #https://github.com/sakaki-/bcmrpi3-kernel-bis/blob/master/conform_config.sh +set_kernel_config() { + # flag as $1, value to set as $2, config must exist at "./.config" + TGT="CONFIG_${1#CONFIG_}" + REP="${2}" + if grep -q "^${TGT}[^_]" .config; then + sed -i "s/^\(${TGT}=.*\|# ${TGT} is not set\)/${TGT}=${REP}/" .config + else + echo "${TGT}"="${2}" >> .config + fi +} +# unset kernel config parameter +unset_kernel_config() { + # unsets flag with the value of $1, config must exist at "./.config" + TGT="CONFIG_${1#CONFIG_}" + sed -i "s/^${TGT}=.*/# ${TGT} is not set/" .config +} \ No newline at end of file