diff --git a/policy/modules/system/init.if b/policy/modules/system/init.if index ab24b5d9b..66482eb35 100644 --- a/policy/modules/system/init.if +++ b/policy/modules/system/init.if @@ -2047,25 +2047,7 @@ interface(`init_get_script_status',` ## # interface(`init_startstop_service',` - gen_require(` - role system_r; - ') - - # sysvinit/upstart systems will need to use run_init - # if not using direct_sysadm_daemon. - ifdef(`direct_sysadm_daemon',` - init_labeled_script_domtrans($1, $4) - domain_system_change_exemption($1) - role_transition $2 $4 system_r; - allow $2 system_r; - ') - - ifdef(`distro_gentoo',` - # for OpenRC - seutil_labeled_init_script_run_runinit($1, $2, $4) - ') - - ifdef(`init_systemd',` + ifelse(`init_systemd',`true',` # This ifelse condition is temporary, until # all callers are updated to provide unit files. ifelse(`$5',`',`',` @@ -2075,6 +2057,26 @@ interface(`init_startstop_service',` allow $1 $5:service { start status stop }; ') + + ',`distro_gentoo',`true',` + # for OpenRC + seutil_labeled_init_script_run_runinit($1, $2, $4) + + ',`direct_sysadm_daemon',`true',` + gen_require(` + role system_r; + ') + + # rules for sysvinit / upstart + init_labeled_script_domtrans($1, $4) + domain_system_change_exemption($1) + role_transition $2 $4 system_r; + allow $2 system_r; + + ',` dnl else + optional_policy(` + seutil_run_runinit($1, $2) + ') ') ')