aboutsummaryrefslogtreecommitdiffstats
path: root/kern
diff options
context:
space:
mode:
Diffstat (limited to 'kern')
-rwxr-xr-xkern19
1 files changed, 10 insertions, 9 deletions
diff --git a/kern b/kern
index 0f19772..f24b573 100755
--- a/kern
+++ b/kern
@@ -4,6 +4,14 @@ set -e
KERNFRAG=${KERNFRAG:-/etc/kernfrag}
+RUNNING_CONFIG=$(mktemp --suffix=-kern-config)
+zcat /proc/config.gz > "$RUNNING_CONFIG"
+
+# We do want to expand tmpdir now rather than later,
+# and mktemp should give us a path without spaces.
+# shellcheck disable=SC2064
+trap "{ rm $RUNNING_CONFIG; }" EXIT
+
err() {
printf "kern: %s\n" "$@" >&2
}
@@ -43,13 +51,6 @@ get_running_kernel() {
uname -r
}
-get_running_config() {
- mount_boot_on_demand
- config=/boot/config-$(get_running_kernel)
- test -r "$config" || errx "Could not read configuration file: $config"
- echo "$config"
-}
-
set_kernel() {
kern=${1:-$(get_latest_kernel)}
selected=$(get_selected_kernel)
@@ -82,7 +83,7 @@ config_kernel() {
diff_kernel() {
need_kernel_source
- diff=${1:-$(get_running_config)}
+ diff=${1:-$RUNNING_CONFIG}
if command -v git >/dev/null; then
git diff --no-index "$diff" .config
@@ -116,7 +117,7 @@ strip_config() {
test_diff() {
dt=$(mktemp)
- strip_config "$(get_running_config)" > "$dt"
+ strip_config "$RUNNING_CONFIG" > "$dt"
if ! strip_config .config | diff -q "$dt" -; then
diff_kernel || true