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.
This commit is contained in:
maxice8 2018-12-06 12:43:16 -02:00 committed by maxice8
parent 14acd369eb
commit 7bd2eaea34
1 changed files with 24 additions and 0 deletions

View File

@ -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