aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWynn Wolf Arbor2020-06-04 15:35:48 +0200
committerWynn Wolf Arbor2020-06-04 16:01:30 +0200
commit7fad1f76aaac2c4b67a475027221ee64736d6b42 (patch)
tree0e05f025399ac48ecf3d79e599b8c4e7bafda5ba
parent74e9da1ae9dcee56112cb36b610856fe3620e6fc (diff)
downloadkern-7fad1f76aaac2c4b67a475027221ee64736d6b42.tar.gz
Move sed invocation into its own function0.4.0
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.
-rwxr-xr-xkern9
1 files 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