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 Started at "$STARTDATE"
#make sure that current kernel sources are kept:
CURRENTKERNELVERSION="$(uname -r)"
echo current installed kernel:"${CURRENTKERNELVERSION/"-gentoo"/}"
emerge --noreplace gentoo-sources:"${CURRENTKERNELVERSION/"-gentoo"/}"
emerge -a "${PORTAGE_OPTIONS[@]}" --depclean
if [[ "$(grep -c gentoo-sources /var/lib/portage/world)" -gt 2 ]] ; then
echo too many kernelversion in world file!
grep gentoo-source /var/lib/portage/world
if [[ $(qlist -I gentoo-sources) != "" ]] ; then
#make sure that current kernel sources are kept:
CURRENTKERNELVERSION="$(uname -r)"
echo current running kernel:"${CURRENTKERNELVERSION/"-gentoo"/}"
emerge --noreplace gentoo-sources:"${CURRENTKERNELVERSION/"-gentoo"/}"
emerge -a "${PORTAGE_OPTIONS[@]}" --depclean
if [[ "$(grep -c gentoo-sources /var/lib/portage/world)" -gt 2 ]] ; then
echo too many kernelversion in world file!
grep gentoo-source /var/lib/portage/world
fi
emerge "${PORTAGE_OPTIONS[@]}" --deselect gentoo-sources:"${CURRENTKERNELVERSION/"-gentoo"/}"
fi
emerge "${PORTAGE_OPTIONS[@]}" --deselect gentoo-sources:"${CURRENTKERNELVERSION/"-gentoo"/}"
if [[ -n "$(which restart_services)" ]] ; then
restart_services -l