#!/bin/sh # # by root@scourge # installs System.map-${KVERSION} into unmounted and mounted /boot # and vmlinuz-${KVERSION} into mounted /boot # # for use with gentoo or any other linux which uses /boot partitions and grub. # # NOTE: this does NOT run lilo!! # it is not compatible with the debian-style installkernel.sh # which is called by "make install" during/after linux kernel build. REBUILDMODS="nvidia-kernel kqemu arpstar ndiswrapper" REBUILDTOOLS="dbus iptables module-init-tools svgalib udev" KVERSION=$(/bin/pwd | cut -d "-" -f 2-) B_WASMNTED=0 if $(grep boot /etc/mtab > /dev/null) ; then echo "unmounting /boot" umount /boot B_WASMNTED=1 fi echo "copying stuff" cp -i $PWD/System.map /boot/System.map-${KVERSION} > /dev/null echo "mounting /boot" mount /boot echo "copying stuff" cp -i $PWD/System.map /boot/System.map-${KVERSION} > /dev/null cp -i $PWD/arch/i386/boot/bzImage /boot/vmlinuz-${KVERSION} > /dev/null while : ; do echo -n "Edit /boot/grub/grub.conf? " read i case $i in y|Y) ${EDITOR} /boot/grub/grub.conf break;; n|N) break;; esac done if [ ${B_WASMNTED} = 0 ] ; then echo "unmouning /boot again" umount /boot fi echo -n "Adjust /usr/src/linux symlink? " read i case $i in y|Y) cd /usr/src [ -e linux ] && rm linux ln -s linux-${KVERSION} linux cd linux ;; n|N) echo "No further action possible without a new symlink. Exiting." exit 0 ;; esac ### ask questions first, build stuff later: TO_EMERGE="" echo -n "Rebuild the pwc module? " read i case $i in y|Y) PWC_KVERSION=$(grep PWC_VERSION /usr/src/linux-${KVERSION}/drivers/usb/media/pwc/pwc.h | awk '{print $3}' | awk '{FS="-"}{print $1}' | tr -d '"' | awk -F- '{print $1}') PWC_PVERSION=$(emerge --nocolor -pv media-video/usb-pwc-re | grep ebuild | awk '{print $4}' | awk -F- '{print $NF}' ) if [ $PWC_KVERSION > $PWC_PVERSION ]; then echo "Version in kernel is newer than the one in portage.\nNot emerging." else TO_EMERGE="${TO_EMERGE} pwc" fi ;; esac for mod in ${REBUILDMODS}; do echo -n "rebuild the $mod module? " read i case $i in y|Y) TO_EMERGE="${TO_EMERGE} ${mod}" ;; esac done echo -n "Recompile Programs known to break sometimes (${REBUILDTOOLS})? " read i case $i in y|Y) for t in ${REBUILDTOOLS}; do echo -n"emerge ${t}? " read i case $i in y|Y) TO_EMERGE="${TO_EMERGE} ${it}" ;; esac done ;; esac ## now build the good stuff: if [[ -n "$TO_EMERGE" ]]; then emerge $TO_EMERGE || echo -e "You wanted these ebuild built, but something went wrong:\n $TO_EMERGE" fi echo "end." # set vi:ts=4