#!/bin/bash

. /etc/profile

# kernel config
time USE=symlink emerge gentoo-sources
pushd .

cd /tmp/gen2 || exit 1
[ -e "clients/${CLIENT}/${KERNEL}" ] || exit 1
[ -e "/usr/src/linux/" ] || exit 1

cp "clients/${CLIENT}/${KERNEL}" /usr/src/linux/
cp "clients/${CLIENT}/${KERNEL}" /usr/src/linux/.config

bash scripts/update_kernel.sh

# apply the grub
[ -d /boot/grub ] || mkdir /boot/grub
grub-mkconfig -o /boot/grub/grub.cfg

popd

