diff --git a/bash/deb-update.bash b/bash/deb-update.bash index 39e89db..bd71203 100755 --- a/bash/deb-update.bash +++ b/bash/deb-update.bash @@ -118,5 +118,11 @@ if [ -f /root/fixgrub.bash ]; then /root/fixgrub.bash fi +# Lumina & Sedric have been having kernel update issues, let's see if this +# script could detect and suggest action for that. +if [ -f /root/fix-kernel-install.bash ]; then + /root/fix-kernel-install.bash +fi + # Hide commands being executed again set +x diff --git a/bash/fix-kernel-install.bash b/bash/fix-kernel-install.bash new file mode 100755 index 0000000..ca0c421 --- /dev/null +++ b/bash/fix-kernel-install.bash @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +#set -x + +export LC_ALL=C.utf8 + +# Check for existence of /etc/machine-id/ +if [ -f /etc/machine-id ]; then + + # Check for existence of the /boot/ directory + if [ -d /boot/efi/"$(cat /etc/machine-id)" ]; then + + # Store the latest installed kernel to $EXPECTEDKERNEL + EXPECTEDKERNEL="$(find /lib/modules -maxdepth 1 -printf '%P\n' | sort | tail -n -1)" + + # And actual kernel in the boot/efi directory + ACTUALKERNEL="$(find /boot/efi/"$(cat /etc/machine-id)"/ -maxdepth 1 -printf '%P\n' | sort | tail -n -1)" + + # Are they the same? Everything OK! + if [ "$EXPECTEDKERNEL" == "$ACTUALKERNEL" ]; then + echo "The kernel situation seems OK." + + else + printf "\nWARNING! Kernels mismatch! Suggested action:\n" + printf "\tsudo kernel-install add %b /lib/modules/%b/vmlinuz\n" "$EXPECTEDKERNEL" "$EXPECTEDKERNEL" + fi + fi +fi + +#set +x