Una bozza dello script è quì: https://www.linuxquestions.org/question ... 175628620/
copia in /usr/libexec/slackpkg/functions.d/zlookkernel.sh
e dai chmod +x /usr/libexec/slackpkg/functions.d/zlookkernel.sh
riporta bug e suggerimenti.
Codice: Seleziona tutto
lookkernel() {
NEWKERNELMD5=$(md5sum /boot/vmlinuz 2>/dev/null)
if [ "$KERNELMD5" != "$NEWKERNELMD5" ]; then
KERNEL=$(ls -l /boot/vmlinuz|rev|cut -f1 -d-|rev)
echo -e "\nYour kernel image was updated (found $KERNEL). You have to rebuild the bootloader.\nDo you want slackpkg to do it? (Y/n)"
answer
if [ "$ANSWER" != "n" ] && [ "$ANSWER" != "N" ]; then
INITRD=/boot/initrd.gz
if [ -e /boot/initrd-tree/command_line ];then
INITRD=$(cat /boot/initrd-tree/command_line|sed -r -e 's/^.* -o //' -e 's/ .*$//')
if [ -z "$INITRD" ];then
INITRD=/boot/initrd.gz
fi
if [ -e "$INITRD" ];then
echo -en "Found $INITRD; do you want to rebuild it with:\n "
cat /boot/initrd-tree/command_line|sed -r "s/-k [0-9\.]+ /-k $KERNEL /"
echo "Do you want continue? (Y/n)"
answer
if [ "$ANSWER" != "n" ] && [ "$ANSWER" != "N" ]; then
cat /boot/initrd-tree/command_line|sed -r "s/-k [0-9\.]+ /-k $KERNEL /"|sh
fi
fi
fi
if [ -x /sbin/lilo ]&&[ -e /etc/lilo.conf ]; then
echo -e "\nFound lilo. Do you want to run now: /sbin/lilo ? (Y/n)"
answer
if [ "$ANSWER" != "n" ] && [ "$ANSWER" != "N" ]; then
if ! /sbin/lilo -t ;then
echo "You need to fix your lilo configuration. Then press return to continue."
read
fi
/sbin/lilo -v
fi
elif [ -e /boot/efi/EFI/Slackware/elilo.conf ];then
echo -e "\nFound elilo. Copying files to EFI partition"
COPYDONE=""
for tocopy in vmlinuz vmlinuz-generic vmlinuz-huge `basename $INITRD`;do
if [ -e /boot/$tocopy ]&&[ -e /boot/efi/EFI/Slackware/$tocopy ]&&grep -E -q "= *$tocopy *$" /boot/efi/EFI/Slackware/elilo.conf ;then
echo "Do you want to copy $tocopy to EFI partition? (Y/n)"
answer
if [ "$ANSWER" != "n" ] && [ "$ANSWER" != "N" ]; then
cp /boot/$tocopy /boot/efi/EFI/Slackware/$tocopy && COPYDONE="$COPYDONE $tocopy"
touch -r /boot/$tocopy /boot/efi/EFI/Slackware/$tocopy
fi
fi
done
if [ -z "$COPYDONE" ];then
echo -e "\nWARNING! no files to copy found. You have to fix bootloader yourself\n"
fi
elif [ -e /boot/grub ]&&[ -x /usr/sbin/grub-install ];then
echo -e "\nWARNING! Grub found but not supported by slackpkg. You have to fix it yourself\n"
else
echo -e "\nWARNING! slackpkg can't found your bootloader configuration. You have to fix it yourself\n"
fi
fi
fi
}