From b32fed5e41ba86761853342b88b12121f64bfe0a Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 30 May 2023 05:10:30 -0400 Subject: sbopkglint: check for slack-desc, fail on unknown /usr/ dirs. --- sbopkglint.d/05-basic-sanity.t.sh | 26 +++++++++++++++++++++++--- sbopkglint.d/pre-doinst.sh | 2 ++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/sbopkglint.d/05-basic-sanity.t.sh b/sbopkglint.d/05-basic-sanity.t.sh index ae5d653..96bce44 100644 --- a/sbopkglint.d/05-basic-sanity.t.sh +++ b/sbopkglint.d/05-basic-sanity.t.sh @@ -15,12 +15,19 @@ topleveldirs="bin boot etc lib lib64 opt sbin srv usr var run" # these directories are *required* to exist, and must be mode 0755, root:root. # if a dir from this list exists but is empty, that's an error. note # that the install/ dir no longer exists by the time we run (installpkg -# deleted it already). +# deleted it already); slack-desc is checked by the pre-doinst test. requireddirs="usr/doc/$PRGNAM-$VERSION" +# these directories are the only ones allowed to exist directly under /usr. +# do not include X11R6 or local here, and do not include dirs which are +# symlinks on Slackware (X11 adm dict spool tmp). +# don't list (x86_64|i586|etc)-slackware-linux, it's checked separately. +usrdirs="bin doc games include info lib lib64 libexec man sbin share src x86_64-slackware-linux" + # these directories *must not* exist. no need to list top-level dirs here, -# the topleveldirs check already catches those. -baddirs="etc/ld.so.conf.d usr/local usr/share/doc usr/share/man usr/etc usr/share/info usr/X11 usr/X11R6 usr/man1 usr/man2 usr/man3 usr/man4 usr/man5 usr/man6 usr/man7 usr/man8 usr/man9 usr/manl usr/mann" +# the topleveldirs check already catches those. also, don't list stuff caught +# by the $usrdirs check (e.g. usr/local, usr/etc, usr/man1). +baddirs="etc/ld.so.conf.d usr/share/doc usr/share/man usr/share/info" # these directories may only contain files with +x permissions. in # other words, no non-executable files may live here. note that @@ -94,6 +101,19 @@ for i in *; do fi done +for i in usr/*; do + if [ -e "$i" ]; then + case "$i" in + *-slackware-linux) ;; # OK + *) + if ! echo "$usrdirs" | grep -q "\\<$( basename $i )\\>"; then + warn "nonstandard directory in /usr: $i" + fi + ;; + esac + fi +done + for i in $requireddirs; do if [ ! -d "$i" ]; then warn "missing required directory: $i" diff --git a/sbopkglint.d/pre-doinst.sh b/sbopkglint.d/pre-doinst.sh index d9c8ab7..523b21e 100644 --- a/sbopkglint.d/pre-doinst.sh +++ b/sbopkglint.d/pre-doinst.sh @@ -42,3 +42,5 @@ badlinks="$( find -P . -type l )" if [ -n "$badfontstuff" ]; then warn "package contains actual symlinks: $badlinks" fi + +[ -f install/slack-desc ] || warn "required file install/slack-desc is missing" -- cgit v1.2.3