kernel-getlast: genkernel support.
This commit is contained in:
parent
072efc726f
commit
e7449d103f
@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
let FORCE_REBUILD=0
|
let FORCE_REBUILD=0
|
||||||
KERNEL_REBUILD_ARGS=""
|
KERNEL_REBUILD_ARGS=""
|
||||||
|
GENKERNEL_ARGS="--no-clean --no-mrproper"
|
||||||
|
|
||||||
[ -f /etc/gentoo-upgrade.conf ] && source /etc/gentoo-upgrade.conf
|
[ -f /etc/gentoo-upgrade.conf ] && source /etc/gentoo-upgrade.conf
|
||||||
|
|
||||||
# available parameters
|
# available parameters
|
||||||
eval set -- "`getopt -o h,q --long help,force-rebuild,mrproper,quiet -- \"$@\"`"
|
eval set -- "`getopt -o h,q,g: --long help,force-rebuild,mrproper,quiet,genkernel-args: -- \"$@\"`"
|
||||||
|
|
||||||
while true ; do
|
while true ; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -15,6 +16,7 @@ while true ; do
|
|||||||
echo "Keys:"
|
echo "Keys:"
|
||||||
echo -e "-h, --help\t\t\tShow this help and exit."
|
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 -e "--force-rebuild\t\t\tForce to rebuild kernel even if no new versions found."
|
||||||
|
echo -e "-g,--genkernel-args\t\tPass arguments to genkernel."
|
||||||
echo -e "--mrproper\t\t\tClean kernel sources before rebuild."
|
echo -e "--mrproper\t\t\tClean kernel sources before rebuild."
|
||||||
echo -e "-q, --quiet\t\t\tMake kernel configuration non-interactive."
|
echo -e "-q, --quiet\t\t\tMake kernel configuration non-interactive."
|
||||||
echo
|
echo
|
||||||
@ -23,8 +25,9 @@ while true ; do
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
--force-rebuild) let FORCE_REBUILD=1 ; shift ;;
|
--force-rebuild) let FORCE_REBUILD=1 ; shift ;;
|
||||||
--mrproper) KERNEL_REBUILD_ARGS="$KERNEL_REBUILD_ARGS --mrproper" ; shift ;;
|
-g|--genkernel-args) GENKERNEL_ARGS="$GENKERNEL_ARGS $2" ; shift ;;
|
||||||
-q|--quiet) KERNEL_REBUILD_ARGS="$KERNEL_REBUILD_ARGS --silent" ; shift ;;
|
--mrproper) KERNEL_REBUILD_ARGS="$KERNEL_REBUILD_ARGS --mrproper" ; shift 2 ;;
|
||||||
|
-q|--quiet) KERNEL_REBUILD_ARGS="$KERNEL_REBUILD_ARGS --silent" ; shift 2 ;;
|
||||||
--) shift ; break ;;
|
--) shift ; break ;;
|
||||||
*) echo "Internal error!" ; exit -1 ;;
|
*) echo "Internal error!" ; exit -1 ;;
|
||||||
esac
|
esac
|
||||||
@ -54,20 +57,25 @@ kernel-clean.sh
|
|||||||
vmlinuz_file=/boot/`echo $new_kernel | sed 's~^linux~vmlinuz~'`
|
vmlinuz_file=/boot/`echo $new_kernel | sed 's~^linux~vmlinuz~'`
|
||||||
[ "" == "$vmlinuz_file" ] && echo "vmlinuz_file == \"\"" && exit -1
|
[ "" == "$vmlinuz_file" ] && echo "vmlinuz_file == \"\"" && exit -1
|
||||||
|
|
||||||
|
# genkernel or kernel-rebuild ?
|
||||||
|
if [ `which genkernel 2>/dev/null` ]; then
|
||||||
|
genkernel $GENKERNEL_ARGS all
|
||||||
|
[ 0 -ne $? ] && echo "genkernel $GENKERNEL_ARGS all failed ;-( =======" && exit -1
|
||||||
|
|
||||||
if [[ ! -f "$vmlinuz_file" || 1 -eq $FORCE_REBUILD ]]; then
|
else # using kernel-rebuild
|
||||||
kernel-rebuild.sh $KERNEL_REBUILD_ARGS
|
if [[ ! -f "$vmlinuz_file" || 1 -eq $FORCE_REBUILD ]]; then
|
||||||
[ 0 -ne $? ] && echo "kernel-rebuild.sh $KERNEL_REBUILD_ARGS failed" && exit -1
|
kernel-rebuild.sh $KERNEL_REBUILD_ARGS
|
||||||
fi
|
[ 0 -ne $? ] && echo "kernel-rebuild.sh $KERNEL_REBUILD_ARGS failed" && exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
# remounting file systems rw->ro
|
# remounting file systems rw->ro
|
||||||
for fs in $RO_REMOUNT; do
|
for fs in $RO_REMOUNT; do
|
||||||
if [[ "$fs" =~ ^/+usr/*$ || "$fs" =~ ^/+boot/*$ ]]; then
|
if [[ "$fs" =~ ^/+usr/*$ || "$fs" =~ ^/+boot/*$ ]]; then
|
||||||
echo "remounting $fs -> ro"
|
echo "remounting $fs -> ro"
|
||||||
mount -o remount,ro $fs
|
mount -o remount,ro $fs
|
||||||
[ 0 -ne $? ] && echo "mount -o remount,ro $fs failed ;-( =======" && exit -1
|
[ 0 -ne $? ] && echo "mount -o remount,ro $fs failed ;-( =======" && exit -1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user