blob: f5a55c6596eaac7946f221ad867407b9994f60fd (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# $NetBSD: check-perms.mk,v 1.1 2006/10/13 06:32:15 rillig Exp $
#
# This file checks that after installation of a package, all files and
# directories of that package have sensible permissions set.
#
# The following variables may be set by a package:
#
# The following variables may be set by the pkgsrc user in mk.conf:
#
# CHECK_PERMS: YesNo (default: yes for PKG_DEVELOPER, no otherwise)
# Specifies whether the permissions check should be run at all.
#
# CHECK_PERMS_SKIP: List of PathMask (default: empty)
# A list of patterns (like man/*) that should be excluded from the
# check. Note that a * in a pattern also matches a slash in a
# pathname.
#
.if defined(PKG_DEVELOPER)
CHECK_PERMS?= yes
.else
CHECK_PERMS?= no
.endif
#.if !empty(CHECK_PERMS:M[Yy][Ee][Ss])
#_POST_INSTALL_CHECKS+= check-perms
#.endif
_CHECK_PERMS_CMD= ${LOCALBASE}/bin/checkperms
_CHECK_PERMS_GETDIRS_AWK= \
/.*/ { \
print $$0; \
dir = $$0; \
while (sub("/[^/]*$$", "", dir) && dir != "") { \
if (!(dir in dirs)) { \
dirs[dir] = "done"; \
print dir; \
} \
} \
}
CHECK_PERMS_SKIP?= # none
_CHECK_PERMS_SKIP_FILTER= case "$$file" in
_CHECK_PERMS_SKIP_FILTER+= ${CHECK_PERMS_SKIP:@.pattern.@${PREFIX}/${.pattern.}|${.pattern.}) continue ;;@}
_CHECK_PERMS_SKIP_FILTER+= *) ;;
_CHECK_PERMS_SKIP_FILTER+= esac
.PHONY: check-perms
.if exists(${_CHECK_PERMS_CMD})
check-perms:
@${STEP_MSG} "Checking file permissions in ${PKGNAME}"
${_PKG_SILENT}${_PKG_DEBUG} \
set -e; \
${PKG_FILELIST_CMD} \
| sort \
| sed -e 's,\\,\\\\,g' \
| while read file; do \
${_CHECK_PERMS_SKIP_FILTER}; \
printf "%s\\n" "$$file"; \
done \
| awk ${_CHECK_PERMS_GETDIRS_AWK:Q} \
| ${_CHECK_PERMS_CMD}
.else
check-perms:
@${WARNING_MSG} "[check-perms.mk] Skipping file permissions check."
@${WARNING_MSG} "[check-perms.mk] Install sysutils/checkperms to enable this check."
.endif
|