From 7bd2eaea34a8329b5e146570ebee9b106c7e6ddf Mon Sep 17 00:00:00 2001 From: maxice8 Date: Thu, 6 Dec 2018 12:43:16 -0200 Subject: [PATCH] hooks/pre-pkg: deal with packages that install to /etc but should use /usr/lib some packages install stuff to places like /etc/udev/rules.d and /etc/modprobe.d. That is wrong, they should use their equivalents in /usr/lib. --- common/hooks/pre-pkg/99-pkglint.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/common/hooks/pre-pkg/99-pkglint.sh b/common/hooks/pre-pkg/99-pkglint.sh index f7934acebec..20b8fe799a9 100644 --- a/common/hooks/pre-pkg/99-pkglint.sh +++ b/common/hooks/pre-pkg/99-pkglint.sh @@ -13,10 +13,12 @@ hook() { error=1 fi done + if [ -d ${PKGDESTDIR}/usr/sbin ]; then msg_red "${pkgver}: /usr/sbin directory is not allowed, use /usr/bin.\n" error=1 fi + for f in sys dev home root run var/run tmp usr/lib64 usr/local; do if [ -d ${PKGDESTDIR}/${f} ]; then msg_red "${pkgver}: /${f} directory is not allowed, remove it!\n" @@ -39,6 +41,28 @@ hook() { error=1 fi + # Prevent packages from installing to these paths in etc, they should use + # their equivalent in usr/lib + for f in udev/{rules.d,hwdb.d} modprobe.d sysctl.d; do + if [ -d ${PKGDESTDIR}/etc/${f} ]; then + msg_red "${pkgver}: /etc/${f} is forbidden. Use /usr/lib/${f}\n" + error=1 + fi + done + + # Likewise with the comment above but for usr/share + for f in X11/xorg.conf.d gconf/schemas; do + if [ -d ${PKGDESTDIR}/etc/${f} ]; then + msg_red "${pkgver}: /etc/${f} is forbidden. Use /usr/share/${f}\n" + error=1 + fi + done + + if [ -d ${PKGDESTDIR}/etc/dracut.conf.d ]; then + msg_red "${pkgver}: /etc/dracut.conf.d is forbidden. Use /usr/lib/dracut/dracut.conf.d\n" + error=1 + fi + # Forbid empty packages unless build_style=meta if [ "$build_style" != "meta" ]; then if [ "$(find $PKGDESTDIR/* -maxdepth 1 -type d 2>/dev/null)" = "" ]; then