summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoan Figueras2021-01-25 23:20:01 +0100
committerJoan Figueras2021-01-25 23:20:01 +0100
commit2d907aaef2ceabb982e898bdfa769b8f8336c383 (patch)
treec4411671a60e3e800a31db62abe019c702159ad0
parentba70be44df88a639f0cfc87c23d772ac3e81af2b (diff)
downloadaur-2d907aaef2ceabb982e898bdfa769b8f8336c383.tar.gz
Improved myconfig code to use a loop
-rw-r--r--PKGBUILD37
1 files changed, 16 insertions, 21 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 8482f799bf7..e3287e11b57 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -164,28 +164,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 it's a full config, will be replaced
- # If not, you should use scripts/config commands, one by line
- if [ -f "${startdir}/myconfig" ]; then
- if ! grep -q 'scripts/config' "${startdir}/myconfig"; then
- # myconfig is a full config file. Replacing default .config
- msg2 "Using user CUSTOM config..."
- cp -f "${startdir}"/myconfig .config
- else
- # myconfig is a partial file. Applying every line
- msg2 "Applying configs..."
- cat "${startdir}"/myconfig | while read -r _linec ; do
- if echo "$_linec" | grep "scripts/config" ; then
- set -- $_linec
- "$@"
- else
- warning "Line format incorrect, ignoring..."
- fi
- done
+ # 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
- echo
- fi
+ done
make olddefconfig