diff --git a/config/acid.toml b/config/acid.toml index 5392934f..6e4e82ed 100644 --- a/config/acid.toml +++ b/config/acid.toml @@ -14,10 +14,16 @@ coreutils = {} ion = {} [[files]] -path = "/usr/lib/init.d/10_acid" +path = "/usr/lib/init.d/10_acid.service" data = """ -requires_weak 00_drivers -ion /usr/lib/run_acid.ion +[unit] +description = "Acid test runner" +requires_weak = ["00_pcid-spawner.service"] + +[service] +cmd = "ion" +args = ["/usr/lib/run_acid.ion"] +type = "oneshot_async" """ [[files]] diff --git a/config/auto-test.toml b/config/auto-test.toml index b6ff9786..aac55056 100644 --- a/config/auto-test.toml +++ b/config/auto-test.toml @@ -13,10 +13,16 @@ filesystem_size = 1024 auto-test = {} [[files]] -path = "/usr/lib/init.d/30_console" +path = "/usr/lib/init.d/30_console.service" data = """ -requires_weak 10_net -ion /usr/lib/run_tests.ion +[unit] +description = "Automated test runner" +requires_weak = ["00_base.target"] + +[service] +cmd = "ion" +args = ["/usr/lib/run_tests.ion"] +type = "oneshot" """ [[files]] diff --git a/config/base.toml b/config/base.toml index a953e480..e7a04f3d 100644 --- a/config/base.toml +++ b/config/base.toml @@ -23,31 +23,27 @@ uutils = {} ## Configuration files [[files]] -path = "/usr/lib/init.d/00_base" +path = "/usr/lib/init.d/00_base.service" data = """ -# clear and recreate tmpdir with 0o1777 permission -rm -rf /tmp -mkdir -m a=rwxt /tmp +[unit] +description = "Base environment setup (tmpdir)" -notify ipcd -notify ptyd -nowait sudo --daemon +[service] +cmd = "ion" +args = ["-c", "rm -rf /tmp; mkdir -m a=rwxt /tmp"] +type = "oneshot" """ [[files]] -path = "/usr/lib/init.d/00_drivers" +path = "/usr/lib/init.d/00_sudo.service" data = """ -requires_weak 00_base -pcid-spawner -""" +[unit] +description = "Sudo privilege daemon" -## Network init -[[files]] -path = "/usr/lib/init.d/10_net" -data = """ -requires_weak 00_drivers -notify smolnetd -nowait dhcpd +[service] +cmd = "sudo" +args = ["--daemon"] +type = "oneshot_async" """ [[files]] diff --git a/config/desktop-minimal.toml b/config/desktop-minimal.toml index 7b662860..7aa87357 100644 --- a/config/desktop-minimal.toml +++ b/config/desktop-minimal.toml @@ -15,18 +15,49 @@ orbterm = "ignore" orbutils = "ignore" [[files]] -path = "/usr/lib/init.d/20_display" +path = "/usr/lib/init.d/20_display.service" data = """ -requires_weak 10_net -notify audiod -nowait VT=3 ion -c true +[unit] +description = "Display setup" +requires_weak = ["00_base.target"] + +[service] +cmd = "ion" +args = ["-c", "true"] +envs = { VT = "3" } +type = "oneshot_async" """ -# Override console config to not switch to VT 2 +# Override: do not activate VT 2 (desktop uses VT 3) [[files]] -path = "/usr/lib/init.d/30_console" +path = "/usr/lib/init.d/29_activate_console.service" +data = "" + +# Override console config to depend on display instead of VT activation +[[files]] +path = "/usr/lib/init.d/30_console.service" data = """ -requires_weak 20_display -nowait getty 2 -nowait getty /scheme/debug/no-preserve -J +[unit] +description = "Console terminals" +requires_weak = ["20_display.service"] + +[service] +cmd = "getty" +args = ["2"] +type = "oneshot_async" +respawn = true +""" + +[[files]] +path = "/usr/lib/init.d/31_debug_console.service" +data = """ +[unit] +description = "Debug console" +requires_weak = ["30_console.service"] + +[service] +cmd = "getty" +args = ["/scheme/debug/no-preserve", "-J"] +type = "oneshot_async" +respawn = true """ diff --git a/config/minimal.toml b/config/minimal.toml index 5f110740..368e67bb 100644 --- a/config/minimal.toml +++ b/config/minimal.toml @@ -17,10 +17,42 @@ pkgutils = {} kibi = {} [[files]] -path = "/usr/lib/init.d/30_console" +path = "/usr/lib/init.d/29_activate_console.service" data = """ -requires_weak 10_net -inputd -A 2 -nowait getty 2 -nowait getty /scheme/debug/no-preserve -J +[unit] +description = "Activate console VT" +requires_weak = ["00_base.target"] + +[service] +cmd = "inputd" +args = ["-A", "2"] +type = "oneshot_async" +""" + +[[files]] +path = "/usr/lib/init.d/30_console.service" +data = """ +[unit] +description = "Console terminals" +requires_weak = ["29_activate_console.service"] + +[service] +cmd = "getty" +args = ["2"] +type = "oneshot_async" +respawn = true +""" + +[[files]] +path = "/usr/lib/init.d/31_debug_console.service" +data = """ +[unit] +description = "Debug console" +requires_weak = ["29_activate_console.service"] + +[service] +cmd = "getty" +args = ["/scheme/debug/no-preserve", "-J"] +type = "oneshot_async" +respawn = true """ diff --git a/config/os-test.toml b/config/os-test.toml index 58ed1b4b..c7ebbc9a 100644 --- a/config/os-test.toml +++ b/config/os-test.toml @@ -14,9 +14,15 @@ prompt = false os-test-bins = {} # Provides source and cross-compiled binaries [[files]] -path = "/usr/lib/init.d/30_console" +path = "/usr/lib/init.d/30_console.service" data = """ -requires_weak 10_net -RUST_BACKTRACE=full os-test-runner -shutdown +[unit] +description = "OS test runner" +requires_weak = ["00_base.target"] + +[service] +cmd = "ion" +args = ["-c", "os-test-runner; shutdown"] +envs = { RUST_BACKTRACE = "full" } +type = "oneshot" """ diff --git a/config/redbear-legacy-base.toml b/config/redbear-legacy-base.toml index 19b119ea..3d9c4a3d 100644 --- a/config/redbear-legacy-base.toml +++ b/config/redbear-legacy-base.toml @@ -1,15 +1,11 @@ -# Red Bear OS overrides for legacy base init scripts. +# Red Bear OS overrides for base init services. # -# 00_base: tmpdir setup + sudo --daemon. ipcd and ptyd are started by the -# systemd-style services in base recipe's init.d/ (00_ipcd.service, -# 00_ptyd.service). The old "notify" calls have been removed because -# the "notify" binary does not exist — they always failed silently. -# sudo --daemon is kept here because 00_sudo.service exists in the base -# recipe but is not wired into any target that gets scheduled. -# 00_drivers: removed — pcid-spawner is started by 00_pcid-spawner.service from -# the base recipe. The legacy script was redundant. -# 10_net: blanked — replaced by per-config network services (e.g. redbear-live-mini's -# 10_smolnetd.service + 10_dhcpd.service). +# 00_base.service: stripped base setup (tmpdir only, no sudo — sudo runs from +# base.toml's 00_sudo.service). ipcd and ptyd are started by +# 00_ipcd.service and 00_ptyd.service from the base recipe. +# 00_drivers / 10_net: no longer overridden — the legacy scripts were removed +# from base.toml. pcid-spawner is started by 00_pcid-spawner.service +# from the base recipe; smolnetd/dhcpd have their own .service files. # 00_pcid-spawner.service: overridden to oneshot_async. The base recipe uses # type="oneshot" which blocks init until pcid-spawner exits. On real # hardware (and QEMU), pcid-spawner can hang waiting for a PCI device @@ -18,21 +14,17 @@ # services while drivers spawn in the background. [[files]] -path = "/usr/lib/init.d/00_base" +path = "/usr/lib/init.d/00_base.service" data = """ -# clear and recreate tmpdir with 0o1777 permission -rm -rf /tmp -mkdir -m a=rwxt /tmp +[unit] +description = "Base environment setup (tmpdir)" + +[service] +cmd = "ion" +args = ["-c", "rm -rf /tmp; mkdir -m a=rwxt /tmp"] +type = "oneshot" """ -[[files]] -path = "/usr/lib/init.d/00_drivers" -data = "" - -[[files]] -path = "/usr/lib/init.d/10_net" -data = "" - [[files]] path = "/etc/init.d/20_audiod.service" data = """ diff --git a/config/redbear-legacy-desktop.toml b/config/redbear-legacy-desktop.toml index 37f2f193..34b0e7e8 100644 --- a/config/redbear-legacy-desktop.toml +++ b/config/redbear-legacy-desktop.toml @@ -1,9 +1,18 @@ -# Red Bear OS overrides for broken legacy desktop init scripts. +# Red Bear OS overrides for legacy desktop init services. +# Blank the display and console services inherited from desktop-minimal.toml. [[files]] -path = "/usr/lib/init.d/20_display" +path = "/usr/lib/init.d/20_display.service" data = "" [[files]] -path = "/usr/lib/init.d/30_console" +path = "/usr/lib/init.d/29_activate_console.service" +data = "" + +[[files]] +path = "/usr/lib/init.d/30_console.service" +data = "" + +[[files]] +path = "/usr/lib/init.d/31_debug_console.service" data = "" diff --git a/config/redoxer-gui.toml b/config/redoxer-gui.toml index c3e6149a..8aa18635 100644 --- a/config/redoxer-gui.toml +++ b/config/redoxer-gui.toml @@ -9,10 +9,15 @@ orbital = {} # Override to run inside of orbital [[files]] -path = "/usr/lib/init.d/30_redoxer" +path = "/usr/lib/init.d/30_redoxer.service" data = """ -requires_weak 10_net -echo -echo "## running redoxer in orbital ##" -nowait VT=3 orbital redoxerd +[unit] +description = "Redoxer GUI test (orbital)" +requires_weak = ["10_dhcpd.service"] + +[service] +cmd = "orbital" +args = ["redoxerd"] +envs = { VT = "3" } +type = "oneshot_async" """ diff --git a/config/redoxer.toml b/config/redoxer.toml index 6532300d..6875066d 100644 --- a/config/redoxer.toml +++ b/config/redoxer.toml @@ -15,20 +15,42 @@ pkgutils = {} relibc = {} sed = {} -# Override to not background dhcpd +# Override network services for redoxer (foreground dhcpd) [[files]] -path = "/usr/lib/init.d/10_net" +path = "/usr/lib/init.d/10_smolnetd.service" data = """ -requires_weak 00_drivers -notify smolnetd -dhcpd +[unit] +description = "Network stack for redoxer" +requires_weak = ["00_pcid-spawner.service"] + +[service] +cmd = "netstack" +type = "oneshot_async" """ [[files]] -path = "/usr/lib/init.d/30_redoxer" +path = "/usr/lib/init.d/10_dhcpd.service" data = """ -requires_weak 10_net -ion /usr/lib/run_redoxer.ion +[unit] +description = "DHCP client (foreground) for redoxer" +requires_weak = ["10_smolnetd.service"] + +[service] +cmd = "dhcpd" +type = "oneshot_async" +""" + +[[files]] +path = "/usr/lib/init.d/30_redoxer.service" +data = """ +[unit] +description = "Redoxer test runner" +requires_weak = ["10_dhcpd.service"] + +[service] +cmd = "ion" +args = ["/usr/lib/run_redoxer.ion"] +type = "oneshot_async" """ [[files]] diff --git a/config/sys-build.toml b/config/sys-build.toml index 9534edda..7f75662b 100644 --- a/config/sys-build.toml +++ b/config/sys-build.toml @@ -14,10 +14,16 @@ bottom = "ignore" kibi = "ignore" [[files]] -path = "/usr/lib/init.d/30_console" +path = "/usr/lib/init.d/30_console.service" data = """ -requires_weak 10_net -ion /usr/lib/sys_build.ion +[unit] +description = "System build test" +requires_weak = ["00_base.target"] + +[service] +cmd = "ion" +args = ["/usr/lib/sys_build.ion"] +type = "oneshot" """ [[files]] diff --git a/config/x11.toml b/config/x11.toml index 38fd1e6d..65348745 100644 --- a/config/x11.toml +++ b/config/x11.toml @@ -27,10 +27,16 @@ x11-full = {} zenity = {} [[files]] -path = "/usr/lib/init.d/10_dbus" +path = "/usr/lib/init.d/10_dbus.service" data = """ -requires_weak 10_net -bash /usr/bin/start-dbus.sh +[unit] +description = "D-Bus system bus (X11)" +requires_weak = ["00_base.target"] + +[service] +cmd = "bash" +args = ["/usr/bin/start-dbus.sh"] +type = "oneshot_async" """ [[files]] @@ -49,19 +55,31 @@ dbus-daemon --system """ [[files]] -path = "/usr/lib/init.d/10_xenv" +path = "/usr/lib/init.d/10_xenv.service" data = """ -requires_weak 10_net -glib-compile-schemas /usr/share/glib-2.0/schemas/ +[unit] +description = "Compile glib schemas" +requires_weak = ["00_base.target"] + +[service] +cmd = "glib-compile-schemas" +args = ["/usr/share/glib-2.0/schemas/"] +type = "oneshot" """ # Overridden to launch X instead of orblogin [[files]] -path = "/usr/lib/init.d/20_orbital" +path = "/usr/lib/init.d/20_orbital.service" data = """ -requires_weak 10_dbus 10_xenv -notify audiod -nowait BROWSER=/bin/netsurf-fb VT=3 orbital orbital-x11 +[unit] +description = "Orbital display (X11)" +requires_weak = ["10_dbus.service", "10_xenv.service"] + +[service] +cmd = "orbital" +args = ["orbital-x11"] +envs = { BROWSER = "/bin/netsurf-fb", VT = "3" } +type = "oneshot_async" """ [[files]] @@ -131,11 +149,33 @@ mate-session& # Override console config to set DISPLAY=:0 [[files]] -path = "/usr/lib/init.d/30_console" +path = "/usr/lib/init.d/30_console.service" data = """ -requires_weak 20_orbital -nowait DISPLAY=:0 getty 2 -nowait DISPLAY=:0 getty /scheme/debug/no-preserve -J +[unit] +description = "Console terminals (X11)" +requires_weak = ["20_orbital.service"] + +[service] +cmd = "getty" +args = ["2"] +envs = { DISPLAY = ":0" } +type = "oneshot_async" +respawn = true +""" + +[[files]] +path = "/usr/lib/init.d/31_debug_console.service" +data = """ +[unit] +description = "Debug console (X11)" +requires_weak = ["30_console.service"] + +[service] +cmd = "getty" +args = ["/scheme/debug/no-preserve", "-J"] +envs = { DISPLAY = ":0" } +type = "oneshot_async" +respawn = true """ diff --git a/config/x86_64/desktop-contain.toml b/config/x86_64/desktop-contain.toml index 6fca0f18..cca5dcac 100644 --- a/config/x86_64/desktop-contain.toml +++ b/config/x86_64/desktop-contain.toml @@ -15,20 +15,46 @@ include = ["../desktop.toml"] # Override orbital init to use contain_orblogin [[files]] -path = "/usr/lib/init.d/20_orbital" +path = "/usr/lib/init.d/20_orbital.service" data = """ -requires_weak 10_net -notify audiod -nowait VT=3 orbital contain_orblogin launcher +[unit] +description = "Orbital display (contain sandbox)" +requires_weak = ["00_base.target"] + +[service] +cmd = "orbital" +args = ["contain_orblogin", "launcher"] +envs = { VT = "3" } +type = "oneshot_async" """ # Override console init to use contain [[files]] -path = "/usr/lib/init.d/30_console" +path = "/usr/lib/init.d/30_console.service" data = """ -requires_weak 20_orbital -nowait getty --contain 2 -nowait getty --contain /scheme/debug/no-preserve -J +[unit] +description = "Console terminals (contained)" +requires_weak = ["20_orbital.service"] + +[service] +cmd = "getty" +args = ["--contain", "2"] +type = "oneshot_async" +respawn = true +""" + +[[files]] +path = "/usr/lib/init.d/31_debug_console.service" +data = """ +[unit] +description = "Debug console (contained)" +requires_weak = ["30_console.service"] + +[service] +cmd = "getty" +args = ["--contain", "/scheme/debug/no-preserve", "-J"] +type = "oneshot_async" +respawn = true """ [[files]] diff --git a/config/x86_64/server-demo.toml b/config/x86_64/server-demo.toml index 6b764915..9a22550d 100644 --- a/config/x86_64/server-demo.toml +++ b/config/x86_64/server-demo.toml @@ -36,18 +36,30 @@ website = {} [[files]] -path = "/usr/lib/init.d/98_keygen_sh" +path = "/usr/lib/init.d/98_keygen_sh.service" data = """ -requires_weak 10_net -bash /root/keygen.sh +[unit] +description = "SSH key generation" +requires_weak = ["00_base.target"] + +[service] +cmd = "bash" +args = ["/root/keygen.sh"] +type = "oneshot" """ [[files]] -path = "/usr/lib/init.d/99_rustysd" +path = "/usr/lib/init.d/99_rustysd.service" data = """ -requires_weak 98_keygen_sh -# Undocumented usage of rsdctl, pointing to notifications dir -RSDCTL_ADDR=/var/run/rustysd/control.socket rustysd --conf /etc/rustysd +[unit] +description = "Rustysd service manager" +requires_weak = ["98_keygen_sh.service"] + +[service] +cmd = "rustysd" +args = ["--conf", "/etc/rustysd"] +envs = { RSDCTL_ADDR = "/var/run/rustysd/control.socket" } +type = "oneshot_async" """ [[files]]