diff options
Diffstat (limited to 'kern')
-rwxr-xr-x | kern | 25 |
1 files changed, 20 insertions, 5 deletions
@@ -21,6 +21,12 @@ is_boot_mounted() { mountpoint -q /boot } +mount_boot_on_demand() { + if has_boot_mount && ! is_boot_mounted; then + sudo mount /boot + fi +} + get_latest_kernel() { eselect --brief kernel list | tail -n1 } @@ -29,6 +35,17 @@ get_selected_kernel() { readlink /usr/src/linux } +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) @@ -59,7 +76,7 @@ config_kernel() { } diff_kernel() { - diff=${1:-/proc/config.gz} + diff=${1:-$(get_running_config)} nvim -d .config "$diff" } @@ -68,9 +85,7 @@ build_kernel() { } install_kernel() { - if has_boot_mount && ! is_boot_mounted; then - sudo mount /boot - fi + mount_boot_on_demand sudo make install modules_install } @@ -84,7 +99,7 @@ clean_kernel() { test_diff() { dt=$(mktemp) - zcat /proc/config.gz | sed -nE '/^(# )?CONFIG_.*/p' > "$dt" + sed -nE '/^(# )?CONFIG_.*/p' "$(get_running_config)" > "$dt" if ! sed -nE '/^(# )?CONFIG_.*/p' .config | diff -q "$dt" -; then diff_kernel printf "Continue? [y/N] " |