hooks/post-install: add fix permissions hook
This commit is contained in:
parent
3d9df3e526
commit
b30ea3cffe
3 changed files with 40 additions and 0 deletions
33
common/hooks/post-install/14-fix-permissions.sh
Normal file
33
common/hooks/post-install/14-fix-permissions.sh
Normal file
|
@ -0,0 +1,33 @@
|
|||
# This hook fixes permissions in common places
|
||||
|
||||
change_file_perms() {
|
||||
local dir="${PKGDESTDIR}${1}"
|
||||
# permission mask for matching the files
|
||||
local permmask="$2"
|
||||
# permissions which will be set on matched files
|
||||
local perms="$3"
|
||||
if [ -d "$dir" ]; then
|
||||
find "$dir" -type f -perm "/$permmask" -exec chmod -v "$perms" {} +
|
||||
fi
|
||||
}
|
||||
|
||||
hook() {
|
||||
if [ -z "$nocheckperms" ]; then
|
||||
# check that no files have permission write for all users
|
||||
find "$PKGDESTDIR" -type f -perm -0002 | while read -r file; do
|
||||
msg_error "$pkgver: file ${file#$PKGDESTDIR} has write permission for all users\n"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -z "$nofixperms" ]; then
|
||||
change_file_perms "/usr/share/man" 133 644
|
||||
change_file_perms "/etc/apparmor.d" 111 644
|
||||
change_file_perms "/usr/share/applications" 133 644
|
||||
change_file_perms "/usr/share/help" 133 644
|
||||
change_file_perms "/usr/share/icons" 133 644
|
||||
change_file_perms "/usr/share/locale" 133 644
|
||||
change_file_perms "/usr/share/metainfo" 133 644
|
||||
change_file_perms "/usr/share/appdata" 133 644
|
||||
change_file_perms "/usr/include" 133 644
|
||||
fi
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue