summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoan Figueras2021-01-25 23:21:15 +0100
committerJoan Figueras2021-01-25 23:21:15 +0100
commitc0b9df4e7565b5d6caf8f7f3a835328c6b0ea042 (patch)
treeaa3837e1cc0e34b676672f609ca8ce8344151f25
parent85202637e30e57dba2c592af05e41e772c0e8c02 (diff)
downloadaur-c0b9df4e7565b5d6caf8f7f3a835328c6b0ea042.tar.gz
Improved myconfig code to use a loop
-rw-r--r--PKGBUILD22
1 files changed, 17 insertions, 5 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 77f0851e1ddf..a0753761a205 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -145,11 +145,23 @@ prepare() {
sh ${srcdir}/choose-gcc-optimization.sh $_microarchitecture
# This is intended for the people that want to build this package with their own config
- # Put the file "myconfig" at the package folder to use this feature
- if [ -f "${startdir}/myconfig" ]; then
- msg2 "Using user CUSTOM config..."
- cp -f "${startdir}"/myconfig .config
- fi
+ # Put the file "myconfig" at the package folder (this will take preference) or "${XDG_CONFIG_HOME}/linux-xanmod/myconfig"
+ # If we detect partial file with scripts/config commands, we execute as a script
+ # If not, it's a full config, will be replaced
+ for _myconfig in "${startdir}/myconfig" "${XDG_CONFIG_HOME}/linux-xanmod/myconfig" ; do
+ if [ -f "${_myconfig}" ]; then
+ if grep -q 'scripts/config' "${_myconfig}"; then
+ # myconfig is a partial file. Executing as a script
+ msg2 "Applying myconfig..."
+ bash -x "${_myconfig}"
+ else
+ # myconfig is a full config file. Replacing default .config
+ msg2 "Using user CUSTOM config..."
+ cp -f "${_myconfig}" .config
+ fi
+ echo
+ fi
+ done
make olddefconfig