[main]
@type = oneshot
@version = @vers@
@description = "Run rc.local script"
@options = ( !log )
@user = ( root )
@depends = (
    mount-rw
    local-iptables
    local-ip6tables
    local-nftables
    local-ebtables
    local-arptables
    local-loop
    local-time
    local-authfiles
    local-tmpfiles )

[start]
@execute =
(
	if { 66-yeller -cdp local-rc -1 /dev/console starts... }
	if -nt {
		# - Execute /etc/local.d/*.start scripts if they are +x
		# - Execute ${script_file}
		foreground {
			elglob -0 start_scripts /etc/local.d/*.start
				forx -E script { ${start_scripts} }
					if { test -x ${script} }
					${script}
		}
		${script_file}
	}
	66-yeller -fcdp local-rc -1 /dev/console crashed!
)

[stop]
@execute =
(
	if { 66-yeller -cdp local-rc -1 /dev/console stops... }
	if -nt {
		# - Execute /etc/local.d/*.stop scripts if they are +x
		elglob -0 stop_scripts /etc/local.d/*.stop
			forx -E script { ${stop_scripts} }
				if { test -x ${script} }
				${script}
	}
	66-yeller -fcdp local-rc -1 /dev/console crashed!
)

[environment]
script_file=!@skeldir@/rc.local
