Preserve /etc/zfs/zed.d configuration on upgrade
Of the zedlet scripts shipped by upstream, a subset are enabled by default, by creating symlinks in /etc/zfs/zed.d. These symlinks are shipped in the zfs-zed package. dpkg, however, does not support conffile handling of symlinks, and therefore any changes (removals) to the symlinks are not preserved on package upgrade.
To address this policy violation, we:
- During package build, create a list of enabled-by-default zedlets, instead of creating symlinks.
- On package removal, identify all enabled-by-default zedlets whose symlinks do not exist (i.e., were removed by the user). This is done by creating "whiteout" links to /dev/null in their place).
- On package installation, create links to enabled-by-default zedlets UNLESS there is already a file there (i.e., abort if there is a whiteout link).
- We also clean up broken symlinks to removed zedlets at package postinst.