Compare commits

...

3 Commits

Author SHA1 Message Date
Leo eaa35674eb Merge branch 'openrc-check-perms' into 'master'
WIP: check service definitions inside /etc/init.d for proper permissions

See merge request alpine/abuild!57
2024-04-26 13:55:28 +00:00
Piraty a45d12d4c3
abuild-rootbld: copy SRCDEST value from host to chroot
Otherwise the default hardcoded in abuild-fetch (var/cache/distfiles) is
used.

(in the same vein as 6864df03aa)

Fixes: 1582617 ("abuild-rootbld: clear environment for bwrap container")
2024-04-26 00:24:09 +02:00
Leo 197f952fec check service definitions inside /etc/init.d for proper permissions 2020-12-14 04:31:36 -03:00
1 changed files with 21 additions and 3 deletions

View File

@ -823,9 +823,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 ] \
@ -2625,6 +2642,7 @@ rootbld() {
--setenv CARCH "$CARCH" \
--setenv HOME "$HOME" \
--setenv REPODEST "$REPODEST" \
--setenv SRCDEST "$SRCDEST" \
--setenv ABUILD_USERDIR "$ABUILD_USERDIR" \
${ABUILD_BOOTSTRAP:+--setenv ABUILD_BOOTSTRAP "$ABUILD_BOOTSTRAP"} \
${APORTS_BOOTSTRAP:+--setenv APORTS_BOOTSTRAP "$APORTS_BOOTSTRAP"} \