Skip to content

Allow patches, scripts and overrides in /etc/dkms#583

Open
scaronni wants to merge 1 commit intodkms-project:mainfrom
scaronni:patches_and_scripts_in_etc
Open

Allow patches, scripts and overrides in /etc/dkms#583
scaronni wants to merge 1 commit intodkms-project:mainfrom
scaronni:patches_and_scripts_in_etc

Conversation

@scaronni
Copy link
Member

@scaronni scaronni commented Mar 11, 2026

Resolves #562.

Overrides in /etc/dkms:

  • Patches declared with the PATCH[#] directives, can now:
    • Reside in /etc/dkms/<module>/patches/
    • Be overridden by a patch with the same name in /etc/dkms/<module>/patches/
    • As before, the directory structure is preserved, as the whole patches directory is copied.
  • Scripts declared with POST_ADD, PRE_BUILD, POST_BUILD, PRE_INSTALL, POST_INSTALL and POST_REMOVE can now:
    • Reside in /etc/dkms/<module>/
    • Be overridden by a script with the same name in /etc/dkms/<module>/

Examples

Overriding a patch

Original:

$ ls -l /usr/src/gasket-1.0/my.patch
-rw-r--r--. 1 root root 2909 Mar  5 01:00 /usr/src/gasket-1.0/my.patch
$ cat /usr/src/gasket-1.0/dkms.conf
PATCH[0]="my.patch"

Override:

$ ls -l /etc/dkms/gasket/patches/my.patch
-rw-r--r--. 1 root root 2828 Mar 16 01:00 /etc/dkms/gasket/patches/my.patch

New local patch

Adding a new local patch that survives across DKMS module upgrades:

$ ls -l /etc/dkms/cxr88/patches/local.patch
-rw-r--r--. 1 root root 2834 Mar 19 01:00 /etc/dkms/cxr88/patches/local.patch
$ cat /etc/dkms/cxr88.conf
PATCH[0]="local.patch"

New post script

Adding a new post script that survives across DKMS module upgrades:

$ ls -l /etc/dkms/nvidia/scripts/reload-nvidia-peermem.sh
-rw-r--r--. 1 root root 2834 Mar 19 01:00 /etc/dkms/nvidia/scripts/reload-nvidia-peermem.sh
$ cat /etc/dkms/nvidia.conf
POST_INSTALL="reload-nvidia-peermem.sh"

@scaronni scaronni requested review from anbe42 and zeroepoch and removed request for zeroepoch March 11, 2026 10:57
@scaronni
Copy link
Member Author

scaronni commented Mar 11, 2026

@cyqsimon can I get some feedback? To test:

$ git clone https://github.com/scaronni/dkms.git
$ cd dkms
$ git checkout patches_and_scripts_in_etc
$ make
$ sudo cp dkms $(which dkms)

@scaronni scaronni added this to the 3.3.1 milestone Mar 11, 2026
@scaronni scaronni force-pushed the patches_and_scripts_in_etc branch from 02e53f5 to b25e4ee Compare March 16, 2026 07:40
@scaronni scaronni requested a review from amilonenv March 16, 2026 12:24
Copy link
Collaborator

@amilonenv amilonenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@scaronni
Copy link
Member Author

@cyqsimon any chance for some feedback?

@cyqsimon
Copy link

Please forgive me for the slow response; some minor personal health issues these couple of days is limiting my free time and energy.

If you are in a rush please proceed with the merge. Otherwise I will take a look later tonight or perhaps tomorrow.

@scaronni
Copy link
Member Author

@cyqsimon I'll wait until the end of the week, no problem. Take care!

@cyqsimon
Copy link

This PR is much more feature-rich than my needs. I only need the simple "new patches in /etc feature", so that's all I've tested. And so far everything seems to work great.

Thanks all for the effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat. req.] Support patches and scripts in /etc/dkms/

4 participants