From 7fad1f76aaac2c4b67a475027221ee64736d6b42 Mon Sep 17 00:00:00 2001 From: Wynn Wolf Arbor Date: Thu, 4 Jun 2020 15:35:48 +0200 Subject: Move sed invocation into its own function In test_diff() we are duplicating the sed invocation that strips config files of anything irrelevant. Move that part of the functionality into its own function. --- kern | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kern b/kern index 040d150..cdd2d8d 100755 --- a/kern +++ b/kern @@ -102,10 +102,15 @@ clean_kernel() { sudo eclean-kernel -An3 } +strip_config() { + sed -nE '/^(# )?CONFIG_.*/p' "$1" +} + test_diff() { dt=$(mktemp) - sed -nE '/^(# )?CONFIG_.*/p' "$(get_running_config)" > "$dt" - if ! sed -nE '/^(# )?CONFIG_.*/p' .config | diff -q "$dt" -; then + strip_config "$(get_running_config)" > "$dt" + + if ! strip_config .config | diff -q "$dt" -; then diff_kernel || true printf "Continue? [y/N] " read -r response -- cgit v1.2.3-2-gb3c3