[pve-devel] [PATCH zfsonlinux 09/16] Adjust zed.d symlink-preservation
Stoiko Ivanov
s.ivanov at proxmox.com
Thu Jun 17 15:52:16 CEST 2021
Closes BTS#983401.
- Overwrite dangling symlinks on install
- Does not clobber symlinks on removal
Signed-off-by: Antonio Russo <aerusso at aerusso.net>
(cherry picked from commit b024d59f5976ea75ac9a0b48612b7032d24513ee)
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
debian/zfs-zed.postinst | 2 +-
debian/zfs-zed.prerm | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/debian/zfs-zed.postinst b/debian/zfs-zed.postinst
index 93325438..a615eec9 100644
--- a/debian/zfs-zed.postinst
+++ b/debian/zfs-zed.postinst
@@ -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
diff --git a/debian/zfs-zed.prerm b/debian/zfs-zed.prerm
index fca0f4a7..b8340df5 100644
--- a/debian/zfs-zed.prerm
+++ b/debian/zfs-zed.prerm
@@ -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
--
2.20.1
More information about the pve-devel
mailing list