mirror of
https://gitea.blesmrt.net/mikaela/scripts.git
synced 2024-11-26 04:59:38 +01:00
bash: initial commit of fix-kernel-install.bash as a friend to fixgrub.bash
Yes, this is a horrible hack that looks horrible.
This commit is contained in:
parent
a68d08c515
commit
1057879d5e
@ -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
|
||||
|
30
bash/fix-kernel-install.bash
Executable file
30
bash/fix-kernel-install.bash
Executable file
@ -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/<machine-id> 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
|
Loading…
Reference in New Issue
Block a user