Force kernel-rebuild after toolchain rebuild.

This commit is contained in:
Kolan Sh 2012-12-18 17:20:45 +04:00
parent d48cd2705d
commit c29ce06a67
2 changed files with 35 additions and 3 deletions

View File

@ -208,6 +208,7 @@ if [ $STAGE_CNT -eq $STAGE ]; then
new_gcc_ver=`emerge -uNp sys-devel/gcc | grep '^\[' | sed 's~.*/gcc-~~ ; s~\ .*~~'`
if [[ "" != "$new_gcc_ver" && "`echo $cur_gcc_ver | sed 's~\([0-9]*\.[0-9]*\).*~\1~'`" != "`echo $new_gcc_ver | sed 's~\([0-9]*\.[0-9]*\).*~\1~'`" ]]; then
touch /etc/portage/need_toolchain_rebuild
touch /etc/portage/need_kernel_rebuild
else
if [ "`echo $cur_gcc_ver | sed 's~[0-9]*\.[0-9]*\.\([0-9]*\).*~\1~'`" != "`echo $cur_gcc_ver | sed 's~[0-9]*\.[0-9]*\.\([0-9]*\).*~\1~'`" ]; then
touch /etc/portage/need_libtool_rebuild
@ -469,8 +470,16 @@ let STAGE_CNT++
# Upgrade kernel
if [ $STAGE_CNT -eq $STAGE ]; then
echo "======= STAGE $STAGE: Upgrade kernel ======="
if [ -f /etc/portage/need_kernel_rebuild ]; then
kernel-getlast.sh --force-rebuild
[ 0 -ne $? ] && echo "Stage $STAGE: kernel-getlast.sh --force-rebuild failed ;-( =======" && exit $STAGE
rm /etc/portage/need_kernel_rebuild
[ 0 -ne $? ] && echo "Stage $STAGE: cann't remove /etc/portage/need_kernel_rebuild ;-( =======" && exit $STAGE
else
kernel-getlast.sh
[ 0 -ne $? ] && echo "Stage $STAGE: kernel-getlast.sh failed ;-( =======" && exit $STAGE
fi
let STAGE++
fi

View File

@ -1,5 +1,28 @@
#!/bin/bash
let FORCE_REBUILD=0
# available parameters
eval set -- "`getopt -o h --long help,force-rebuild -- \"$@\"`"
while true ; do
case "$1" in
-h|--help)
echo "Usage: kernel-getlast.sh [keys]..."
echo "Keys:"
echo -e "-h, --help\t\t\tShow this help and exit."
echo -e "--force-rebuild\t\t\tForce to rebuild kernel even if no new versions found."
echo
echo -e "This program works on any GNU/Linux with GNU Baurne's shell"
echo -e "Report bugs to <mecareful@gmail.com>"
exit 0
;;
--force-rebuild) let FORCE_REBUILD=1 ; shift 1 ;;
--) shift ; break ;;
*) echo "Internal error!" ; exit -1 ;;
esac
done
kernel_regex=`kernel-config list | grep \* | cut -d" " -f6 | sed 's~[0-9]*\.[0-9]*\.[0-9]*~[0-9]*\.[0-9]*\.[0-9]*~ ; s~-r[0-9]*$~~; s~$~\\\(-r[0-9]\\\)\\\?~'`
[ "" == "$kernel_regex" ] && echo "kernel_regex build failed ;-(" && exit -1
@ -24,7 +47,7 @@ kernel-clean.sh
vmlinuz_file=/boot/`echo $new_kernel | sed 's~^linux~vmlinuz~'`
[ "" == "$vmlinuz_file" ] && echo "vmlinuz_file == \"\"" && exit -1
if [ ! -f "$vmlinuz_file" ]; then
if [[ ! -f "$vmlinuz_file" || 1 -eq $FORCE_REBUILD ]]; then
kernel-rebuild.sh
[ 0 -ne $? ] && echo "kernel-rebuild.sh failed" && exit -1
fi