gentooup.sh: only handle kernel is one is installed

This prevents installing gentoo sources on machines that use prebuilt
kernels
This commit is contained in:
layman 2019-06-24 10:31:46 +02:00
parent b33501dd7f
commit b53a5a1751

View file

@ -117,16 +117,18 @@ fi
echo "***************** remove unneeded packages *******************" echo "***************** remove unneeded packages *******************"
echo Started at "$STARTDATE" echo Started at "$STARTDATE"
#make sure that current kernel sources are kept: if [[ $(qlist -I gentoo-sources) != "" ]] ; then
CURRENTKERNELVERSION="$(uname -r)" #make sure that current kernel sources are kept:
echo current installed kernel:"${CURRENTKERNELVERSION/"-gentoo"/}" CURRENTKERNELVERSION="$(uname -r)"
emerge --noreplace gentoo-sources:"${CURRENTKERNELVERSION/"-gentoo"/}" echo current running kernel:"${CURRENTKERNELVERSION/"-gentoo"/}"
emerge -a "${PORTAGE_OPTIONS[@]}" --depclean emerge --noreplace gentoo-sources:"${CURRENTKERNELVERSION/"-gentoo"/}"
if [[ "$(grep -c gentoo-sources /var/lib/portage/world)" -gt 2 ]] ; then emerge -a "${PORTAGE_OPTIONS[@]}" --depclean
echo too many kernelversion in world file! if [[ "$(grep -c gentoo-sources /var/lib/portage/world)" -gt 2 ]] ; then
grep gentoo-source /var/lib/portage/world echo too many kernelversion in world file!
grep gentoo-source /var/lib/portage/world
fi
emerge "${PORTAGE_OPTIONS[@]}" --deselect gentoo-sources:"${CURRENTKERNELVERSION/"-gentoo"/}"
fi fi
emerge "${PORTAGE_OPTIONS[@]}" --deselect gentoo-sources:"${CURRENTKERNELVERSION/"-gentoo"/}"
if [[ -n "$(which restart_services)" ]] ; then if [[ -n "$(which restart_services)" ]] ; then
restart_services -l restart_services -l