HomeFreeBSD

zfs-dkms rpm: simplify scriptlets, fix uninstall

Description

zfs-dkms rpm: simplify scriptlets, fix uninstall

Two problems led to unexpected behaviour of the scriptlets:

  1. Newer DKMS versions change the formatting of "dkms status": (old) zfs, 2.1.2, 5.14.10-300.fc35.x86_64, x86_64: installed (new) zfs/2.1.2, 5.14.10-300.fc35.x86_64, x86_64: installed Which broke a conditional determining whether to uninstall.
  1. zfs_config.h not packaged properly, but was attempted to be read in the %preun scriptlet: CONFIG_H="/var/lib/dkms/zfs/2.1.2/*/*/zfs_config.h" Which broke the uninstallation of the module, which left behind a dangling symlink, which broke DKMS entirely with this error: Error! Could not locate dkms.conf file. File: /var/lib/dkms/zfs/2.1.1/source/dkms.conf does not exist.

This change attempts to simplify life by:

  • Avoiding parsing anything (less prone to future breakage)
  • Uses %posttrans instead of %post for module installation, because %post happens before %preun, while %posttrans happens afterwards
  • Unconditionally reinstall module on upgrade, which is less efficient but the trade-off is that it's more reliable

Alternative approaches could involve fixing the existing parsing bugs
or improving the logic, but this comes at the cost of complexity and
possible future bugs.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Jeremy Visser <jeremyvisser@google.com>
Closes #10463
Closes #13182

Details

Provenance
Jeremy Visser <jeremy.visser@gmail.com>Authored on Mar 28 2022, 4:55 PM
GitHub <noreply@github.com>Committed on Mar 28 2022, 4:55 PM
Parents
rG86690775b0a6: Linux 5.18 compat: replace genhd.h with blkdev.h includes
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rG063c83a853f5: zfs-dkms rpm: simplify scriptlets, fix uninstall (authored by Jeremy Visser <jeremy.visser@gmail.com>).Mar 28 2022, 4:55 PM