summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDet2017-12-11 18:54:06 +0200
committerDet2017-12-11 18:54:06 +0200
commit90329b253e3fb1b5c0e1412342e9e4e19691ac36 (patch)
tree90b400738dd6f56ffbd1692a3a41ad5c21b5a66a
parentc4061d2d520a501ce0cc43c4f5c62520de057391 (diff)
downloadaur-90329b253e3fb1b5c0e1412342e9e4e19691ac36.tar.gz
Patching
-rw-r--r--PKGBUILD27
1 files changed, 15 insertions, 12 deletions
diff --git a/PKGBUILD b/PKGBUILD
index f710661a2add..64837fd6e0e3 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -36,10 +36,10 @@ md5sums=('a009bbc502c30e4b483d71be9fa51790'
#source+=('linux-4.11.patch')
#md5sums+=('cc8941b6898d9daa0fb67371f57a56b6')
-# Auto-detect patches (e.g. linux-4.1.patch)
-for _patch in $(find -maxdepth 1 -name '*[0-9].[0-9]*.patch' -printf "%f\n"); do
- # Don't duplicate those already defined above
- if [[ ! ${source[@]} =~ $_patch ]]; then
+# Auto-detect patches (e.g. linux-4.19.patch)
+for _patch in $(find -maxdepth 1 -name '*.patch' -printf "%f\n"); do
+ # Don't duplicate those already defined above (https://stackoverflow.com/a/15394738/1821548)
+ if [[ ! " ${source[@]} " =~ " $_patch " ]]; then
source+=("$_patch")
md5sums+=('SKIP')
fi
@@ -68,25 +68,28 @@ prepare() {
cd $_pkg
bsdtar -xf nvidia-persistenced-init.tar.bz2
+ # Kernel version
+ #_kernel=$(cat /usr/lib/modules/extramodules-*-ARCH/version)
+ _major=$(pacman -Q linux | grep -Po "\d+\.\d+")
+
# Loop patches
- for _patch in $(printf -- '%s\n' ${source[@]} | grep -e [0-9].[0-9] -e .patch); do
- # Version variables
- _kernel=$(cat /usr/lib/modules/extramodules-*-ARCH/version)
+ for _patch in $(printf -- '%s\n' ${source[@]} | grep .patch); do
+ # Patch version
_major_patch=$(echo $_patch | grep -Po "\d+\.\d+")
- # Check version
- if (( $(vercmp $_kernel $_major_patch) >= 0 )); then
+ # Compare versions
+ if (( $(vercmp "$_major" "$_major_patch") >= 0 )); then
msg2 "Applying $_patch..."
patch -p1 -i "$srcdir"/$_patch
+ else
+ msg2 "Skipping $_patch..."
fi
done
}
build() {
# Version of 'linux'
- _major=$(pacman -Q linux | grep -Po "\d+\.\d+")
- _extramodules=extramodules-$_major-ARCH
- _kernel=$(cat /usr/lib/modules/$_extramodules/version)
+ _kernel=$(cat /usr/lib/modules/extramodules-*-ARCH/version)
# Build module
cd $_pkg/kernel