check service definitions inside /etc/init.d for proper permissions

This commit is contained in:
Leo 2020-07-06 06:35:00 -03:00
parent b78073f663
commit 197f952fec
1 changed files with 20 additions and 3 deletions

View File

@ -782,9 +782,26 @@ postcheck() {
e=1
fi
# look for /etc/init.d and /etc/conf.d
if [ -e "$dir"/etc/init.d -o -e "$dir"/etc/conf.d ] \
&& ! is_openrc_pkg "$name"; then
warning "Found OpenRC directory (/etc/conf.d or /etc/init.d) but name doesn't end with -openrc"
if [ -e "$dir"/etc/init.d -o -e "$dir"/etc/conf.d ]; then
# Check that init.d has the correct permissions
if ! is_openrc_pkg "$name"; then
warning "Found OpenRC directory (/etc/conf.d or /etc/init.d) but name doesn't end with -openrc"
fi
for i in "$dir"/etc/init.d/*; do
[ -f "$i" ] || continue
[ -L "$i" ] && continue
if [ $(stat -c '%a' "$i") != 755 ]; then
error "OpenRC service definition in /etc/init.d/${i##*/} must have 755 permissions"
e=1
fi
done
for i in "$dir"/etc/conf.d/*; do
[ -f "$i" ] || continue
[ -L "$i" ] && continue
if [ $(stat -c '%a' "$i") != 644 ]; then
warning "OpenRC service configuration in /etc/conf.d/${i##*/} should have 644 permissions"
fi
done
fi
# look for /usr/share/doc
if [ -e "$dir"/usr/share/doc ] \