blob: 9650ef4b2d53c52924f68b7bcdd54c55bab35565 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#!/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.
#######################################################################
# if the package contains any files in /usr/share/applications/, they
# must be named *.desktop, must pass desktop-file-validate, and must
# be mode 644, owner root:root.
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
[ -e "$f" ] || continue
[ "$f" = "usr/share/applications/mimeinfo.cache" ] && continue
[ "$( stat -Lc '%a %U %G' "$f" )" = "644 root root" ] || BADPERMS+="$f "
case "$f" in
*.desktop) desktop-file-validate "$f" || BADDESKTOP+="$f " ;;
*) NONDESKTOP+="$f " ;;
esac
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
|