aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbopkglint.d/10-docs.t.sh37
1 files changed, 20 insertions, 17 deletions
diff --git a/sbopkglint.d/10-docs.t.sh b/sbopkglint.d/10-docs.t.sh
index 9fbcbd7..f99a42a 100644
--- a/sbopkglint.d/10-docs.t.sh
+++ b/sbopkglint.d/10-docs.t.sh
@@ -28,25 +28,28 @@ DOCDIR=usr/doc/$PRGNAM-$VERSION
# 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 -maxdepth 1 -empty )"
- bogus="$( find $DOCDIR -mindepth 1 -maxdepth 1 -type f -a \( -name INSTALL -o -name INSTALL.\* \) )"
+ find_warnfiles "bad file perms (should be 644, or at least 444) in doc dir:" \
+ $DOCDIR -mindepth 1 -type f -a \! -perm -444
+ find_warnfiles "bad directory perms (should be 755) in doc dir:" \
+ $DOCDIR -mindepth 1 -type d -a \! -perm 0755
+ find_warnfiles "bad ownership (should be root:root) in doc dir:" \
+ $DOCDIR -mindepth 1 \! \( -user root -a -group root \)
+ find_warnfiles "empty files/dirs in doc dir:" \
+ $DOCDIR -mindepth 1 -maxdepth 1 -empty
- files="$( find $DOCDIR -type f -perm /111 )"
- for f in $files; do
- head -1 $f | grep -q '^#!' && continue; # script file, +x is OK
- badpermfiles+=" $f"
+ # 20230616 bkw: this handles spaces in filenames, but it will choke on
+ # embedded backslashes. doubt that will be a real problem.
+ find $DOCDIR -type f -perm /111 -print | while read f; do
+ head -1 "$f" | grep -q '^#!' && continue; # script file, +x is OK
+ ls -ld "$f" >> .bad.$$
done
- [ -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"
+ [ -s .bad.$$ ] && warn "bad file perms (should be 644, or at least 444) in doc dir:" && cat .bad.$$
+ rm -f .bad.$$
- if [ -z "$INSTALL_DOCS_OK" -a -n "$bogus" ]; then
- for i in $bogus; do
+ if [ -z "$INSTALL_DOCS_OK" ]; then
+ for i in $DOCDIR/INSTALL*; do
+ [ -e "$i" ] || continue
if grep -q 'generic installation instructions' $i || \
grep -q 'instructions are generic' $i
then
@@ -77,5 +80,5 @@ fi
# allow /usr/doc/HTML to exist, though we don't check its contents here.
# this is the standard location for KDE5 help files.
-baddocs="$( find usr/doc -mindepth 1 -maxdepth 1 \! -name $PRGNAM-$VERSION \! -name HTML )"
-[ -n "$baddocs" ] && warn "docs outside of $DOCDIR:" && ls -ld $baddocs
+find_warnfiles "docs outside of $DOCDIR:" \
+ usr/doc -mindepth 1 -maxdepth 1 \! -name $PRGNAM-$VERSION \! -name HTML