Skip to content

Commit

Permalink
[nvidia-inst] made 'dkms' as an optional package (useful for option -…
Browse files Browse the repository at this point in the history
…-no-dkms)
  • Loading branch information
manuel-192 committed Oct 23, 2024
1 parent bc72099 commit e819858
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
10 changes: 4 additions & 6 deletions nvidia-inst/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Contributor: joekamprad <[email protected]>

pkgname=nvidia-inst
pkgver=24.10.1
pkgver=24.10.2
pkgrel=1
pkgdesc="Script to setup nvidia drivers (dkms version) in EndeavourOS"
url=https://github.com/endeavouros-team/PKGBUILDS/tree/master/$pkgname
Expand All @@ -12,16 +12,14 @@ arch=('any')
license=('GPL2')
replaces=(nvidia-installer-dkms nvidia-installer-db nvidia-installer-common)
conflicts=(nvidia-installer-common)
depends=(
# nvidia-installer-common
dkms
)
depends=()
optdepends=(
"linux-headers: for $pkgname with kernel linux"
"linux-lts-headers: for $pkgname with kernel linux-lts"
"linux-hardened-headers: for $pkgname with kernel linux-hardened"
"linux-zen-headers: for $pkgname with kernel linux-zen"
"expac: faster way for finding available package versions"
"dkms: for the dkms versions of Nvidia drivers"
)

source=(
Expand All @@ -30,7 +28,7 @@ source=(
$_url/nvidia-installer-kernel-para
$_url/nvidia-driver-supported-branches
)
sha512sums=('a5ab6f10ea17a92de4a343bdd83c335be4cc0e8b780157bb01e88da92c0e024343d210a9170eb050fea9ff9c052e115e82e4d3e75330516ad4fcb86fda400ec6'
sha512sums=('69816b8c6835edc2fc8387a11cddeabffad238e6001769359a338f6b84be0d21ece71887e3584904e3086f97f746fb5a145b2a2ea07257f4e8e5a656bc9a7311'
'b8857ff98870ac8cff78e31c660bde3b7308752ee4e6547682340866ee59f5801f09ede41e490380a40926536f47259f5d347fd59e8e2ffa67a8cb57f07c44e6'
'8ee3fadd5c5c3f82d8f7c0b9273c7c970fe67486e5bcba5edae5dc7d997cd3aeb334fe8e76576b824187072c314dffcfd9cc01f2fdc46213001a6b997d720bb0'
'429c18ecf23d56b9b996b5e48884365324b713d48cfeab09e48753cfa8afdf79516a753058f6a0b6acaaca7c6f4a690dc5816c53c5f0ad3682291f481b6e1c5d')
Expand Down
32 changes: 30 additions & 2 deletions nvidia-inst/nvidia-inst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ PkgRemove() {
done
}

EnsureDkms() {
if [ $dkms_added = no ] ; then
if [ ! -x /bin/dkms ] ; then
adjusted+=(dkms)
dkms_added=yes
fi
fi
}

CheckUnsupportedKernels() {
local unsupported_kernels="$(expac -Qs %n linux headers | grep -P 'rt-|hardened-|zen-' | sed 's|-headers||')"
[ "$unsupported_kernels" ] && Warn "unsupported kernels installed: $unsupported_kernels"
Expand Down Expand Up @@ -101,12 +110,10 @@ AdjustPkgsAboutDkms() {
nvidia-dkms)
# Info "Changing $pkg to nvidia and nvidia-lts"
adjusted+=(nvidia nvidia-lts) # no need to check installed kernels?
# CheckUnsupportedKernels
;;
nvidia-open-dkms)
# Info "Changing $pkg to nvidia-open"
adjusted+=(nvidia-open)
# CheckUnsupportedKernels
;;
bbswitch-dkms)
# Info "Changing $pkg to bbswitch"
Expand All @@ -121,6 +128,27 @@ AdjustPkgsAboutDkms() {
remove=("${adjusted[@]}")
fi
;;
yes)
local dkms_added=no
for ((ix=0; ix<ic; ix++)) ; do
pkg="${install[$ix]}"
case "$pkg" in
nvidia-dkms | nvidia-open-dkms | bbswitch-dkms)
EnsureDkms
adjusted+=("$pkg")
;;
nvidia-beta-dkms)
DIE "AUR package $pkg not supported"
;;
*)
adjusted+=("$pkg")
;;
esac
done
if [ ${#adjusted[@]} -gt 0 ] ; then
install=("${adjusted[@]}")
fi
;;
esac
}

Expand Down

0 comments on commit e819858

Please sign in to comment.