Date: Friday, November 1, 2019 @ 14:58:20 Author: seblu Revision: 366396
db-move: moved dkms from [testing] to [extra] (any) Added: dkms/repos/extra-any/0001-Revert-Make-newly-installed-modules-available-immedi.patch (from rev 366395, dkms/repos/testing-any/0001-Revert-Make-newly-installed-modules-available-immedi.patch) dkms/repos/extra-any/PKGBUILD (from rev 366395, dkms/repos/testing-any/PKGBUILD) dkms/repos/extra-any/PKGBUILD.26 (from rev 366395, dkms/repos/testing-any/PKGBUILD.26) dkms/repos/extra-any/dkms.install (from rev 366395, dkms/repos/testing-any/dkms.install) dkms/repos/extra-any/hook.install (from rev 366395, dkms/repos/testing-any/hook.install) dkms/repos/extra-any/hook.remove (from rev 366395, dkms/repos/testing-any/hook.remove) dkms/repos/extra-any/hook.sh (from rev 366395, dkms/repos/testing-any/hook.sh) Deleted: dkms/repos/extra-any/0001-Revert-Make-newly-installed-modules-available-immedi.patch dkms/repos/extra-any/PKGBUILD dkms/repos/extra-any/PKGBUILD.26 dkms/repos/extra-any/dkms.install dkms/repos/extra-any/hook.install dkms/repos/extra-any/hook.remove dkms/repos/extra-any/hook.sh dkms/repos/testing-any/ ---------------------------------------------------------------------------+ /0001-Revert-Make-newly-installed-modules-available-immedi.patch | 31 + /PKGBUILD | 65 +++ /PKGBUILD.26 | 69 +++ /dkms.install | 13 /hook.install | 14 /hook.remove | 16 /hook.sh | 194 ++++++++++ extra-any/0001-Revert-Make-newly-installed-modules-available-immedi.patch | 31 - extra-any/PKGBUILD | 65 --- extra-any/PKGBUILD.26 | 69 --- extra-any/dkms.install | 13 extra-any/hook.install | 14 extra-any/hook.remove | 16 extra-any/hook.sh | 194 ---------- 14 files changed, 402 insertions(+), 402 deletions(-) Deleted: extra-any/0001-Revert-Make-newly-installed-modules-available-immedi.patch =================================================================== --- extra-any/0001-Revert-Make-newly-installed-modules-available-immedi.patch 2019-11-01 14:22:35 UTC (rev 366395) +++ extra-any/0001-Revert-Make-newly-installed-modules-available-immedi.patch 2019-11-01 14:58:20 UTC (rev 366396) @@ -1,31 +0,0 @@ -From ca38ccd38c69a096dafa51c426ee3548980d5e2a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= <se...@seblu.net> -Date: Sat, 8 Jul 2017 15:50:55 +0200 -Subject: [PATCH] Revert "Make newly installed modules available immediately" -To: dkms-de...@dell.com - -This reverts commit f5bfb12fef1fc06e56355cdba500eaa98d4e6aa8. ---- - dkms | 6 ------ - 1 file changed, 6 deletions(-) - -diff --git a/dkms b/dkms -index a6cedc8..3ff71d5 100644 ---- a/dkms -+++ b/dkms -@@ -1522,12 +1522,6 @@ install_module() - exit 6 - } - -- # Make the newly installed modules available immediately -- find /sys/devices -name modalias -print0 | xargs -0 cat | xargs modprobe -a -b -q -- if [ -f /lib/systemd/system/systemd-modules-load.service ]; then -- systemctl restart systemd-modules-load.service -- fi -- - # Do remake_initrd things (save old initrd) - [[ $remake_initrd ]] && ! make_initrd "$kernelver" "$arch" && { - do_uninstall "$kernelver" "$arch" --- -Sébastien "Seblu" Luttringer - Copied: dkms/repos/extra-any/0001-Revert-Make-newly-installed-modules-available-immedi.patch (from rev 366395, dkms/repos/testing-any/0001-Revert-Make-newly-installed-modules-available-immedi.patch) =================================================================== --- extra-any/0001-Revert-Make-newly-installed-modules-available-immedi.patch (rev 0) +++ extra-any/0001-Revert-Make-newly-installed-modules-available-immedi.patch 2019-11-01 14:58:20 UTC (rev 366396) @@ -0,0 +1,31 @@ +From ca38ccd38c69a096dafa51c426ee3548980d5e2a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?S=C3=A9bastien=20Luttringer?= <se...@seblu.net> +Date: Sat, 8 Jul 2017 15:50:55 +0200 +Subject: [PATCH] Revert "Make newly installed modules available immediately" +To: dkms-de...@dell.com + +This reverts commit f5bfb12fef1fc06e56355cdba500eaa98d4e6aa8. +--- + dkms | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/dkms b/dkms +index a6cedc8..3ff71d5 100644 +--- a/dkms ++++ b/dkms +@@ -1522,12 +1522,6 @@ install_module() + exit 6 + } + +- # Make the newly installed modules available immediately +- find /sys/devices -name modalias -print0 | xargs -0 cat | xargs modprobe -a -b -q +- if [ -f /lib/systemd/system/systemd-modules-load.service ]; then +- systemctl restart systemd-modules-load.service +- fi +- + # Do remake_initrd things (save old initrd) + [[ $remake_initrd ]] && ! make_initrd "$kernelver" "$arch" && { + do_uninstall "$kernelver" "$arch" +-- +Sébastien "Seblu" Luttringer + Deleted: extra-any/PKGBUILD =================================================================== --- extra-any/PKGBUILD 2019-11-01 14:22:35 UTC (rev 366395) +++ extra-any/PKGBUILD 2019-11-01 14:58:20 UTC (rev 366396) @@ -1,65 +0,0 @@ -# Maintainer: Sébastien Luttringer -# Contributor: Balwinder S "bsd" Dheeman (bdheeman AT gmail.com) - -pkgname=dkms -pkgver=2.7.1 -pkgrel=1 -pkgdesc='Dynamic Kernel Modules System' -arch=('any') -url='https://github.com/dell/dkms' -license=('GPL2') -depends=('bash' 'kmod' 'gcc' 'make' 'patch') -makedepends=('git') -optdepends=('linux-headers: build modules against the Arch kernel' - 'linux-lts-headers: build modules against the LTS kernel' - 'linux-zen-headers: build modules against the ZEN kernel' - 'linux-hardened-headers: build modules against the HARDENED kernel') -backup=('etc/dkms/framework.conf') -install=$pkgname.install -source=("git+https://github.com/dell/dkms.git#tag=v$pkgver" - 'hook.install' - 'hook.remove' - 'hook.sh' - '0001-Revert-Make-newly-installed-modules-available-immedi.patch') -md5sums=('SKIP' - '90f1486e0af9aab85e8c60d456802c63' - '2e8ffd0c2ddec02872d0234befd129fd' - '80632f6a454b35bcade2bed287f13c7b' - 'd3b91ef709f567a375f4bbdbd3291d2b') - -prepare() { - cd dkms - - # apply patch from the source array (should be a pacman feature) - local filename - for filename in "${source[@]}"; do - if [[ "$filename" =~ \.patch$ ]]; then - msg2 "Applying patch ${filename##*/}" - patch -p1 -N -i "$srcdir/${filename##*/}" - fi - done - - # /usr move - msg2 '/usr move patching' - for i in dkms{,_framework.conf,.bash-completion,.8,_common.postinst}; do - sed -ri 's,/lib/modules,/usr/lib/modules,g' "$i" - done -} - -package() { - # alpm hook - install -D -m 644 hook.install "$pkgdir/usr/share/libalpm/hooks/70-dkms-install.hook" - install -D -m 644 hook.remove "$pkgdir/usr/share/libalpm/hooks/70-dkms-remove.hook" - install -D -m 755 hook.sh "$pkgdir/usr/lib/dkms/alpm-hook" - # upstream installer - cd dkms - # we don't need kconf files, so we install them outside $pkgdir - make \ - DESTDIR="$pkgdir" \ - SBIN="$pkgdir/usr/bin" \ - BASHDIR="$pkgdir/usr/share/bash-completion/completions" \ - KCONF="$srcdir"/kconf \ - install -} - -# vim:set ts=2 sw=2 et: Copied: dkms/repos/extra-any/PKGBUILD (from rev 366395, dkms/repos/testing-any/PKGBUILD) =================================================================== --- extra-any/PKGBUILD (rev 0) +++ extra-any/PKGBUILD 2019-11-01 14:58:20 UTC (rev 366396) @@ -0,0 +1,65 @@ +# Maintainer: Sébastien Luttringer +# Contributor: Balwinder S "bsd" Dheeman (bdheeman AT gmail.com) + +pkgname=dkms +pkgver=2.8.1 +pkgrel=1 +pkgdesc='Dynamic Kernel Modules System' +arch=('any') +url='https://github.com/dell/dkms' +license=('GPL2') +depends=('bash' 'kmod' 'gcc' 'make' 'patch') +makedepends=('git') +optdepends=('linux-headers: build modules against the Arch kernel' + 'linux-lts-headers: build modules against the LTS kernel' + 'linux-zen-headers: build modules against the ZEN kernel' + 'linux-hardened-headers: build modules against the HARDENED kernel') +backup=('etc/dkms/framework.conf') +install=$pkgname.install +source=("git+https://github.com/dell/dkms.git#tag=v$pkgver" + 'hook.install' + 'hook.remove' + 'hook.sh' + '0001-Revert-Make-newly-installed-modules-available-immedi.patch') +md5sums=('SKIP' + '90f1486e0af9aab85e8c60d456802c63' + '2e8ffd0c2ddec02872d0234befd129fd' + '80632f6a454b35bcade2bed287f13c7b' + 'd3b91ef709f567a375f4bbdbd3291d2b') + +prepare() { + cd dkms + + # apply patch from the source array (should be a pacman feature) + local filename + for filename in "${source[@]}"; do + if [[ "$filename" =~ \.patch$ ]]; then + msg2 "Applying patch ${filename##*/}" + patch -p1 -N -i "$srcdir/${filename##*/}" + fi + done + + # /usr move + msg2 '/usr move patching' + for i in dkms{,_framework.conf,.bash-completion,.8,_common.postinst}; do + sed -ri 's,/lib/modules,/usr/lib/modules,g' "$i" + done +} + +package() { + # alpm hook + install -D -m 644 hook.install "$pkgdir/usr/share/libalpm/hooks/70-dkms-install.hook" + install -D -m 644 hook.remove "$pkgdir/usr/share/libalpm/hooks/70-dkms-remove.hook" + install -D -m 755 hook.sh "$pkgdir/usr/lib/dkms/alpm-hook" + # upstream installer + cd dkms + # we don't need kconf files, so we install them outside $pkgdir + make \ + DESTDIR="$pkgdir" \ + SBIN="$pkgdir/usr/bin" \ + BASHDIR="$pkgdir/usr/share/bash-completion/completions" \ + KCONF="$srcdir"/kconf \ + install +} + +# vim:set ts=2 sw=2 et: Deleted: extra-any/PKGBUILD.26 =================================================================== --- extra-any/PKGBUILD.26 2019-11-01 14:22:35 UTC (rev 366395) +++ extra-any/PKGBUILD.26 2019-11-01 14:58:20 UTC (rev 366396) @@ -1,69 +0,0 @@ -# Maintainer: Sébastien Luttringer -# Contributor: Balwinder S "bsd" Dheeman (bdheeman AT gmail.com) - -pkgname=dkms -pkgver=2.6.1 -pkgrel=1 -pkgdesc='Dynamic Kernel Modules System' -arch=('any') -url='https://github.com/dell/dkms' -license=('GPL2') -depends=('bash' 'kmod' 'gcc' 'make' 'patch') -makedepends=('git') -optdepends=('linux-headers: build modules against the Arch kernel' - 'linux-lts-headers: build modules against the LTS kernel' - 'linux-zen-headers: build modules against the ZEN kernel' - 'linux-hardened-headers: build modules against the HARDENED kernel') -backup=('etc/dkms/framework.conf') -install=$pkgname.install -source=("git+https://github.com/dell/dkms.git#tag=v$pkgver" - 'hook.install' - 'hook.remove' - 'hook.sh' - '0001-Revert-Make-newly-installed-modules-available-immedi.patch' - '0002-Revert-Fix-to-run-under-BusyBox-shell.patch' - '0003-Fix-version-check-when-installing-modules.patch') -md5sums=('SKIP' - '90f1486e0af9aab85e8c60d456802c63' - '2e8ffd0c2ddec02872d0234befd129fd' - '80632f6a454b35bcade2bed287f13c7b' - 'd3b91ef709f567a375f4bbdbd3291d2b' - '4342b5e9020a52a73a63e7897ead5405' - '00813655321b8fc256eda737ca0622ef') - -prepare() { - cd dkms - - # apply patch from the source array (should be a pacman feature) - local filename - for filename in "${source[@]}"; do - if [[ "$filename" =~ \.patch$ ]]; then - msg2 "Applying patch ${filename##*/}" - patch -p1 -N -i "$srcdir/${filename##*/}" - fi - done - - # /usr move - msg2 '/usr move patching' - for i in dkms{,_framework.conf,.bash-completion,.8,_common.postinst}; do - sed -ri 's,/lib/modules,/usr/lib/modules,g' "$i" - done -} - -package() { - # alpm hook - install -D -m 644 hook.install "$pkgdir/usr/share/libalpm/hooks/70-dkms-install.hook" - install -D -m 644 hook.remove "$pkgdir/usr/share/libalpm/hooks/70-dkms-remove.hook" - install -D -m 755 hook.sh "$pkgdir/usr/lib/dkms/alpm-hook" - # upstream installer - cd dkms - # we don't need kconf files, so we install them outside $pkgdir - make \ - DESTDIR="$pkgdir" \ - SBIN="$pkgdir/usr/bin" \ - BASHDIR="$pkgdir/usr/share/bash-completion/completions" \ - KCONF="$srcdir"/kconf \ - install -} - -# vim:set ts=2 sw=2 et: Copied: dkms/repos/extra-any/PKGBUILD.26 (from rev 366395, dkms/repos/testing-any/PKGBUILD.26) =================================================================== --- extra-any/PKGBUILD.26 (rev 0) +++ extra-any/PKGBUILD.26 2019-11-01 14:58:20 UTC (rev 366396) @@ -0,0 +1,69 @@ +# Maintainer: Sébastien Luttringer +# Contributor: Balwinder S "bsd" Dheeman (bdheeman AT gmail.com) + +pkgname=dkms +pkgver=2.6.1 +pkgrel=1 +pkgdesc='Dynamic Kernel Modules System' +arch=('any') +url='https://github.com/dell/dkms' +license=('GPL2') +depends=('bash' 'kmod' 'gcc' 'make' 'patch') +makedepends=('git') +optdepends=('linux-headers: build modules against the Arch kernel' + 'linux-lts-headers: build modules against the LTS kernel' + 'linux-zen-headers: build modules against the ZEN kernel' + 'linux-hardened-headers: build modules against the HARDENED kernel') +backup=('etc/dkms/framework.conf') +install=$pkgname.install +source=("git+https://github.com/dell/dkms.git#tag=v$pkgver" + 'hook.install' + 'hook.remove' + 'hook.sh' + '0001-Revert-Make-newly-installed-modules-available-immedi.patch' + '0002-Revert-Fix-to-run-under-BusyBox-shell.patch' + '0003-Fix-version-check-when-installing-modules.patch') +md5sums=('SKIP' + '90f1486e0af9aab85e8c60d456802c63' + '2e8ffd0c2ddec02872d0234befd129fd' + '80632f6a454b35bcade2bed287f13c7b' + 'd3b91ef709f567a375f4bbdbd3291d2b' + '4342b5e9020a52a73a63e7897ead5405' + '00813655321b8fc256eda737ca0622ef') + +prepare() { + cd dkms + + # apply patch from the source array (should be a pacman feature) + local filename + for filename in "${source[@]}"; do + if [[ "$filename" =~ \.patch$ ]]; then + msg2 "Applying patch ${filename##*/}" + patch -p1 -N -i "$srcdir/${filename##*/}" + fi + done + + # /usr move + msg2 '/usr move patching' + for i in dkms{,_framework.conf,.bash-completion,.8,_common.postinst}; do + sed -ri 's,/lib/modules,/usr/lib/modules,g' "$i" + done +} + +package() { + # alpm hook + install -D -m 644 hook.install "$pkgdir/usr/share/libalpm/hooks/70-dkms-install.hook" + install -D -m 644 hook.remove "$pkgdir/usr/share/libalpm/hooks/70-dkms-remove.hook" + install -D -m 755 hook.sh "$pkgdir/usr/lib/dkms/alpm-hook" + # upstream installer + cd dkms + # we don't need kconf files, so we install them outside $pkgdir + make \ + DESTDIR="$pkgdir" \ + SBIN="$pkgdir/usr/bin" \ + BASHDIR="$pkgdir/usr/share/bash-completion/completions" \ + KCONF="$srcdir"/kconf \ + install +} + +# vim:set ts=2 sw=2 et: Deleted: extra-any/dkms.install =================================================================== --- extra-any/dkms.install 2019-11-01 14:22:35 UTC (rev 366395) +++ extra-any/dkms.install 2019-11-01 14:58:20 UTC (rev 366396) @@ -1,13 +0,0 @@ -#!/bin/bash - -# arg 1: the new package version -# arg 2: the old package version -post_upgrade() { - if (( "$(vercmp $2 '2.2.0.3+git151023-2')" < 0 )); then - echo '===> dkms systemd startup service has been removed' - echo '===> modules building is now handled by alpm hooks at install time' - echo '===> startup modules loading must be done via modules-load.d' - fi -} - -# vim:set ts=2 sw=2 ft=sh et: Copied: dkms/repos/extra-any/dkms.install (from rev 366395, dkms/repos/testing-any/dkms.install) =================================================================== --- extra-any/dkms.install (rev 0) +++ extra-any/dkms.install 2019-11-01 14:58:20 UTC (rev 366396) @@ -0,0 +1,13 @@ +#!/bin/bash + +# arg 1: the new package version +# arg 2: the old package version +post_upgrade() { + if (( "$(vercmp $2 '2.2.0.3+git151023-2')" < 0 )); then + echo '===> dkms systemd startup service has been removed' + echo '===> modules building is now handled by alpm hooks at install time' + echo '===> startup modules loading must be done via modules-load.d' + fi +} + +# vim:set ts=2 sw=2 ft=sh et: Deleted: extra-any/hook.install =================================================================== --- extra-any/hook.install 2019-11-01 14:22:35 UTC (rev 366395) +++ extra-any/hook.install 2019-11-01 14:58:20 UTC (rev 366396) @@ -1,14 +0,0 @@ -[Trigger] -Operation = Install -Operation = Upgrade -Type = File -Target = usr/src/*/dkms.conf -Target = usr/lib/modules/*/build/include/ -Target = usr/lib/modules/*/modules.alias - -[Action] -Description = Install DKMS modules -Depends = dkms -When = PostTransaction -Exec = /usr/lib/dkms/alpm-hook install -NeedsTargets Copied: dkms/repos/extra-any/hook.install (from rev 366395, dkms/repos/testing-any/hook.install) =================================================================== --- extra-any/hook.install (rev 0) +++ extra-any/hook.install 2019-11-01 14:58:20 UTC (rev 366396) @@ -0,0 +1,14 @@ +[Trigger] +Operation = Install +Operation = Upgrade +Type = File +Target = usr/src/*/dkms.conf +Target = usr/lib/modules/*/build/include/ +Target = usr/lib/modules/*/modules.alias + +[Action] +Description = Install DKMS modules +Depends = dkms +When = PostTransaction +Exec = /usr/lib/dkms/alpm-hook install +NeedsTargets Deleted: extra-any/hook.remove =================================================================== --- extra-any/hook.remove 2019-11-01 14:22:35 UTC (rev 366395) +++ extra-any/hook.remove 2019-11-01 14:58:20 UTC (rev 366396) @@ -1,16 +0,0 @@ -[Trigger] -Operation = Upgrade -Operation = Remove -Type = File -Target = usr/src/*/dkms.conf -Target = usr/lib/modules/*/build/include/ -Target = usr/lib/modules/*/modules.alias - -[Action] -Description = Remove DKMS modules -Depends = dkms -When = PreTransaction -# SIGPIPE workaround. See FS#49816 -#Exec = /usr/lib/dkms/alpm-hook remove -Exec = /usr/bin/perl -e "$SIG{PIPE}='DEFAULT'; exec('/usr/lib/dkms/alpm-hook', 'remove');" -NeedsTargets Copied: dkms/repos/extra-any/hook.remove (from rev 366395, dkms/repos/testing-any/hook.remove) =================================================================== --- extra-any/hook.remove (rev 0) +++ extra-any/hook.remove 2019-11-01 14:58:20 UTC (rev 366396) @@ -0,0 +1,16 @@ +[Trigger] +Operation = Upgrade +Operation = Remove +Type = File +Target = usr/src/*/dkms.conf +Target = usr/lib/modules/*/build/include/ +Target = usr/lib/modules/*/modules.alias + +[Action] +Description = Remove DKMS modules +Depends = dkms +When = PreTransaction +# SIGPIPE workaround. See FS#49816 +#Exec = /usr/lib/dkms/alpm-hook remove +Exec = /usr/bin/perl -e "$SIG{PIPE}='DEFAULT'; exec('/usr/lib/dkms/alpm-hook', 'remove');" +NeedsTargets Deleted: extra-any/hook.sh =================================================================== --- extra-any/hook.sh 2019-11-01 14:22:35 UTC (rev 366395) +++ extra-any/hook.sh 2019-11-01 14:58:20 UTC (rev 366396) @@ -1,194 +0,0 @@ -#!/bin/bash - -# -# Copyright © 2018 Sébastien Luttringer -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -# display what to run and run it quietly -run() { - echo "==> $*" - "$@" > /dev/null -} - -# check whether the dependencies of a module are installed -# $1: module name/module version -# $2: kernel version -check_dependency() { ( - source "$source_tree/${1/\//-}/dkms.conf" - for dep in "${BUILD_DEPENDS[@]}"; do - if ! [[ "$(dkms status -m "$dep" -k "$2")" =~ :[[:space:]]installed$ ]]; then - exit 1 - fi - done - exit 0 -) } - -# check whether the modules should be built with this kernel version -# $1: module name/module version -# $2: kernel version -check_buildexclusive() { - local BUILD_EXCLUSIVE_KERNEL=$(source "$source_tree/${1/\//-}/dkms.conf"; printf '%s\n' "$BUILD_EXCLUSIVE_KERNEL") - [[ "$2" =~ $BUILD_EXCLUSIVE_KERNEL ]] -} - -# handle actions on module addition/upgrade/removal -# $1: module name -# $2: module version -parse_module() { - pushd "$install_tree" >/dev/null - local path - for path in */build/; do - local kver="${path%%/*}" - dkms_register "$1" "$2" "$kver" - done - popd >/dev/null -} - -# handle actions on kernel addition/upgrade/removal -# $1: kernel version -parse_kernel() { - local path - for path in "$source_tree"/*-*/dkms.conf; do - if [[ -f "$path" && "$path" =~ ^$source_tree/([^/]+)-([^/]+)/dkms\.conf$ ]]; then - dkms_register "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}" "$1" - fi - done -} - -# register a dkms module to install/remove -# this function suppress echo call for a module -# $1: module name, $2: module version, $3: kernel version -dkms_register() { - DKMS_MODULES["$1/$2/$3"]='' -} - -# install registered modules -dkms_install() { - local nvk mod kver - local -i retry=1 - - while (( $retry > 0 )); do - retry=0 - for nvk in "${!DKMS_MODULES[@]}"; do - mod=${nvk%/*} - kver=${nvk##*/} - # do not build excluded modules - if ! check_buildexclusive "$mod" "$kver"; then - unset DKMS_MODULES[$nvk] - continue - # skip modules with missing kernel headers - elif [[ ! -d "$install_tree/$kver/build/include" ]]; then - DKMS_MODULES[$nvk]="Missing kernel headers" - continue - # skip modules with missing kernel package - elif [[ ! -d "$install_tree/$kver/kernel" ]]; then - DKMS_MODULES[$nvk]="Missing kernel modules tree" - continue - # postpone modules with missing dependencies - elif ! check_dependency "$mod" "$kver"; then - DKMS_MODULES[$nvk]="Missing dependency" - continue - fi - # give it a try dkms - run dkms install "$mod" -k "$kver" - unset DKMS_MODULES[$nvk] - # maybe this module was a dep of another, so we retry - retry=1 - done - done -} - -# remove registered modules when built/installed -dkms_remove() { - local nvk mod kver - for nvk in "${!DKMS_MODULES[@]}"; do - mod=${nvk%/*} - kver=${nvk##*/} - state=$(dkms status -m "$mod" -k "$kver") - if [[ "$state" =~ :[[:space:]](built|installed)$ ]]; then - run dkms remove "$mod" -k "$kver" - fi - unset DKMS_MODULES[$nvk] - done -} - -# show information about failed modules -show_errors() { - local nvk mod kver - for nvk in "${!DKMS_MODULES[@]}"; do - mod=${nvk%/*} - kver=${nvk##*/} - echo "==> Unable to $DKMS_ACTION module $mod for kernel $kver: ${DKMS_MODULES[$nvk]}." - done -} - -# emulated program entry point -main() { - [[ -n "$DKMS_ALPM_HOOK_DEBUG" ]] && set -x - - # prevent each dkms call from failing with authorization errors - if (( EUID )); then - echo 'You must be root to use this hook' >&2 - exit 1 - fi - - # register DKMS action - case "$1" in - install|remove) - declare -r DKMS_ACTION="$1" - ;; - *) - echo "usage: ${0##*/} install|remove" >&2 - exit 1 - ;; - esac - - # dkms path from framework config - # note: the alpm hooks which trigger this script use static path - source_tree='/usr/src' - install_tree='/usr/lib/modules' - source /etc/dkms/framework.conf - - # check source_tree and install_tree exists - local path - for path in "$source_tree" "$install_tree"; do - if [[ ! -d "$path" ]]; then - echo "==> Missing mandatory directory: $path. Exiting!" - return 1 - fi - done - - # storage for DKMS modules to install/remove - # we use associate arrays to prevent duplicate - declare -A DKMS_MODULES - - # parse stdin paths to guess what do do - while read -r path; do - if [[ "/$path" =~ ^$source_tree/([^/]+)-([^/]+)/dkms\.conf$ ]]; then - parse_module "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}" - elif [[ "/$path" =~ ^$install_tree/([^/]+)/ ]]; then - parse_kernel "${BASH_REMATCH[1]}" - fi - done - - dkms_$DKMS_ACTION - - show_errors - - return 0 -} - -main "$@" Copied: dkms/repos/extra-any/hook.sh (from rev 366395, dkms/repos/testing-any/hook.sh) =================================================================== --- extra-any/hook.sh (rev 0) +++ extra-any/hook.sh 2019-11-01 14:58:20 UTC (rev 366396) @@ -0,0 +1,194 @@ +#!/bin/bash + +# +# Copyright © 2018 Sébastien Luttringer +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# display what to run and run it quietly +run() { + echo "==> $*" + "$@" > /dev/null +} + +# check whether the dependencies of a module are installed +# $1: module name/module version +# $2: kernel version +check_dependency() { ( + source "$source_tree/${1/\//-}/dkms.conf" + for dep in "${BUILD_DEPENDS[@]}"; do + if ! [[ "$(dkms status -m "$dep" -k "$2")" =~ :[[:space:]]installed$ ]]; then + exit 1 + fi + done + exit 0 +) } + +# check whether the modules should be built with this kernel version +# $1: module name/module version +# $2: kernel version +check_buildexclusive() { + local BUILD_EXCLUSIVE_KERNEL=$(source "$source_tree/${1/\//-}/dkms.conf"; printf '%s\n' "$BUILD_EXCLUSIVE_KERNEL") + [[ "$2" =~ $BUILD_EXCLUSIVE_KERNEL ]] +} + +# handle actions on module addition/upgrade/removal +# $1: module name +# $2: module version +parse_module() { + pushd "$install_tree" >/dev/null + local path + for path in */build/; do + local kver="${path%%/*}" + dkms_register "$1" "$2" "$kver" + done + popd >/dev/null +} + +# handle actions on kernel addition/upgrade/removal +# $1: kernel version +parse_kernel() { + local path + for path in "$source_tree"/*-*/dkms.conf; do + if [[ -f "$path" && "$path" =~ ^$source_tree/([^/]+)-([^/]+)/dkms\.conf$ ]]; then + dkms_register "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}" "$1" + fi + done +} + +# register a dkms module to install/remove +# this function suppress echo call for a module +# $1: module name, $2: module version, $3: kernel version +dkms_register() { + DKMS_MODULES["$1/$2/$3"]='' +} + +# install registered modules +dkms_install() { + local nvk mod kver + local -i retry=1 + + while (( $retry > 0 )); do + retry=0 + for nvk in "${!DKMS_MODULES[@]}"; do + mod=${nvk%/*} + kver=${nvk##*/} + # do not build excluded modules + if ! check_buildexclusive "$mod" "$kver"; then + unset DKMS_MODULES[$nvk] + continue + # skip modules with missing kernel headers + elif [[ ! -d "$install_tree/$kver/build/include" ]]; then + DKMS_MODULES[$nvk]="Missing kernel headers" + continue + # skip modules with missing kernel package + elif [[ ! -d "$install_tree/$kver/kernel" ]]; then + DKMS_MODULES[$nvk]="Missing kernel modules tree" + continue + # postpone modules with missing dependencies + elif ! check_dependency "$mod" "$kver"; then + DKMS_MODULES[$nvk]="Missing dependency" + continue + fi + # give it a try dkms + run dkms install "$mod" -k "$kver" + unset DKMS_MODULES[$nvk] + # maybe this module was a dep of another, so we retry + retry=1 + done + done +} + +# remove registered modules when built/installed +dkms_remove() { + local nvk mod kver + for nvk in "${!DKMS_MODULES[@]}"; do + mod=${nvk%/*} + kver=${nvk##*/} + state=$(dkms status -m "$mod" -k "$kver") + if [[ "$state" =~ :[[:space:]](built|installed)$ ]]; then + run dkms remove "$mod" -k "$kver" + fi + unset DKMS_MODULES[$nvk] + done +} + +# show information about failed modules +show_errors() { + local nvk mod kver + for nvk in "${!DKMS_MODULES[@]}"; do + mod=${nvk%/*} + kver=${nvk##*/} + echo "==> Unable to $DKMS_ACTION module $mod for kernel $kver: ${DKMS_MODULES[$nvk]}." + done +} + +# emulated program entry point +main() { + [[ -n "$DKMS_ALPM_HOOK_DEBUG" ]] && set -x + + # prevent each dkms call from failing with authorization errors + if (( EUID )); then + echo 'You must be root to use this hook' >&2 + exit 1 + fi + + # register DKMS action + case "$1" in + install|remove) + declare -r DKMS_ACTION="$1" + ;; + *) + echo "usage: ${0##*/} install|remove" >&2 + exit 1 + ;; + esac + + # dkms path from framework config + # note: the alpm hooks which trigger this script use static path + source_tree='/usr/src' + install_tree='/usr/lib/modules' + source /etc/dkms/framework.conf + + # check source_tree and install_tree exists + local path + for path in "$source_tree" "$install_tree"; do + if [[ ! -d "$path" ]]; then + echo "==> Missing mandatory directory: $path. Exiting!" + return 1 + fi + done + + # storage for DKMS modules to install/remove + # we use associate arrays to prevent duplicate + declare -A DKMS_MODULES + + # parse stdin paths to guess what do do + while read -r path; do + if [[ "/$path" =~ ^$source_tree/([^/]+)-([^/]+)/dkms\.conf$ ]]; then + parse_module "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}" + elif [[ "/$path" =~ ^$install_tree/([^/]+)/ ]]; then + parse_kernel "${BASH_REMATCH[1]}" + fi + done + + dkms_$DKMS_ACTION + + show_errors + + return 0 +} + +main "$@"