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/
  • 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
run_with_expected_output dkms install -k "${KERNEL_VER}" -m dkms_patches_test -v 1.0 << EOF
${SIGNING_PROLOGUE}
Applying patch patch1.patch... done.
Applying patch subdir/patch2.patch... done.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm assuming /etc/dkms/<module>/patches/subdir/patch2.patch overrides the system subdir/patch2.patch? Meaning the subdir is also respected and checked? I wonder if the test should be reversed? Seems like more of a nitpick though.

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/

2 participants