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>
This commit is contained in:
Stoiko Ivanov 2021-06-17 15:52:16 +02:00 committed by Fabian Grünbichler
parent 53b89f82e3
commit 85fab4fe16
2 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ etcd="/etc/zfs/zed.d"
while read -r file ; do
etcfile="${etcd}/${file}"
[ -e "${etcfile}" ] && continue
ln -s "${zedd}/${file}" "${etcfile}"
ln -sfT "${zedd}/${file}" "${etcfile}"
done < "${zedd}/DEFAULT-ENABLED"
# remove the overrides created in prerm

View File

@ -7,8 +7,8 @@ etcd="/etc/zfs/zed.d"
if [ "$1" != "failed-upgrade" ] && [ -d "${etcd}" ] && [ -d "${zedd}" ] ; then
while read -r file ; do
etcfile="${etcd}/${file}"
[ -e "${etcfile}" ] && continue
ln -s /dev/null "${etcfile}"
( [ -L "${etcfile}" ] || [ -e "${etcfile}" ] ) && continue
ln -sT /dev/null "${etcfile}"
done < "${zedd}/DEFAULT-ENABLED"
fi