use git for kernel sources & improved CI workflow (#591)
* prepare: auto-fetch latest versions + harmonize kernel version var - Latest version is fetched from git: this prepares the road to moving to git cloning and fetching - Introduce the $_kver variable that follows a three digit convention (e.g. '600', '519', '504') to enable comparing simply between kernel versions Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com> * All distros: use git to fetch/update kernel sources - Force git cloning `linux-tkg` so the patches and config files are automatically checksummed - Arch: remove all the sha256sums and source files and automatically populate them on script run. - Move git cloning/fetching script to 'prepare' script file Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com> * accept customization.cfg vars as env vars This makes CLI way easier by enabling e.g. _version="5.19" makepkg or _version="5.19" ./install.sh install Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com> * prepare: better handle git remotes now there's a dictionary that gives the list of remotes Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com> * prepare: add default git remote if not set or not recognized Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com> * customization.cfg: allow specific kernel versions e.g. "6.0-rc4" or "5.10.51" Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com> * ci: improved workflow 1. Check periodically for newer kernels with git 2. If a newer kernel exists, with respect to l latest Github release: 1. Build for cfs, pds, bmq for Arch 2. Make release Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com> Signed-off-by: Adel KARA SLIMANE <adel.ks@zegrapher.com>
This commit is contained in:
committed by
GitHub
parent
cb4c79a2fb
commit
59afa4083c
110
install.sh
110
install.sh
@@ -26,10 +26,6 @@ if [ ! -x "$(command -v sudo)" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
source customization.cfg
|
||||
|
||||
source linux-tkg-config/prepare
|
||||
|
||||
msg2() {
|
||||
echo -e " \033[1;34m->\033[1;0m \033[1;1m$1\033[1;0m" >&2
|
||||
}
|
||||
@@ -46,6 +42,12 @@ plain() {
|
||||
echo -e "$1" >&2
|
||||
}
|
||||
|
||||
declare -p -x > current_env
|
||||
source customization.cfg
|
||||
. current_env
|
||||
|
||||
source linux-tkg-config/prepare
|
||||
|
||||
_distro_prompt() {
|
||||
echo "Which linux distribution are you running ?"
|
||||
echo "if it's not on the list, chose the closest one to it: Fedora/Suse for RPM, Ubuntu/Debian for DEB"
|
||||
@@ -73,103 +75,6 @@ _install_dependencies() {
|
||||
fi
|
||||
}
|
||||
|
||||
_linux_git_branch_checkout() {
|
||||
|
||||
cd "$_where"
|
||||
|
||||
if [[ -z "$_git_mirror" || ! "$_git_mirror" =~ ^(kernel\.org|googlesource\.com)$ ]]; then
|
||||
while true; do
|
||||
echo "Which git repository would you like to clone the linux sources from ?"
|
||||
echo " 0) kernel.org (official)"
|
||||
echo " 1) googlesource.com (faster mirror)"
|
||||
read -p "[0-1]: " _git_repo_index
|
||||
|
||||
if [ "$_git_repo_index" = "0" ]; then
|
||||
_git_mirror="kernel.org"
|
||||
break
|
||||
elif [ "$_git_repo_index" = "1" ]; then
|
||||
_git_mirror="googlesource.com"
|
||||
break
|
||||
else
|
||||
echo "Wrong index."
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if ! [ -d linux-src-git ]; then
|
||||
msg2 "First initialization of the linux source code git folder"
|
||||
mkdir linux-src-git
|
||||
cd linux-src-git
|
||||
git init
|
||||
|
||||
git remote add kernel.org https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
|
||||
git remote add googlesource.com https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable
|
||||
else
|
||||
cd linux-src-git
|
||||
|
||||
# Remove "origin" remote if present
|
||||
if git remote -v | grep -w "origin" ; then
|
||||
git remote rm origin
|
||||
fi
|
||||
|
||||
if ! git remote -v | grep -w "kernel.org" ; then
|
||||
git remote add kernel.org https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
|
||||
fi
|
||||
if ! git remote -v | grep -w "googlesource.com" ; then
|
||||
git remote add googlesource.com https://kernel.googlesource.com/pub/scm/linux/kernel/git/stable/linux-stable
|
||||
fi
|
||||
|
||||
msg2 "Current branch: $(git branch | grep "\*")"
|
||||
msg2 "Reseting files to their original state"
|
||||
|
||||
git reset --hard HEAD
|
||||
git clean -f -d -x
|
||||
fi
|
||||
|
||||
if [[ "$_sub" = rc* ]]; then
|
||||
msg2 "Switching to master branch for RC Kernel"
|
||||
|
||||
if ! git branch --list | grep "master-${_git_mirror}" ; then
|
||||
msg2 "master branch doesn't locally exist, shallow cloning..."
|
||||
git remote set-branches --add kernel.org master
|
||||
git remote set-branches --add googlesource.com 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
|
||||
msg2 "master branch exists locally, updating..."
|
||||
git checkout master-${_git_mirror}
|
||||
git fetch --depth 1 $_git_mirror tag "v${_basekernel}-${_sub}"
|
||||
git reset --hard ${_git_mirror}/master
|
||||
fi
|
||||
msg2 "Checking out latest RC tag: v${_basekernel}-${_sub}"
|
||||
git checkout "v${_basekernel}-${_sub}"
|
||||
else
|
||||
# define kernel tag so we treat the 0 subver properly
|
||||
_kernel_tag="v${_basekernel}.${_sub}"
|
||||
if [ "$_sub" = "0" ];then
|
||||
_kernel_tag="v${_basekernel}"
|
||||
fi
|
||||
|
||||
msg2 "Switching to linux-${_basekernel}.y"
|
||||
if ! git branch --list | grep -w "linux-${_basekernel}-${_git_mirror}" ; then
|
||||
msg2 "${_basekernel}.y branch doesn't locally exist, shallow cloning..."
|
||||
git remote set-branches --add kernel.org linux-${_basekernel}.y
|
||||
git remote set-branches --add googlesource.com 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
|
||||
msg2 "${_basekernel}.y branch exists locally, updating..."
|
||||
git checkout linux-${_basekernel}-${_git_mirror}
|
||||
git fetch --depth 1 $_git_mirror tag "${_kernel_tag}"
|
||||
git reset --hard ${_git_mirror}/linux-${_basekernel}.y
|
||||
fi
|
||||
msg2 "Checking out latest release: ${_kernel_tag}"
|
||||
git checkout "${_kernel_tag}"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$1" != "install" ] && [ "$1" != "config" ] && [ "$1" != "uninstall-help" ]; then
|
||||
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
|
||||
@@ -225,9 +130,6 @@ if [ "$1" = "install" ] || [ "$1" = "config" ]; then
|
||||
_distro=""
|
||||
fi
|
||||
|
||||
# Git clone (if necessary) and checkout the asked branch by the user
|
||||
_linux_git_branch_checkout
|
||||
|
||||
# cd into the linux-src folder is important before calling _tkg_srcprep
|
||||
cd "$_where/linux-src-git"
|
||||
_tkg_srcprep
|
||||
|
Reference in New Issue
Block a user