. $config
. kernel/kernel-version
askyes "install-kernel" "Install own kernel packages"

# install of kernel needs a fstab (even if empty)
touch $newtree/etc/fstab

# install new kernel
dpkg --root $newtree -i $archive/kernel-image-$VERSION$REV*.deb
dpkg --root $newtree -i $archive/modules-image-$VERSION$REV*.deb || true
dpkg --root $newtree -i $archive/cloop-$VERSION$REV*.deb

# try to remove orig kernel
kern="cloop-module loop-aes cloop-$ORIGVERSION$ORIGREV linux-wlan-ng-modules-$ORIGVERSION$ORIGREV modules-image-$ORIGVERSION$ORIGREV kernel-image-$ORIGVERSION$ORIGREV"
for pkg in $kern; do
  dpkg --root $newtree -P $pkg || true
done

rm $newtree/boot/{vmlinuz,System.map} || true
cd $newtree/boot
ln -s vmlinuz-$VERSION$REV vmlinuz
ln -s System.map-$VERSION$REV System.map
