summaryrefslogtreecommitdiff
path: root/emulators/compat_netbsd
diff options
context:
space:
mode:
authorhe <he@pkgsrc.org>2022-01-02 16:15:55 +0000
committerhe <he@pkgsrc.org>2022-01-02 16:15:55 +0000
commit0a597d9dea78a8c7ee96554f6d772d549baccade (patch)
tree50da0bea3162f4ce1c02d11b687f74ef145e743e /emulators/compat_netbsd
parentef3fa307bdae045a6378526e577c77ef19fc1108 (diff)
downloadpkgsrc-0a597d9dea78a8c7ee96554f6d772d549baccade.tar.gz
Don't just remove a symlink on removal, ensure that it points
to an expected name before doing so. Should prevent removal of required symlinks which might otherwise happen when this package by accident is instsalled and subsequently de-installed on 9.0 - 9.2 or other netbsd-9 variants. Parts of fix for PR#56597.
Diffstat (limited to 'emulators/compat_netbsd')
-rw-r--r--emulators/compat_netbsd/INSTALL.ELF13
1 files changed, 10 insertions, 3 deletions
diff --git a/emulators/compat_netbsd/INSTALL.ELF b/emulators/compat_netbsd/INSTALL.ELF
index 69d6a7bde2d..7a9de3c71e2 100644
--- a/emulators/compat_netbsd/INSTALL.ELF
+++ b/emulators/compat_netbsd/INSTALL.ELF
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL.ELF,v 1.2 2013/02/17 10:34:31 spz Exp $
+# $NetBSD: INSTALL.ELF,v 1.3 2022/01/02 16:15:55 he Exp $
# Generate a +ROOT_ACTIONS script that runs certain actions that require
# superuser privileges.
@@ -83,8 +83,15 @@ REMOVE,0)
esac
if ${TEST} -h "$dst"; then
- ${ECHO} "${PKGNAME}: removing $dst"
- ${RM} -f "$dst"
+ lsrc=$(readlink $dst)
+ if [ "$lsrc" = ${PKG_PREFIX}/$src -o \
+ "$lsrc" = $src ]
+ then
+ ${ECHO} "${PKGNAME}: removing $dst"
+ ${RM} -f "$dst"
+ else
+ ${ECHO} "${PKGNAME}: mismatched symlink, skipping removal of $dst"
+ fi
fi
done
${RM} -f ${ROOT_ACTIONS_COOKIE}