install.sh: improve git fetching and stop producing source code packages (#222)

* install.sh: improve git source code fetching

* install.sh: add install dependency for Fedora 33+

* install.sh, customization.cfg: cosmetic improvements

* install.sh: DEB, RMP: do not create devel packages.

They are not needed for DKMS
and that was the only point to why they were there to begin with
This commit is contained in:
Adel Kara Slimane 2021-04-16 21:09:21 +02:00 committed by GitHub
parent 7c2cbd3621
commit e7d97fc497
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 50 deletions

View File

@ -206,7 +206,7 @@ _custom_commandline="intel_pstate=passive"
_custom_pkgbase="" _custom_pkgbase=""
# [non-Arch specific] Kernel localversion. Putting it to "Mario" will make for example the kernel version be 5.7.0-tkg-Mario (given by uname -r) # [non-Arch specific] Kernel localversion. Putting it to "Mario" will make for example the kernel version be 5.7.0-tkg-Mario (given by uname -r)
# If left empty, it will use -tkg-"${_cpusched}" where "${_cpusched}" will be replaced by the user chosen scheduler # If left empty, it will use "-tkg-${_cpusched}${_compiler}" where "${_cpusched}" will be replaced by the user chosen scheduler, ${_compiler} will be replaced by "-llvm" if clang is used (nothing for GCC).
_kernel_localversion="" _kernel_localversion=""
#### USER PATCHES #### #### USER PATCHES ####

View File

@ -61,7 +61,7 @@ _install_dependencies() {
if [ $(rpm -E %fedora) = "32" ]; then if [ $(rpm -E %fedora) = "32" ]; then
sudo dnf install fedpkg fedora-packager rpmdevtools ncurses-devel pesign grubby qt5-devel libXi-devel gcc-c++ git ccache flex bison elfutils-libelf-devel openssl-devel dwarves rpm-build ${clang_deps} -y sudo dnf install fedpkg fedora-packager rpmdevtools ncurses-devel pesign grubby qt5-devel libXi-devel gcc-c++ git ccache flex bison elfutils-libelf-devel openssl-devel dwarves rpm-build ${clang_deps} -y
else else
sudo dnf install fedpkg fedora-packager rpmdevtools ncurses-devel pesign grubby libXi-devel gcc-c++ git ccache flex bison elfutils-libelf-devel elfutils-devel openssl openssl-devel dwarves rpm-build perl-devel perl-generators python3-devel make -y ${clang_deps} -y sudo dnf install qt5-qtbase-devel fedpkg fedora-packager rpmdevtools ncurses-devel pesign grubby libXi-devel gcc-c++ git ccache flex bison elfutils-libelf-devel elfutils-devel openssl openssl-devel dwarves rpm-build perl-devel perl-generators python3-devel make -y ${clang_deps} -y
fi fi
elif [ "$_distro" = "Suse" ]; then elif [ "$_distro" = "Suse" ]; then
msg2 "Installing dependencies" msg2 "Installing dependencies"
@ -103,6 +103,11 @@ _linux_git_branch_checkout() {
else else
cd linux-src-git cd linux-src-git
# Remove "origin" remote if present
if git remote -v | grep "origin" ; then
git remote rm origin
fi
if ! git remote -v | grep "kernel.org" ; then if ! git remote -v | grep "kernel.org" ; then
git remote add kernel.org https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git git remote add kernel.org https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
fi fi
@ -117,24 +122,23 @@ _linux_git_branch_checkout() {
git clean -f -d -x git clean -f -d -x
fi fi
_clone_start_date=$(date -d "$(date +"%Y/%m/%d") - 21 day" +"%Y/%m/%d")
if [[ "$_sub" = rc* ]]; then if [[ "$_sub" = rc* ]]; then
msg2 "Switching to master branch for RC Kernel" msg2 "Switching to master branch for RC Kernel"
if ! git branch --list | grep "master" ; then if ! git branch --list | grep "master-${_git_mirror}" ; then
msg2 "master branch doesn't locally exist, shallow cloning..." msg2 "master branch doesn't locally exist, shallow cloning..."
git remote set-branches --add $_git_mirror master git remote set-branches --add kernel.org master
git fetch $_git_mirror master --shallow-since=$_clone_start_date git remote set-branches --add googlesource.com master
git checkout -b master ${_git_mirror}/master git fetch --depth=1 $_git_mirror master
git fetch --depth 1 $_git_mirror tag "v${_basekernel}-${_sub}"
git checkout -b master-${_git_mirror} ${_git_mirror}/master
else else
msg2 "master branch exists locally, updating..." msg2 "master branch exists locally, updating..."
git checkout master git checkout master-${_git_mirror}
git fetch $_git_mirror master --shallow-since=$_clone_start_date git fetch --depth 1 $_git_mirror tag "v${_basekernel}-${_sub}"
git reset --hard ${_git_mirror}/master git reset --hard ${_git_mirror}/master
fi fi
msg2 "Checking out latest RC tag: v${_basekernel}-${_sub}" msg2 "Checking out latest RC tag: v${_basekernel}-${_sub}"
git fetch $_git_mirror tag "v${_basekernel}-${_sub}"
git checkout "v${_basekernel}-${_sub}" git checkout "v${_basekernel}-${_sub}"
else else
# define kernel tag so we treat the 0 subver properly # define kernel tag so we treat the 0 subver properly
@ -144,19 +148,20 @@ _linux_git_branch_checkout() {
fi fi
msg2 "Switching to linux-${_basekernel}.y" msg2 "Switching to linux-${_basekernel}.y"
if ! git branch --list | grep "linux-${_basekernel}.y" ; then if ! git branch --list | grep "linux-${_basekernel}-${_git_mirror}" ; then
msg2 "${_basekernel}.y branch doesn't locally exist, shallow cloning..." msg2 "${_basekernel}.y branch doesn't locally exist, shallow cloning..."
git remote set-branches --add $_git_mirror linux-${_basekernel}.y git remote set-branches --add kernel.org linux-${_basekernel}.y
git fetch $_git_mirror linux-${_basekernel}.y --shallow-since=$_clone_start_date git remote set-branches --add googlesource.com linux-${_basekernel}.y
git checkout -b linux-${_basekernel}.y ${_git_mirror}/linux-${_basekernel}.y git fetch --depth=1 $_git_mirror linux-${_basekernel}.y
git fetch --depth=1 $_git_mirror tag "${_kernel_tag}"
git checkout -b linux-${_basekernel}-${_git_mirror} ${_git_mirror}/linux-${_basekernel}.y
else else
msg2 "${_basekernel}.y branch exists locally, updating..." msg2 "${_basekernel}.y branch exists locally, updating..."
git checkout linux-${_basekernel}.y git checkout linux-${_basekernel}-${_git_mirror}
git fetch $_git_mirror linux-${_basekernel}.y --shallow-since=$_clone_start_date git fetch --depth 1 $_git_mirror tag "${_kernel_tag}"
git reset --hard ${_git_mirror}/linux-${_basekernel}.y git reset --hard ${_git_mirror}/linux-${_basekernel}.y
fi fi
msg2 "Checking out latest release: ${_kernel_tag}" msg2 "Checking out latest release: ${_kernel_tag}"
git fetch $_git_mirror tag "${_kernel_tag}"
git checkout "${_kernel_tag}" git checkout "${_kernel_tag}"
fi fi
@ -200,7 +205,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" && "$_distro" != "Debian" && "$_distro" != "Fedora" && "$_distro" != "Suse" ]]; then if [[ $1 = "install" && ! "$_distro" =~ ^(Ubuntu|Debian|Fedora|Suse)$ ]]; 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
@ -298,16 +303,16 @@ 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
if [ "$_distro" = "Ubuntu" ] || [ "$_distro" = "Debian" ]; then if [[ "$_distro" =~ ^(Ubuntu|Debian)$ ]]; then
export PATH="/usr/lib/ccache/bin/:$PATH" export PATH="/usr/lib/ccache/bin/:$PATH"
elif [ "$_distro" = "Fedora" ] || [ "$_distro" = "Suse" ]; then elif [[ "$_distro" =~ ^(Fedora|Suse)$ ]]; then
export PATH="/usr/lib64/ccache/:$PATH" export PATH="/usr/lib64/ccache/:$PATH"
fi 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 'ccache was found and will be used' msg2 'Enabled ccache'
fi fi
@ -327,7 +332,7 @@ if [ "$1" = "install" ]; then
if [ "$_distro" = "Ubuntu" ] || [ "$_distro" = "Debian" ]; then if [ "$_distro" = "Ubuntu" ] || [ "$_distro" = "Debian" ]; then
if make ${llvm_opt} -j ${_thread_num} deb-pkg LOCALVERSION=-${_kernel_flavor}; then if make ${llvm_opt} -j ${_thread_num} bindeb-pkg LOCALVERSION=-${_kernel_flavor}; then
msg2 "Building successfully finished!" msg2 "Building successfully finished!"
cd "$_where" cd "$_where"
@ -348,10 +353,9 @@ if [ "$1" = "install" ]; then
fi fi
_headers_deb="linux-headers-${_kernelname}*.deb" _headers_deb="linux-headers-${_kernelname}*.deb"
_image_deb="linux-image-${_kernelname}_*.deb" _image_deb="linux-image-${_kernelname}_*.deb"
_kernel_devel_deb="linux-libc-dev_${_kernelname}*.deb"
cd DEBS cd DEBS
sudo dpkg -i $_headers_deb $_image_deb $_kernel_devel_deb sudo dpkg -i $_headers_deb $_image_deb
fi fi
fi fi
@ -367,7 +371,7 @@ if [ "$1" = "install" ]; then
_extra_ver_str="_${_kernel_flavor}" _extra_ver_str="_${_kernel_flavor}"
fi fi
if RPMOPTS="--define '_topdir ${HOME}/.cache/linux-tkg-rpmbuild'" make ${llvm_opt} -j ${_thread_num} rpm-pkg EXTRAVERSION="${_extra_ver_str}"; then if RPMOPTS="--define '_topdir ${HOME}/.cache/linux-tkg-rpmbuild'" make ${llvm_opt} -j ${_thread_num} binrpm-pkg EXTRAVERSION="${_extra_ver_str}"; then
msg2 "Building successfully finished!" msg2 "Building successfully finished!"
cd "$_where" cd "$_where"
@ -388,15 +392,12 @@ if [ "$1" = "install" ]; then
fi fi
_headers_rpm="kernel-headers-${_kernelname}*.rpm" _headers_rpm="kernel-headers-${_kernelname}*.rpm"
_kernel_rpm="kernel-${_kernelname}*.rpm" _kernel_rpm="kernel-${_kernelname}*.rpm"
_kernel_devel_rpm="kernel-devel-${_kernelname}*.rpm"
cd RPMS cd RPMS
if [ "$_distro" = "Fedora" ]; then if [ "$_distro" = "Fedora" ]; then
sudo dnf install $_headers_rpm $_kernel_rpm $_kernel_devel_rpm sudo dnf install $_headers_rpm $_kernel_rpm
elif [ "$_distro" = "Suse" ]; then elif [ "$_distro" = "Suse" ]; then
msg2 "Some files from 'linux-glibc-devel' will be replaced by files from the custom kernel-hearders package" sudo zypper install --allow-unsigned-rpm $_headers_rpm $_kernel_rpm
msg2 "To revert back to the original kernel headers do 'sudo zypper install -f linux-glibc-devel'"
sudo zypper install --replacefiles --allow-unsigned-rpm $_headers_rpm $_kernel_rpm $_kernel_devel_rpm
fi fi
msg2 "Install successful" msg2 "Install successful"