Import kernel compile logic

This commit is contained in:
Albert Hopkins 2012-01-09 21:17:42 +00:00
parent 8136ac8973
commit 976caffd93
1 changed files with 9 additions and 1 deletions

View File

@ -2,9 +2,17 @@ set -ev
# (possibly) build the kernel
current_kernel=""
if [ -d "/var/db/pkg/sys-kernel" ]
then
cd "/var/db/pkg/sys-kernel"
current_kernel=`/bin/ls -d1 "${KERNEL}-"* | tail -n 1|sed s/"${KERNEL}-//;s/-r[1-9]\+$//"`
fi
# If there is already a kernel in /boot and emerging the kernel only
# re-installs the same package, we can skip this
if [ -e /boot/vmlinuz ] && emerge -pq sys-kernel/${KERNEL}|grep '^\[.*R.*\]' >/dev/null
if [ -n "$current_kernel" ] && [ -e /boot/vmlinuz ] && \
readlink /boot/vmlinuz | grep $current_kernel > /dev/null
then
exit
fi