install.sh: Add convenience script for generic install (#227)
* install.sh: simplify ccache code * install.sh: add generic distro install * README: update with Generic distro install * install.sh: update help messages
This commit is contained in:
parent
2994601740
commit
89cd81e726
@ -119,3 +119,11 @@ The command to do for that is:
|
|||||||
./install.sh config
|
./install.sh config
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If one chooses `Generic` as distro. `./install.sh install` will compile the kernel then prompt before doing the following:
|
||||||
|
```shell
|
||||||
|
sudo make modules_install
|
||||||
|
sudo make install
|
||||||
|
sudo dracut --hostonly --kver $_kernelname
|
||||||
|
sudo grub-mkconfig -o /boot/grub/grub.cfg
|
||||||
|
```
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# linux-TkG config file
|
# linux-TkG config file
|
||||||
|
|
||||||
# Linux distribution you are using, options are "Arch", "Void", "Ubuntu", "Debian", "Fedora" or "Suse".
|
# Linux distribution you are using, options are "Arch", "Void", "Ubuntu", "Debian", "Fedora", "Suse", "Generic".
|
||||||
# It is automatically set to "Arch" when using PKGBUILD.
|
# It is automatically set to "Arch" when using PKGBUILD.
|
||||||
# If left empty, the script will prompt
|
# If left empty, the script will prompt
|
||||||
_distro=""
|
_distro=""
|
||||||
|
66
install.sh
66
install.sh
@ -25,7 +25,8 @@ _distro_prompt() {
|
|||||||
echo " 2) Fedora"
|
echo " 2) Fedora"
|
||||||
echo " 3) Suse"
|
echo " 3) Suse"
|
||||||
echo " 4) Ubuntu"
|
echo " 4) Ubuntu"
|
||||||
read -p "[1-4]: " _distro_index
|
echo " 5) Generic"
|
||||||
|
read -p "[1-5]: " _distro_index
|
||||||
|
|
||||||
if [ "$_distro_index" = "1" ]; then
|
if [ "$_distro_index" = "1" ]; then
|
||||||
_distro="Debian"
|
_distro="Debian"
|
||||||
@ -39,6 +40,9 @@ _distro_prompt() {
|
|||||||
elif [ "$_distro_index" = "4" ]; then
|
elif [ "$_distro_index" = "4" ]; then
|
||||||
_distro="Ubuntu"
|
_distro="Ubuntu"
|
||||||
break
|
break
|
||||||
|
elif [ "$_distro_index" = "5" ]; then
|
||||||
|
_distro="Generic"
|
||||||
|
break
|
||||||
else
|
else
|
||||||
echo "Wrong index."
|
echo "Wrong index."
|
||||||
fi
|
fi
|
||||||
@ -181,8 +185,11 @@ if [ "$1" != "install" ] && [ "$1" != "config" ] && [ "$1" != "uninstall-help" ]
|
|||||||
msg2 "Argument not recognised, options are:
|
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
|
- 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.
|
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
|
- install : 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."
|
- '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
|
exit 0
|
||||||
fi
|
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
|
# Run init script that is also run in PKGBUILD, it will define some env vars that we will use
|
||||||
_tkg_initscript
|
_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 "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..."
|
msg2 "This script can only install custom kernels for RPM and DEB based distros, though only those keywords are permitted. Exiting..."
|
||||||
exit 0
|
exit 0
|
||||||
@ -303,17 +310,11 @@ if [ "$1" = "install" ]; then
|
|||||||
|
|
||||||
# ccache
|
# ccache
|
||||||
if [ "$_noccache" != "true" ]; then
|
if [ "$_noccache" != "true" ]; then
|
||||||
# Todo: deal with generic and paths, maybe just export boths possibilities and not care
|
export PATH="/usr/lib64/ccache/:/usr/lib/ccache/bin/:$PATH"
|
||||||
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 CCACHE_SLOPPINESS="file_macro,locale,time_macros"
|
export CCACHE_SLOPPINESS="file_macro,locale,time_macros"
|
||||||
export CCACHE_NOHASHDIR="true"
|
export CCACHE_NOHASHDIR="true"
|
||||||
msg2 'Enabled ccache'
|
msg2 'Enabled ccache'
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z $_kernel_localversion ]; then
|
if [ -z $_kernel_localversion ]; then
|
||||||
@ -404,6 +405,36 @@ if [ "$1" = "install" ]; then
|
|||||||
msg2 "Install successful"
|
msg2 "Install successful"
|
||||||
fi
|
fi
|
||||||
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -414,9 +445,9 @@ if [ "$1" = "uninstall-help" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$_where"
|
cd "$_where"
|
||||||
msg2 "List of installed custom tkg kernels: "
|
|
||||||
|
|
||||||
if [ "$_distro" = "Ubuntu" ]; then
|
if [ "$_distro" = "Ubuntu" ]; then
|
||||||
|
msg2 "List of installed custom tkg kernels: "
|
||||||
dpkg -l "*tkg*" | grep "linux.*tkg"
|
dpkg -l "*tkg*" | grep "linux.*tkg"
|
||||||
dpkg -l "*linux-libc-dev*" | 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: "
|
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 " 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."
|
msg2 "Note: linux-libc-dev packages are no longer created and installed, you can safely remove any remnants."
|
||||||
elif [ "$_distro" = "Fedora" ]; then
|
elif [ "$_distro" = "Fedora" ]; then
|
||||||
|
msg2 "List of installed custom tkg kernels: "
|
||||||
dnf list --installed kernel*
|
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 "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 " sudo dnf remove --noautoremove kernel-VERSION kernel-devel-VERSION kernel-headers-VERSION"
|
||||||
msg2 " where VERSION is displayed in the second column"
|
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."
|
msg2 "Note: kernel-headers packages are no longer created and installed, you can safely remove any remnants."
|
||||||
elif [ "$_distro" = "Suse" ]; then
|
elif [ "$_distro" = "Suse" ]; then
|
||||||
|
msg2 "List of installed custom tkg kernels: "
|
||||||
zypper packages --installed-only | grep "kernel.*tkg"
|
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 "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 " 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 " 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."
|
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
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user