aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2023-05-30 05:10:30 -0400
committerB. Watson <urchlay@slackware.uk>2023-05-30 05:10:30 -0400
commitb32fed5e41ba86761853342b88b12121f64bfe0a (patch)
tree6dee09f4db306a5a704b241c0cb28b7de1861cb2
parenta95ed98278a52764449fa89c3ce30b7bec1d3df1 (diff)
downloadsbo-maintainer-tools-b32fed5e41ba86761853342b88b12121f64bfe0a.tar.gz
sbopkglint: check for slack-desc, fail on unknown /usr/<whatever> dirs.
-rw-r--r--sbopkglint.d/05-basic-sanity.t.sh26
-rw-r--r--sbopkglint.d/pre-doinst.sh2
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"