zfsonlinux/debian/zfs-zed.postinst
Stoiko Ivanov 85fab4fe16 Adjust zed.d symlink-preservation
Closes BTS#983401.

 - Overwrite dangling symlinks on install
 - Does not clobber symlinks on removal

Signed-off-by: Antonio Russo <aerusso@aerusso.net>
(cherry picked from commit b024d59f5976ea75ac9a0b48612b7032d24513ee)
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2021-06-18 15:25:41 +02:00

21 lines
511 B
Bash

#!/bin/sh
set -e
zedd="/usr/lib/zfs-linux/zed.d"
etcd="/etc/zfs/zed.d"
# enable all default zedlets that are not overridden
while read -r file ; do
etcfile="${etcd}/${file}"
[ -e "${etcfile}" ] && continue
ln -sfT "${zedd}/${file}" "${etcfile}"
done < "${zedd}/DEFAULT-ENABLED"
# remove the overrides created in prerm
find "${etcd}" -maxdepth 1 -lname '/dev/null' -delete
# remove any dangling symlinks to old zedlets
find "${etcd}" -maxdepth 1 -lname "${zedd}/*" -xtype l -delete
#DEBHELPER#