#!/bin/bash # # Copyright 2006-2007 David Shakaryan # Distributed under the terms of the GNU General Public License v2 # Define packages to install after installing new kernel. PACKAGES="x11-drivers/nvidia-drivers" # Determine new kernel directory. NEW="$(ls -d /usr/src/linux-*-gentoo* | tail -n 1)" NEW="${NEW/\/usr\/src\/}" # Determine old kernel directory and arch. OLD="linux-$(uname -r)" ARCH="$(uname -m)" # Point /usr/src/linux symbolic link to new kernel directory. cd /usr/src ln -sfn ${NEW} linux # Copy old kernel configuration to new kernel directory. cd linux cp /usr/src/${OLD}/.config ./ # Adapt old configuration and compile new kernel. make oldconfig make make modules_install # Backup old kernel/configuration, then copy over new ones. mv /boot/kernel /boot/kernel.old mv /boot/config /boot/config.old cp arch/${ARCH}/boot/bzImage /boot/kernel cp .config /boot/config # Remerge packages defined at top of script. if [[ ${PACKAGES} ]]; then paludis -i --add-to-world-atom '( )' ${PACKAGES} fi