diff gk.sh @ 160:c35d56590441

add the two helper scripts for gentoo that are requied on all hosts
author Dirk Olmes <dirk@xanthippe.ping.de>
date Mon, 23 Dec 2019 11:41:35 +0100
parents
children e5f67219ad24
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gk.sh	Mon Dec 23 11:41:35 2019 +0100
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+if [ `whoami` != "root" ]; then
+    echo "must be root"
+    exit 1
+fi
+
+# for xconfig
+export DISPLAY=localhost:0.0
+
+# make sure gk.sh always uses the same ccache cache
+export CCACHE_DIR=/var/tmp/ccache
+
+# use CCACHE when compiling the kernel
+COMPILER=/usr/lib/ccache/bin/gcc
+
+# source make.conf for MAKEOPTS
+GK_OPTS=""
+
+if [ -f /etc/make.conf ]; then
+    . /etc/make.conf
+elif [ -f /etc/portage/make.conf ]; then
+    . /etc/portage/make.conf
+else
+    echo "cannot find make.conf"
+    exit 1
+fi
+
+if [ "$MAKEOPTS" != "" ]; then
+    GK_OPTS="--makeopts=$MAKEOPTS "
+fi
+
+if [ -d /etc/kernels ]; then
+    kernel=`ls -rt /etc/kernels | tail -n 1`
+    if [ $kernel != "" ]; then
+        GK_OPTS="$GK_OPTS --kernel-config=/etc/kernels/$kernel"
+    fi
+fi
+
+genkernel $* \
+    --install \
+    --no-color \
+    --kernel-cc=$COMPILER \
+    --utils-cc=$COMPILER \
+    $GK_OPTS \
+    all
+
+# TODO check --bootloader
+# update the bootloader
+#grub-mkconfig -o /boot/grub/grub.cfg