#!/usr/bin/env bash if [ ! -f /usr/src/linux/.config ] && [ -f /proc/config.gz ] ; then echo "**************** building kernel ***********" LWD="$PWD" TIMESTAMP=$(date +%F-%H_%M_%S) cd /usr/src/linux || exit 1 zcat /proc/config.gz > .config make olddefconfig mount /boot (make -j5 CC="ccache gcc" && make install && make modules_install && make firmware_install) > "buildlog-$TIMESTAMP" || tail -n 20 "buildlog-$TIMESTAMP" GRUBMKONFIG="$(which grub2-mkconfig)" if [[ -z "$GRUBMKONFIG" ]] ; then GRUBMKONFIG="$(which grub-mkconfig)" fi if [[ -f /boot/grub2/grub.cfg && -n "$GRUBMKONFIG" ]] ; then "$GRUBMKONFIG" -o /boot/grub2/grub.cfg elif [[ -f /boot/grub/grub.cfg && -n "$GRUBMKONFIG" ]] ; then "$GRUBMKONFIG" -o /boot/grub/grub.cfg else echo "please update bootloader manually!" fi cd "${LWD}" || exit 1 fi