From 8e6767e6b3ededeaf456ce4eca6e8230ff23118c Mon Sep 17 00:00:00 2001 From: Yasuhiro Kimura Date: Sat, 2 Mar 2024 01:31:39 +0900 Subject: [PATCH] security/gnupg: Fix @postexec/@postunexec commands in pkg-plist * Chase move of man pages to share/man. ...(1) * There is following description in the man page of pkg-script(5). In the particular case of an upgrade the scripts are run in the following order: 1. new pre-install 2. old pre-deinstall 3. replace binaries 4. new post-install It means @postunexec command isn't executed when package is upgraded with `pkg upgrade`. So replace @postunexec with @preunexec. * Use '-L' primary of test(1) command to check if the file exists and it is symbolic link. * Fix the logic to check if symbolic link exists and remove it if it does. * As is explained above @postunexec command isn't executed when package is upgraded with `pkg upgrade`. As a result ${PREFIX}/man/man1/gpg.1.gz symlink isn't removed when current version of installed package is upgraded with `pkg upgrade`. So add @preexec command to remove the symlink if it exist. PR: 276990 Proposed by: Martin Neubauer (1) Fixes: e81d10224315. --- security/gnupg/Makefile | 1 + security/gnupg/pkg-plist | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/security/gnupg/Makefile b/security/gnupg/Makefile index 3f4bbc68f93d..c14d3a78de16 100644 --- a/security/gnupg/Makefile +++ b/security/gnupg/Makefile @@ -1,5 +1,6 @@ PORTNAME= gnupg DISTVERSION= 2.4.4 +PORTREVISION= 1 CATEGORIES= security MASTER_SITES= GNUPG diff --git a/security/gnupg/pkg-plist b/security/gnupg/pkg-plist index 4a1bb5dccf6b..657a01dd8b02 100644 --- a/security/gnupg/pkg-plist +++ b/security/gnupg/pkg-plist @@ -122,6 +122,8 @@ sbin/applygnupgdefaults %%NLS%%share/locale/zh_CN/LC_MESSAGES/gnupg2.mo %%NLS%%share/locale/zh_TW/LC_MESSAGES/gnupg2.mo @postexec [ -e %D/bin/gpg ] || ln -sf gpg2 %D/bin/gpg -@postunexec [ -e %D/bin/gpg ] || rm -f %D/bin/gpg -@postexec [ -e %D/man/man1/gpg.1.gz ] || ln -sf gpg2.1.gz %D/man/man1/gpg.1.gz -@postunexec [ -e %D/man/man1/gpg.1.gz ] || rm -f %D/man/man1/gpg.1.gz +@preunexec if [ -L %D/bin/gpg ]; then rm -f %D/bin/gpg; fi +@comment Following line is necessary to remove stale ${PREFIX}/man/man1/gpg.1.gz symlink created by previous version +@preexec if [ -L %D/man/man1/gpg.1.gz ]; then rm -f %D/man/man1/gpg.1.gz; fi +@postexec [ -e %D/share/man/man1/gpg.1.gz ] || ln -sf gpg2.1.gz %D/share/man/man1/gpg.1.gz +@preunexec if [ -L %D/share/man/man1/gpg.1.gz ]; then rm -f %D/share/man/man1/gpg.1.gz; fi -- 2.44.0