diff options
author | B. Watson <yalhcru@gmail.com> | 2022-04-04 14:07:14 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2022-04-04 14:07:14 -0400 |
commit | 533599f74e56dc42bdac215e2d152f9769b6b56e (patch) | |
tree | 9a8d349d138937a7c2880589ae16078b68f4009e /sbopkglint.d/10-docs.t.sh | |
download | sbo-maintainer-tools-533599f74e56dc42bdac215e2d152f9769b6b56e.tar.gz |
initial commit
Diffstat (limited to 'sbopkglint.d/10-docs.t.sh')
-rw-r--r-- | sbopkglint.d/10-docs.t.sh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/sbopkglint.d/10-docs.t.sh b/sbopkglint.d/10-docs.t.sh new file mode 100644 index 0000000..e1bb8d8 --- /dev/null +++ b/sbopkglint.d/10-docs.t.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# sbopkglint test, must be sourced by sbopkglint (not run standalone). + +# PKG, PRGNAM, VERSION, ARCH are set by sbopkglint. also the current +# directory is the root of the installed package tree. + +######################################################################## +# checks file permissions and ownership in the package doc dir. files +# should all be mode 644, directories should be 755. everything should +# be owned by root:root. also checks for empty files or (possibly) +# install instructions. + + +# ideally, we'd require all files under the doc dir to be mode 0644. +# however, too many existing packages (including core Slackware ones) +# break that rule. so check for the minimum set of desired permissions: +# a doc file should be readable by all users (at least 444). + +DOCDIR=usr/doc/$PRGNAM-$VERSION + +# existence of the doc dir was already checked by a previous test, +# so just don't do anything if it's missing. + +if [ -d "$DOCDIR" ]; then + badpermfiles="$( find $DOCDIR -mindepth 1 -type f -a \! -perm -444 )" + badpermdirs="$( find $DOCDIR -mindepth 1 -type d -a \! -perm 0755 )" + badowners="$( find $DOCDIR -mindepth 1 -user root -a -group root -o -print )" + empty="$( find $DOCDIR -mindepth 1 -empty )" + bogus="$( find $DOCDIR -mindepth 1 -maxdepth 1 -type f -a \( -name INSTALL -o -name INSTALL.\* \) )" + + [ -n "$badpermfiles" ] && warn "bad file perms (should be 644, or at least 444) in doc dir:" && ls -l $badpermfiles + [ -n "$badpermdirs" ] && warn "bad directory perms (should be 755) in doc dir:" && ls -ld $badpermdirs + [ -n "$badowners" ] && warn "bad ownership (should be root:root) in doc dir:" && ls -ld $badowners + [ -n "$empty" ] && warn "empty files/dirs in doc dir: $empty" + [ -n "$bogus" ] && [ -z "$INSTALL_DOCS_OK" ] && warn "useless-looking install instructions in doc dir: $bogus" +fi + +baddocs="$( find usr/doc -mindepth 1 -maxdepth 1 \! -name $PRGNAM-$VERSION )" +[ -n "$baddocs" ] && warn "docs outside of $DOCDIR:" && ls -ld $baddocs |