@ -25,7 +25,8 @@ _distro_prompt() {
echo " 2) Fedora"
echo " 3) Suse"
echo " 4) Ubuntu"
read -p "[1-4]: " _distro_index
echo " 5) Generic"
read -p "[1-5]: " _distro_index
if [ " $_distro_index " = "1" ] ; then
_distro = "Debian"
@ -39,6 +40,9 @@ _distro_prompt() {
elif [ " $_distro_index " = "4" ] ; then
_distro = "Ubuntu"
break
elif [ " $_distro_index " = "5" ] ; then
_distro = "Generic"
break
else
echo "Wrong index."
fi
@ -181,8 +185,11 @@ if [ "$1" != "install" ] && [ "$1" != "config" ] && [ "$1" != "uninstall-help" ]
msg2 " Argument not recognised, options are:
- config : interactive script that shallow clones the linux 5.x.y git tree into the folder linux-src-git, then applies extra patches and prepares the .config file
by copying the one from the currently running linux system and updates it.
- install : [ for RPM and DEB based distros only] , does the config step, proceeds to compile, then prompts to install
- uninstall-help : [ for RPM and DEB based distros only] , lists the installed kernels in this system, then gives hints on how to uninstall them manually."
- install : does the config step, proceeds to compile, then prompts to install
- 'DEB' distros: it creates .deb packages that will be installed then stored in the DEBS folder.
- 'RPM' distros: it creates .rpm packages that will be installed then stored in the RPMS folder.
- 'Generic' distro: it uses 'make modules_install' and 'make install' , uses 'dracut' to create an initramfs, then updates grub' s boot entry.
- uninstall-help : [ RPM and DEB based distros only] , lists the installed kernels in this system, then gives hints on how to uninstall them manually."
exit 0
fi
@ -205,7 +212,7 @@ if [ "$1" = "install" ] || [ "$1" = "config" ]; then
# Run init script that is also run in PKGBUILD, it will define some env vars that we will use
_tkg_initscript
if [ [ $1 = "install" && ! " $_distro " = ~ ^( Ubuntu| Debian| Fedora| Suse) $ ] ] ; then
if [ [ $1 = "install" && ! " $_distro " = ~ ^( Ubuntu| Debian| Fedora| Suse| Generic) $ ] ] ; then
msg2 "Variable \"_distro\" in \"customization.cfg\" hasn't been set to \"Ubuntu\", \"Debian\", \"Fedora\" or \"Suse\""
msg2 "This script can only install custom kernels for RPM and DEB based distros, though only those keywords are permitted. Exiting..."
exit 0
@ -303,17 +310,11 @@ if [ "$1" = "install" ]; then
# ccache
if [ " $_noccache " != "true" ] ; then
# Todo: deal with generic and paths, maybe just export boths possibilities and not care
if [ [ " $_distro " = ~ ^( Ubuntu| Debian) $ ] ] ; then
export PATH = " /usr/lib/ccache/bin/: $PATH "
elif [ [ " $_distro " = ~ ^( Fedora| Suse) $ ] ] ; then
export PATH = " /usr/lib64/ccache/: $PATH "
fi
export PATH = " /usr/lib64/ccache/:/usr/lib/ccache/bin/: $PATH "
export CCACHE_SLOPPINESS = "file_macro,locale,time_macros"
export CCACHE_NOHASHDIR = "true"
msg2 'Enabled ccache'
fi
if [ -z $_kernel_localversion ] ; then
@ -404,6 +405,36 @@ if [ "$1" = "install" ]; then
msg2 "Install successful"
fi
fi
elif [ " $_distro " = "Generic" ] ; then
./scripts/config --set-str LOCALVERSION " - ${ _kernel_flavor } "
if make ${ llvm_opt } -j ${ _thread_num } ; then
if [ [ " $_sub " = rc* ] ] ; then
_kernelname = $_basekernel .${ _kernel_subver } -${ _sub } -$_kernel_flavor
else
_kernelname = $_basekernel .${ _kernel_subver } -$_kernel_flavor
fi
msg2 "Building successful"
msg2 "The installation process will run the following commands:"
msg2 " sudo make modules_install"
msg2 " sudo make install"
msg2 " sudo dracut --hostonly --kver $_kernelname "
msg2 " sudo grub-mkconfig -o /boot/grub/grub.cfg"
read -p "Continue ? [Y/n]: " _continue
if ! [ [ $_continue = ~ ^( Y| y| Yes| yes) $ ] ] ; then
exit 0
fi
sudo make modules_install
sudo make install
sudo dracut --hostonly --kver $_kernelname
sudo grub-mkconfig -o /boot/grub/grub.cfg
fi
fi
fi
@ -414,9 +445,9 @@ if [ "$1" = "uninstall-help" ]; then
fi
cd " $_where "
msg2 "List of installed custom tkg kernels: "
if [ " $_distro " = "Ubuntu" ] ; then
msg2 "List of installed custom tkg kernels: "
dpkg -l "*tkg*" | grep "linux.*tkg"
dpkg -l "*linux-libc-dev*" | grep "linux.*tkg"
msg2 "To uninstall a version, you should remove the linux-image, linux-headers and linux-libc-dev associated to it (if installed), with: "
@ -424,17 +455,28 @@ if [ "$1" = "uninstall-help" ]; then
msg2 " where VERSION is displayed in the lists above, uninstall only versions that have \"tkg\" in its name"
msg2 "Note: linux-libc-dev packages are no longer created and installed, you can safely remove any remnants."
elif [ " $_distro " = "Fedora" ] ; then
msg2 "List of installed custom tkg kernels: "
dnf list --installed kernel*
msg2 "To uninstall a version, you should remove the kernel, kernel-headers and kernel-devel associated to it (if installed), with: "
msg2 " sudo dnf remove --noautoremove kernel-VERSION kernel-devel-VERSION kernel-headers-VERSION"
msg2 " where VERSION is displayed in the second column"
msg2 "Note: kernel-headers packages are no longer created and installed, you can safely remove any remnants."
elif [ " $_distro " = "Suse" ] ; then
msg2 "List of installed custom tkg kernels: "
zypper packages --installed-only | grep "kernel.*tkg"
msg2 "To uninstall a version, you should remove the kernel, kernel-headers and kernel-devel associated to it (if installed), with: "
msg2 " sudo zypper remove --no-clean-deps kernel-VERSION kernel-devel-VERSION kernel-headers-VERSION"
msg2 " where VERSION is displayed in the second to last column"
msg2 "Note: kernel-headers packages are no longer created and installed, you can safely remove any remnants."
elif [ " $_distro " = "Generic" ] ; then
msg2 "Folders in /lib/modules :"
ls /lib/modules
msg2 "Files in /boot :"
ls /boot
msg2 "To uninstall a kernel version installed through install.sh with 'Generic' as a distro:"
msg2 " - Remove manually the corresponding folder in '/lib/modules'"
msg2 " - Remove manually the corresponding 'System.map', 'vmlinuz', 'config' and 'initramfs' in the folder :/boot"
msg2 " - Update the boot menu. e.g. 'sudo grub-mkconfig -o /boot/grub/grub.cfg'"
fi
fi