From c06512eac91d82a9833b3421043fdfcef548c967 Mon Sep 17 00:00:00 2001 From: maxice8 Date: Mon, 7 Jan 2019 17:05:15 -0200 Subject: [PATCH] hooks: Add hook to check for ELF files in /usr/share --- .../11-pkglint-elf-in-usrshare.sh | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 common/hooks/post-install/11-pkglint-elf-in-usrshare.sh diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh new file mode 100644 index 00000000000..a1cea83d99d --- /dev/null +++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh @@ -0,0 +1,30 @@ +# vim: set ts=4 sw=4 et: +# +# This hook executes the following tasks: +# - Looks on all packages for binary files being installed to /usr/share + +hook() { + local matches + + if [ ! -d ${PKGDESTDIR}/usr/share ]; then + return 0 + fi + + # Find all binaries in /usr/share and add them to the pool + for f in $(find $PKGDESTDIR/usr/share -type f); do + case "$(file -bi "$f")" in + application/x-sharedlib*|application/x-pie-executable*) + matches+=" ${f#$PKGDESTDIR}" ;; + esac + done + + if [ -z "$matches" ]; then + return 0 + fi + + msg_red "${pkgver}: ELF files found in /usr/share:\n" + for f in $matches; do + msg_red " ${f}\n" + done + msg_error "${pkgver}: cannot continue with installation!\n" +}