2019-01-07 20:05:15 +01:00
|
|
|
# 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
|
2020-07-16 19:44:01 +02:00
|
|
|
# - Allows exceptions listed in $ignore_elf_files and $ignore_elf_dirs
|
2019-01-07 20:05:15 +01:00
|
|
|
|
|
|
|
hook() {
|
2020-07-16 19:44:01 +02:00
|
|
|
local matches mime file f prune_expr dir
|
2019-01-07 20:05:15 +01:00
|
|
|
|
|
|
|
if [ ! -d ${PKGDESTDIR}/usr/share ]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
2020-07-16 19:44:01 +02:00
|
|
|
if [ "${ignore_elf_dirs}" ]; then
|
|
|
|
for dir in ${ignore_elf_dirs}; do
|
|
|
|
if ! [ "${prune_expr}" ]; then
|
|
|
|
prune_expr="( -path ${PKGDESTDIR}${dir}"
|
|
|
|
else
|
|
|
|
prune_expr+=" -o -path ${PKGDESTDIR}${dir}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
prune_expr+=" ) -prune -o "
|
|
|
|
fi
|
|
|
|
|
2019-01-07 20:05:15 +01:00
|
|
|
# Find all binaries in /usr/share and add them to the pool
|
2019-01-10 03:40:54 +01:00
|
|
|
while read -r f; do
|
2022-09-03 15:30:51 +02:00
|
|
|
mime="${f##*: }"
|
2020-06-29 21:30:37 +02:00
|
|
|
file="${f%:*}"
|
2020-07-16 19:44:01 +02:00
|
|
|
file="${file#${PKGDESTDIR}}"
|
2020-06-29 21:30:37 +02:00
|
|
|
case "${mime}" in
|
2020-08-04 22:28:14 +02:00
|
|
|
application/x-sharedlib*|\
|
|
|
|
application/x-pie-executable*|\
|
|
|
|
application/x-executable*)
|
2020-07-16 19:44:01 +02:00
|
|
|
if [[ ${ignore_elf_files} != *"${file}"* ]]; then
|
|
|
|
matches+=" ${file}"
|
|
|
|
fi
|
|
|
|
;;
|
2019-01-07 20:05:15 +01:00
|
|
|
esac
|
2022-09-03 15:30:51 +02:00
|
|
|
done < <(find $PKGDESTDIR/usr/share $prune_expr -type f | file --no-pad --mime-type --files-from -)
|
2019-01-07 20:05:15 +01:00
|
|
|
|
2020-07-16 19:44:01 +02:00
|
|
|
# Check passed if no packages in pool
|
2019-01-07 20:05:15 +01:00
|
|
|
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"
|
|
|
|
}
|