Always create a subfolder for source and work directories with hardcoded names (linux-src-git and linux-kernel.git for source and work dirs respectively). If an absolute path is used, create a linux-tkg subdir to contain those. This allows using the same root path for both as well as defaulting to an empty value that mimics our previous behavior. The main motivation for this is to offer more safety as using an existing non-empty dir might result in unwanted behavior.

Fixes https://github.com/Frogging-Family/linux-tkg/issues/685
This commit is contained in:
Tk-Glitch
2023-01-09 17:43:24 +01:00
parent 3cdda62d46
commit 3a62d00e93
2 changed files with 14 additions and 17 deletions

View File

@@ -23,17 +23,19 @@ _NUKR="true"
# Git mirror to use to get the kernel sources, possible values are "kernel.org", "googlesource.com", "github.com" and "torvalds" # Git mirror to use to get the kernel sources, possible values are "kernel.org", "googlesource.com", "github.com" and "torvalds"
_git_mirror="kernel.org" _git_mirror="kernel.org"
# Folder where to checkout the kernel sources and build inside it # Root folder where to checkout the kernel sources (linux-src-git subdir) and build
# Note: - Start with a '/' for an absolute path # Note: - Leave empty to use PKGBUILD's dir
# - Start with a '/' for an absolute path in which `linux-tkg/linux-src-git/` will be created
# - This setting can be used to set the work/build folder to a tmpfs folder # - This setting can be used to set the work/build folder to a tmpfs folder
# - Requires >= 32GB ram when building a full kernel, should work with less ram with modprobed-db # - Requires >= 32GB ram when building a full kernel, should work with less ram with modprobed-db
_kernel_work_folder="linux-src-git" _kernel_work_folder=""
# Permanent folder where to keep the git clone and fetch new blobs # Permanent root folder where to keep the git clone (linux-kernel.git subdir) and fetch new blobs
# Note: - Start with a '/' for an absolute path # Note: - Leave empty to use PKGBUILD's dir
# - Start with a '/' for an absolute path in which `linux-tkg/linux-kernel.git/` will be created
# - If your internet is faster than your storage, it may be wise to put this folder # - If your internet is faster than your storage, it may be wise to put this folder
# in a tmpfs location (although it will reclone after each restart / tmpfs folder cleanup) # in a tmpfs location (although it will reclone after each restart / tmpfs folder cleanup)
_kernel_source_folder="linux-kernel.git" _kernel_source_folder=""
# Custom compiler root dirs - Leave empty to use system compilers # Custom compiler root dirs - Leave empty to use system compilers
# Example: CUSTOM_GCC_PATH="/home/frog/PKGBUILDS/mostlyportable-gcc/gcc-mostlyportable-9.2.0" # Example: CUSTOM_GCC_PATH="/home/frog/PKGBUILDS/mostlyportable-gcc/gcc-mostlyportable-9.2.0"

View File

@@ -383,14 +383,14 @@ _set_compiler(){
_define_kernel_abs_paths() { _define_kernel_abs_paths() {
_kernel_work_folder_abs="$_kernel_work_folder" _kernel_work_folder_abs="$_where/$_kernel_work_folder/linux-src-git"
if ! [[ "$_kernel_work_folder" == /* ]]; then if [[ "$_kernel_work_folder" == /* ]]; then
_kernel_work_folder_abs="$_where/$_kernel_work_folder" _kernel_work_folder_abs="$_kernel_work_folder/linux-tkg/linux-src-git"
fi fi
_kernel_source_folder_abs="$_kernel_source_folder" _kernel_source_folder_abs="$_where/$_kernel_source_folder/linux-kernel.git"
if ! [[ "$_kernel_source_folder" == /* ]]; then if [[ "$_kernel_source_folder" == /* ]]; then
_kernel_source_folder_abs="$_where/$_kernel_source_folder" _kernel_source_folder_abs="$_kernel_source_folder/linux-tkg/linux-kernel.git"
fi fi
} }
@@ -399,11 +399,6 @@ _setup_kernel_work_folder() {
_define_kernel_abs_paths _define_kernel_abs_paths
if [ "$_kernel_source_folder_abs" == "$_kernel_work_folder_abs" ]; then
warning "The kernel source folder cannot be the same as the kernel work folder"
exit 1
fi
if [ -z "$_kernel_git_tag" ]; then if [ -z "$_kernel_git_tag" ]; then
warning "internal error: kernel version should be chosen before cloning kernel sources" warning "internal error: kernel version should be chosen before cloning kernel sources"
exit 1 exit 1