aboutsummaryrefslogtreecommitdiff
path: root/sbopkglint.d
diff options
context:
space:
mode:
Diffstat (limited to 'sbopkglint.d')
-rw-r--r--sbopkglint.d/35-desktop.t.sh23
1 files changed, 15 insertions, 8 deletions
diff --git a/sbopkglint.d/35-desktop.t.sh b/sbopkglint.d/35-desktop.t.sh
index 9650ef4..03f52de 100644
--- a/sbopkglint.d/35-desktop.t.sh
+++ b/sbopkglint.d/35-desktop.t.sh
@@ -13,14 +13,16 @@
BADPERMS=""
BADDESKTOP=""
NONDESKTOP=""
-if [ -d usr/share/applications ]; then
- # doinst.sh creates this, don't check here now that we have a doinst test.
- #[ -e "usr/share/applications/mimeinfo.cache" ] || warn "doinst.sh is missing update-desktop-database"
- for f in usr/share/applications/*; do
+check_desktop_dir() {
+ local dir="$1"
+ [ -d "$dir" ] || return
+
+ for f in $dir/*; do
[ -e "$f" ] || continue
[ "$f" = "usr/share/applications/mimeinfo.cache" ] && continue
+ [ "$f" = "usr/share/applications/screensavers" ] && continue
[ "$( stat -Lc '%a %U %G' "$f" )" = "644 root root" ] || BADPERMS+="$f "
case "$f" in
@@ -28,8 +30,13 @@ if [ -d usr/share/applications ]; then
*) NONDESKTOP+="$f " ;;
esac
done
+}
+
+for dir in usr/share/applications usr/share/applications/screensavers; do
+ check_desktop_dir "$dir"
+done
+
- [ -n "$BADPERMS" ] && warn "bad permissions/owner on .desktop files (should be 0644 root:root):" && ls -ld $BADPERMS
- [ -n "$BADDESKTOP" ] && warn ".desktop files fail to validate:" && ls -ld $BADDESKTOP
- [ -n "$NONDESKTOP" ] && warn "unknown file (not .desktop) in desktop dir:" && ls -ld $NONDESKTOP
-fi
+[ -n "$BADPERMS" ] && warn "bad permissions/owner on .desktop files (should be 0644 root:root):" && ls -ld $BADPERMS
+[ -n "$BADDESKTOP" ] && warn ".desktop files fail to validate:" && ls -ld $BADDESKTOP
+[ -n "$NONDESKTOP" ] && warn "unknown file (not .desktop) in desktop dir:" && ls -ld $NONDESKTOP