diff --git a/contrib/alpine/finit.conf b/contrib/alpine/finit.conf index 29432703..44dbe31a 100644 --- a/contrib/alpine/finit.conf +++ b/contrib/alpine/finit.conf @@ -3,24 +3,34 @@ ## Runlevel to start after bootstrap, runlevel 'S' # Default is 2 -#runlevel 2 +#runlevel = 2 # Top-level cgroups and their default settings. All groups mandatory # but more can be added, max 8 groups in total currently. The cgroup # 'root' is also available, reserved for RT processes. Settings are # as-is, only one shorthand 'mem.' exists, other than that it's the # cgroup v2 controller default names. -#cgroup init cpu.weight:100 -#cgroup user cpu.weight:100 -#cgroup system cpu.weight:9700 +#cgroup init { cpu.weight = 100 } +#cgroup user { cpu.weight = 100 } +#cgroup system { cpu.weight = 9700 } # Task to run if ctrl-alt-del is pressed. This condition is asserted by # Finit upon receiving SIGINT (from the kernel). -#task [12345789] initctl reboot -- Rebooting system +#task reboot { +# description = "Rebooting system" +# runlevel = "12345789" +# conditions = { "sys/key/ctrlaltdel" } +# command = "initctl reboot" +#} # Task to run if the kernel gets a power fail condition is pressed. # Asserted by Finit upon receiving SIGPWR (from the kernel). -#task [12345789] initctl poweroff -- Shutting down system +#task poweroff { +# description = "Shutting down system" +# runlevel = "12345789" +# conditions = { "sys/pwr/fail" } +# command = "initctl poweroff" +#} ## Bootstrap services and tasks # Can be listed here or in /etc/finit.d/*.conf diff --git a/contrib/alpine/finit.d/available/acpid.conf b/contrib/alpine/finit.d/available/acpid.conf index e00189e6..9bbcbbdf 100644 --- a/contrib/alpine/finit.d/available/acpid.conf +++ b/contrib/alpine/finit.d/available/acpid.conf @@ -1,3 +1,9 @@ # Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager) # Depends on syslogd having started. Redirect any output to log. -service [2345] log acpid -f -- ACPI daemon +service acpid { + description = "ACPI daemon" + runlevel = "2345" + conditions = { "pid/syslogd" } + log { } + command = "acpid -f" +} diff --git a/contrib/alpine/finit.d/available/crond.conf b/contrib/alpine/finit.d/available/crond.conf index 687dc403..434435ce 100644 --- a/contrib/alpine/finit.d/available/crond.conf +++ b/contrib/alpine/finit.d/available/crond.conf @@ -1 +1,7 @@ -service [2345] env:-/etc/conf.d/crond crond -f -S $CRON_OPTS -- Cron daemon +service crond { + description = "Cron daemon" + runlevel = "2345" + conditions = { "pid/syslogd" } + envfile = "-/etc/conf.d/crond" + command = "crond -f -S $CRON_OPTS" +} diff --git a/contrib/alpine/finit.d/available/dropbear.conf b/contrib/alpine/finit.d/available/dropbear.conf index 11db0b73..d4e16132 100644 --- a/contrib/alpine/finit.d/available/dropbear.conf +++ b/contrib/alpine/finit.d/available/dropbear.conf @@ -1,2 +1,7 @@ # Start SSH daemon as soon as basic networking comes up -service [2345] env:-/etc/conf.d/dropbear dropbear -R -F $DROPBEAR_OPTS -- Dropbear SSH daemon +service dropbear { + description = "Dropbear SSH daemon" + runlevel = "2345" + envfile = "-/etc/conf.d/dropbear" + command = "dropbear -R -F $DROPBEAR_OPTS" +} diff --git a/contrib/alpine/finit.d/available/getty.conf b/contrib/alpine/finit.d/available/getty.conf index f0aa0879..2ed77e5f 100644 --- a/contrib/alpine/finit.d/available/getty.conf +++ b/contrib/alpine/finit.d/available/getty.conf @@ -1,5 +1,24 @@ # Consoles to start getty on when system is up -tty [12345] /dev/ttyS0 noclear -tty [12345] /dev/tty1 noclear nowait -tty [2345] /dev/tty2 noclear nowait -tty [2345] /dev/tty3 noclear nowait +tty ttyS0 { + runlevel = "12345" + device = "/dev/ttyS0" + noclear = true +} +tty tty1 { + runlevel = "12345" + device = "/dev/tty1" + noclear = true + nowait = true +} +tty tty2 { + runlevel = "2345" + device = "/dev/tty2" + noclear = true + nowait = true +} +tty tty3 { + runlevel = "2345" + device = "/dev/tty3" + noclear = true + nowait = true +} diff --git a/contrib/alpine/finit.d/available/keymap.conf b/contrib/alpine/finit.d/available/keymap.conf index 55a294d9..498018f8 100644 --- a/contrib/alpine/finit.d/available/keymap.conf +++ b/contrib/alpine/finit.d/available/keymap.conf @@ -1,2 +1,7 @@ # Oneshot task to run once at bootstrap -task [S] env:/etc/conf.d/loadkmap zcat $KEYMAP | loadkmap -- Loading keymap +task keymap { + description = "Loading keymap" + runlevel = "S" + envfile = "/etc/conf.d/loadkmap" + command = "zcat $KEYMAP | loadkmap" +} diff --git a/contrib/alpine/finit.d/available/lxdm.conf b/contrib/alpine/finit.d/available/lxdm.conf index 51354ba5..ff4c2d96 100644 --- a/contrib/alpine/finit.d/available/lxdm.conf +++ b/contrib/alpine/finit.d/available/lxdm.conf @@ -1 +1,5 @@ -service [2345] lxdm -- Lightweight Login Manager +service lxdm { + description = "Lightweight Login Manager" + runlevel = "2345" + command = "lxdm" +} diff --git a/contrib/alpine/finit.d/available/modules.conf b/contrib/alpine/finit.d/available/modules.conf index 16345cc2..a9c5e2b1 100644 --- a/contrib/alpine/finit.d/available/modules.conf +++ b/contrib/alpine/finit.d/available/modules.conf @@ -1,7 +1,2 @@ ## Linux kernel modules to load -#module fbcon -#module button -#module evdev -#module mousedev -#module 8139cp -#module softdog +#modules = { "fbcon", "button", "evdev", "mousedev", "8139cp", "softdog" } diff --git a/contrib/alpine/finit.d/available/ntpd.conf b/contrib/alpine/finit.d/available/ntpd.conf index 185d1b03..95a6bcbf 100644 --- a/contrib/alpine/finit.d/available/ntpd.conf +++ b/contrib/alpine/finit.d/available/ntpd.conf @@ -1,2 +1,9 @@ # Busybox ntpd has no option to use syslog when running in foreground -service [2345] env:-/etc/conf.d/ntpd log ntpd -n $NTPD_OPTS -- NTP daemon +service ntpd { + description = "NTP daemon" + runlevel = "2345" + conditions = { "pid/syslogd" } + envfile = "-/etc/conf.d/ntpd" + log { } + command = "ntpd -n $NTPD_OPTS" +} diff --git a/contrib/alpine/finit.d/available/syslogd.conf b/contrib/alpine/finit.d/available/syslogd.conf index 8d24f896..9a28ff60 100644 --- a/contrib/alpine/finit.d/available/syslogd.conf +++ b/contrib/alpine/finit.d/available/syslogd.conf @@ -1,4 +1,15 @@ # Start syslogd as soon as possible, should always run # Start klogd as soon as possible, but after syslogd -service [S12345] env:-/etc/conf.d/syslog syslogd -n $SYSLOGD_OPTS -- Syslog daemon -service [S12345] env:-/etc/conf.d/klogd klogd -n $KLOGD_OPTS -- Kernel log daemon +service syslogd { + description = "Syslog daemon" + runlevel = "S12345" + envfile = "-/etc/conf.d/syslog" + command = "syslogd -n $SYSLOGD_OPTS" +} +service klogd { + description = "Kernel log daemon" + runlevel = "S12345" + conditions = { "pid/syslogd" } + envfile = "-/etc/conf.d/klogd" + command = "klogd -n $KLOGD_OPTS" +} diff --git a/contrib/alpine/finit.d/available/watchdog.conf b/contrib/alpine/finit.d/available/watchdog.conf index 269b711f..4a843c46 100644 --- a/contrib/alpine/finit.d/available/watchdog.conf +++ b/contrib/alpine/finit.d/available/watchdog.conf @@ -1 +1,6 @@ -service [S123456789] env:-/etc/conf.d/watchdog watchdog $WATCHDOG_OPTS $WATCHDOG_DEV -- System watchdog +service watchdog { + description = "System watchdog" + runlevel = "S123456789" + envfile = "-/etc/conf.d/watchdog" + command = "watchdog $WATCHDOG_OPTS $WATCHDOG_DEV" +} diff --git a/contrib/debian/finit.conf b/contrib/debian/finit.conf index 90b67870..d0c90246 100644 --- a/contrib/debian/finit.conf +++ b/contrib/debian/finit.conf @@ -3,24 +3,34 @@ ## Runlevel to start after bootstrap, runlevel 'S' # Default is 2 -#runlevel 2 +#runlevel = 2 # Top-level cgroups and their default settings. All groups mandatory # but more can be added, max 8 groups in total currently. The cgroup # 'root' is also available, reserved for RT processes. Settings are # as-is, only one shorthand 'mem.' exists, other than that it's the # cgroup v2 controller default names. -#cgroup init cpu.weight:100 -#cgroup user cpu.weight:100 -#cgroup system cpu.weight:9700 +#cgroup init { cpu.weight = 100 } +#cgroup user { cpu.weight = 100 } +#cgroup system { cpu.weight = 9700 } # Task to run if ctrl-alt-del is pressed. This condition is asserted by # Finit upon receiving SIGINT (from the kernel). -#task [12345789] initctl reboot -- Rebooting system +#task reboot { +# description = "Rebooting system" +# runlevel = "12345789" +# conditions = { "sys/key/ctrlaltdel" } +# command = "initctl reboot" +#} # Task to run if the kernel gets a power fail condition is pressed. # Asserted by Finit upon receiving SIGPWR (from the kernel). -#task [12345789] initctl poweroff -- Shutting down system +#task poweroff { +# description = "Shutting down system" +# runlevel = "12345789" +# conditions = { "sys/pwr/fail" } +# command = "initctl poweroff" +#} ## Bootstrap services and tasks # Can be listed here or in /etc/finit.d/*.conf diff --git a/contrib/debian/finit.d/available/acpid.conf b/contrib/debian/finit.d/available/acpid.conf index b23bf099..2c2412c7 100644 --- a/contrib/debian/finit.d/available/acpid.conf +++ b/contrib/debian/finit.d/available/acpid.conf @@ -1,3 +1,10 @@ # Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager) # Depends on a syslog daemon having started. Redirect any output to log. -service [2345] env:-/etc/default/acpid log acpid -f $OPTIONS -- ACPI daemon +service acpid { + description = "ACPI daemon" + runlevel = "2345" + conditions = { "pid/syslogd" } + envfile = "-/etc/default/acpid" + log { } + command = "acpid -f $OPTIONS" +} diff --git a/contrib/debian/finit.d/available/anacron.conf b/contrib/debian/finit.d/available/anacron.conf index 9a6f2942..f970f8e2 100644 --- a/contrib/debian/finit.d/available/anacron.conf +++ b/contrib/debian/finit.d/available/anacron.conf @@ -1 +1,8 @@ -task [2345] halt:usr1 env:-/etc/default/anacron anacron -d -q $ANACRON_ARGS -- Anacron jobs +task anacron { + description = "Anacron jobs" + runlevel = "2345" + conditions = { "sys/pwr/ac", "pid/syslogd" } + envfile = "-/etc/default/anacron" + stop-signal = "usr1" + command = "anacron -d -q $ANACRON_ARGS" +} diff --git a/contrib/debian/finit.d/available/apparmor.conf b/contrib/debian/finit.d/available/apparmor.conf index b746c7fb..92f46e84 100644 --- a/contrib/debian/finit.d/available/apparmor.conf +++ b/contrib/debian/finit.d/available/apparmor.conf @@ -1,2 +1,6 @@ -sysv [S] /etc/init.d/apparmor -- AppArmor initialization +sysv apparmor { + description = "AppArmor initialization" + runlevel = "S" + command = "/etc/init.d/apparmor" +} diff --git a/contrib/debian/finit.d/available/avahi-daemon.conf b/contrib/debian/finit.d/available/avahi-daemon.conf index f81f263a..38c17d3b 100644 --- a/contrib/debian/finit.d/available/avahi-daemon.conf +++ b/contrib/debian/finit.d/available/avahi-daemon.conf @@ -1 +1,6 @@ -service [2345] env:-/etc/default/avahi-daemon avahi-daemon -s $AVAHI_DAEMON_OPTS -- Avahi mDNS/DNS-SD Stack +service avahi-daemon { + description = "Avahi mDNS/DNS-SD Stack" + runlevel = "2345" + envfile = "-/etc/default/avahi-daemon" + command = "avahi-daemon -s $AVAHI_DAEMON_OPTS" +} diff --git a/contrib/debian/finit.d/available/bluetooth.conf b/contrib/debian/finit.d/available/bluetooth.conf index 23571602..4672bdce 100644 --- a/contrib/debian/finit.d/available/bluetooth.conf +++ b/contrib/debian/finit.d/available/bluetooth.conf @@ -1,3 +1,9 @@ # To ignore errors like "org.freedesktop.hostname1", update the env file with # "--noplugin=hostname", i.e. append to BLUETOOTHD_OPTS -service [2345] log:null env:-/etc/default/bluetooth /usr/libexec/bluetooth/bluetoothd -n $BLUETOOTHD_OPTS -- Bluetooth service +service bluetoothd { + description = "Bluetooth service" + runlevel = "2345" + envfile = "-/etc/default/bluetooth" + log { file = "/dev/null" } + command = "/usr/libexec/bluetooth/bluetoothd -n $BLUETOOTHD_OPTS" +} diff --git a/contrib/debian/finit.d/available/console-setup.conf b/contrib/debian/finit.d/available/console-setup.conf index 855e7ab1..5ec68635 100644 --- a/contrib/debian/finit.d/available/console-setup.conf +++ b/contrib/debian/finit.d/available/console-setup.conf @@ -1,2 +1,6 @@ # Oneshot task to run once at bootstrap -task [S] /lib/console-setup/console-setup.sh -- Setting up console font and keymap +task console-setup { + description = "Setting up console font and keymap" + runlevel = "S" + command = "/lib/console-setup/console-setup.sh" +} diff --git a/contrib/debian/finit.d/available/cron.conf b/contrib/debian/finit.d/available/cron.conf index 89fa6e48..35034991 100644 --- a/contrib/debian/finit.d/available/cron.conf +++ b/contrib/debian/finit.d/available/cron.conf @@ -1 +1,7 @@ -service [2345] env:-/etc/default/cron cron -f $EXTRA_OPTS -- Background job processing daemon +service cron { + description = "Background job processing daemon" + runlevel = "2345" + conditions = { "sys/pwr/ac", "pid/syslogd" } + envfile = "-/etc/default/cron" + command = "cron -f $EXTRA_OPTS" +} diff --git a/contrib/debian/finit.d/available/elogind.conf b/contrib/debian/finit.d/available/elogind.conf index c37095c0..8b7ccc4a 100644 --- a/contrib/debian/finit.d/available/elogind.conf +++ b/contrib/debian/finit.d/available/elogind.conf @@ -1,4 +1,9 @@ # On some systems, bootstrap can be really quick and cause elogind # to not start before a user has managed to log in. To prevent # this, add as condition to your TTYs in getty.conf -service [2345] /usr/libexec/elogind -- Login manager +service elogind { + description = "Login manager" + runlevel = "2345" + conditions = { "pid/syslogd" } + command = "/usr/libexec/elogind" +} diff --git a/contrib/debian/finit.d/available/getty.conf b/contrib/debian/finit.d/available/getty.conf index 12096163..c2a291fb 100644 --- a/contrib/debian/finit.d/available/getty.conf +++ b/contrib/debian/finit.d/available/getty.conf @@ -1,7 +1,38 @@ # Consoles to start getty on when system is up -tty [12345] /dev/tty1 linux noclear nowait -tty [2345] /dev/tty2 linux nowait -tty [2345] /dev/tty3 linux nowait -tty [2345] /dev/tty4 linux nowait -tty [2345] /dev/tty5 linux nowait -tty [2345] /dev/tty6 linux nowait +tty tty1 { + runlevel = "12345" + device = "/dev/tty1" + term = "linux" + noclear = true + nowait = true +} +tty tty2 { + runlevel = "2345" + device = "/dev/tty2" + term = "linux" + nowait = true +} +tty tty3 { + runlevel = "2345" + device = "/dev/tty3" + term = "linux" + nowait = true +} +tty tty4 { + runlevel = "2345" + device = "/dev/tty4" + term = "linux" + nowait = true +} +tty tty5 { + runlevel = "2345" + device = "/dev/tty5" + term = "linux" + nowait = true +} +tty tty6 { + runlevel = "2345" + device = "/dev/tty6" + term = "linux" + nowait = true +} diff --git a/contrib/debian/finit.d/available/keyboard-setup.conf b/contrib/debian/finit.d/available/keyboard-setup.conf index 15ef6990..856f8af2 100644 --- a/contrib/debian/finit.d/available/keyboard-setup.conf +++ b/contrib/debian/finit.d/available/keyboard-setup.conf @@ -1,2 +1,6 @@ # Oneshot task to run once at bootstrap -task [S] /lib/console-setup/keyboard-setup.sh -- Setting up console keyboard layout +task keyboard-setup { + description = "Setting up console keyboard layout" + runlevel = "S" + command = "/lib/console-setup/keyboard-setup.sh" +} diff --git a/contrib/debian/finit.d/available/lightdm.conf b/contrib/debian/finit.d/available/lightdm.conf index 98783e02..2486a55a 100644 --- a/contrib/debian/finit.d/available/lightdm.conf +++ b/contrib/debian/finit.d/available/lightdm.conf @@ -1 +1,5 @@ -service [3] lightdm -- Light Display Manager +service lightdm { + description = "Light Display Manager" + runlevel = "3" + command = "lightdm" +} diff --git a/contrib/debian/finit.d/available/modules.conf b/contrib/debian/finit.d/available/modules.conf index f45caec2..6c4bb5d9 100644 --- a/contrib/debian/finit.d/available/modules.conf +++ b/contrib/debian/finit.d/available/modules.conf @@ -1,8 +1,2 @@ ## Linux kernel modules to load -#module fbcon -#module button -#module evdev -#module loop -#module psmouse -#module mousedev -#module 8139cp +#modules = { "fbcon", "button", "evdev", "loop", "psmouse", "mousedev", "8139cp" } diff --git a/contrib/debian/finit.d/available/plymouth-quit.conf b/contrib/debian/finit.d/available/plymouth-quit.conf index cc72b451..9064aeef 100644 --- a/contrib/debian/finit.d/available/plymouth-quit.conf +++ b/contrib/debian/finit.d/available/plymouth-quit.conf @@ -1,2 +1,6 @@ # Need to stop plymouth, or it'll block stdin on tty1 -task [S] /usr/bin/plymouth quit -- Stopping Plymouth Boot Screen +task plymouth { + description = "Stopping Plymouth Boot Screen" + runlevel = "S" + command = "/usr/bin/plymouth quit" +} diff --git a/contrib/debian/finit.d/available/rsyslogd.conf b/contrib/debian/finit.d/available/rsyslogd.conf index 80e72cda..fee99c5a 100644 --- a/contrib/debian/finit.d/available/rsyslogd.conf +++ b/contrib/debian/finit.d/available/rsyslogd.conf @@ -1,3 +1,8 @@ # Start rsyslogd as soon as possible, should always run # Provides pid/syslogd condition -service [S12345] name:syslogd env:-/etc/default/rsyslog rsyslogd -n $RSYSLOGD_OPTIONS -- Reliable syslog daemon +service syslogd { + description = "Reliable syslog daemon" + runlevel = "S12345" + envfile = "-/etc/default/rsyslog" + command = "rsyslogd -n $RSYSLOGD_OPTIONS" +} diff --git a/contrib/debian/finit.d/available/sntpd.conf b/contrib/debian/finit.d/available/sntpd.conf index 7b5a9fa7..ccc3e392 100644 --- a/contrib/debian/finit.d/available/sntpd.conf +++ b/contrib/debian/finit.d/available/sntpd.conf @@ -1,2 +1,8 @@ # Simple NTP client (SNTP) -service [2345] env:-/etc/default/sntpd sntpd -n $SNTPD_OPTIONS -- SNTP client +service sntpd { + description = "SNTP client" + runlevel = "2345" + conditions = { "net/route/default" } + envfile = "-/etc/default/sntpd" + command = "sntpd -n $SNTPD_OPTIONS" +} diff --git a/contrib/debian/finit.d/available/sshd.conf b/contrib/debian/finit.d/available/sshd.conf index 62c310ab..a945eb90 100644 --- a/contrib/debian/finit.d/available/sshd.conf +++ b/contrib/debian/finit.d/available/sshd.conf @@ -1,2 +1,8 @@ # Start SSH daemon as soon as basic networking comes up -service [2345] env:-/etc/default/ssh /usr/sbin/sshd -D $SSHD_OPTS -- OpenSSH daemon +service sshd { + description = "OpenSSH daemon" + runlevel = "2345" + conditions = { "net/lo/up" } + envfile = "-/etc/default/ssh" + command = "/usr/sbin/sshd -D $SSHD_OPTS" +} diff --git a/contrib/debian/finit.d/available/syslogd.conf b/contrib/debian/finit.d/available/syslogd.conf index 6896ed10..afb95522 100644 --- a/contrib/debian/finit.d/available/syslogd.conf +++ b/contrib/debian/finit.d/available/syslogd.conf @@ -1,2 +1,7 @@ # Start sysklogd as soon as possible, should always run if enabled -service [S123456789] env:-/etc/default/syslogd syslogd -F $SYSLOGD_OPTIONS -- System logging daemon +service syslogd { + description = "System logging daemon" + runlevel = "S123456789" + envfile = "-/etc/default/syslogd" + command = "syslogd -F $SYSLOGD_OPTIONS" +} diff --git a/contrib/debian/finit.d/available/xdm.conf b/contrib/debian/finit.d/available/xdm.conf index 0883ba97..00f67503 100644 --- a/contrib/debian/finit.d/available/xdm.conf +++ b/contrib/debian/finit.d/available/xdm.conf @@ -1,4 +1,8 @@ # Here we use XDM since it has few dependencies (relatively speaking). # It is also an example of a service without a -- description. # service [3] lxdm -- Lightweight Login Manager -service [3] xdm -nodaemon -- X Display Manager +service xdm { + description = "X Display Manager" + runlevel = "3" + command = "xdm -nodaemon" +} diff --git a/contrib/finit.conf b/contrib/finit.conf index 3faf0928..41d0f390 100644 --- a/contrib/finit.conf +++ b/contrib/finit.conf @@ -1,85 +1,149 @@ # Sample finit.conf to demonstrate the syntax # -host testbed +hostname = "testbed" # Linux kernel modules to load -module button -module evdev -module loop -module psmouse +modules = { "button", "evdev", "loop", "psmouse" } # Top-level cgroups and their default settings. All groups mandatory # but more can be added, max 8 groups in total currently. The cgroup # 'root' is also available, reserved for RT processes. Settings are # as-is, only one shorthand 'mem.' exists, other than that it's the # cgroup v2 controller default names. -cgroup init cpu.weight:100 -cgroup user cpu.weight:100 -cgroup system cpu.weight:9700 cpu.max:50000 +cgroup init { cpu.weight = 100 } +cgroup user { cpu.weight = 100 } +cgroup system { cpu.weight = 9700 cpu.max = 50000 } # Example extra cgroup -cgroup maint cpu.weight:100 +cgroup maint { cpu.weight = 100 } # Runlevel to start after bootstrap, runlevel 'S' -runlevel 2 +runlevel = 2 # Network bringup script -network service networking start +network = "service networking start" # Max file size for each log file: 100 kiB, rotate max 4 copies: # log => log.1 => log.2.gz => log.3.gz => log.4.gz -log size:100k count:4 +log { + size = 100k + count = 4 +} # Virtual consoles to start getty on -tty /dev/tty1 -tty /dev/tty2 -tty /dev/tty3 +tty tty1 { device = "/dev/tty1" } +tty tty2 { device = "/dev/tty2" } +tty tty3 { device = "/dev/tty3" } # Task to run if ctrl-alt-del is pressed. This condition is asserted by # Finit upon receiving SIGINT (from the kernel). -task [12345789] initctl reboot -- Rebooting system +task reboot { + description = "Rebooting system" + runlevel = "12345789" + conditions = { "sys/key/ctrlaltdel" } + command = "initctl reboot" +} # Task to run if the kernel gets a power fail condition is pressed. # Asserted by Finit upon receiving SIGPWR (from the kernel). -task [12345789] initctl poweroff -- Shutting down system +task poweroff { + description = "Shutting down system" + runlevel = "12345789" + conditions = { "sys/pwr/fail" } + command = "initctl poweroff" +} # Alternative method instead of runparts -#task [S] /etc/init.d/keyboard-setup start -- Setting up preliminary keymap -#task [S] /etc/init.d/acpid start -- Starting ACPI Daemon -#task [S] /etc/init.d/kbd start -- Preparing console -#run [2] /etc/init.d/networking start -- Start networking +#task keyboard-setup { +# description = "Setting up preliminary keymap" +# runlevel = "S" +# command = "/etc/init.d/keyboard-setup start" +#} +#task acpid { +# description = "Starting ACPI Daemon" +# runlevel = "S" +# command = "/etc/init.d/acpid start" +#} +#task kbd { +# description = "Preparing console" +# runlevel = "S" +# command = "/etc/init.d/kbd start" +#} +#run networking { +# description = "Start networking" +# runlevel = "2" +# command = "/etc/init.d/networking start" +#} # Services to be monitored and respawned as needed -# klgod and syslogd are placed in the maint cgroup -cgroup.maint -service [2345] klogd -n -- Kernel logging server -service [2345] syslogd -n -- Syslog server +# klogd and syslogd are placed in the maint cgroup. There is no +# "current cgroup" to switch in this format, every block names its own. +service klogd { + description = "Kernel logging server" + runlevel = "2345" + conditions = { "pid/syslogd" } + cgroup maint {} + command = "klogd -n" +} +service syslogd { + description = "Syslog server" + runlevel = "2345" + cgroup maint {} + command = "syslogd -n" +} -# gdm in the system cgroup (default when read from it's own .conf file) -cgroup.system -service [3] cgroup:cpu.weight:250,mem.max:10M gdm -- GNOME Display Manager +# gdm gets its own limits inside the system group, which is where +# services end up when no cgroup block is given. +service gdm { + description = "GNOME Display Manager" + runlevel = "3" + cgroup system { + cpu.weight = 250 + memory.max = 10M + } + command = "gdm" +} # Start SSH daemon with opts from /etc/default/ssh (if available), move -# to user cgroup with cpu.weight:250. Default for services is system -# group. Default weight in user group is 100 (above). Max length of -# cgroup argument is (currently) 63 chars. -# -# Notice alternative syntax where current cgroup is only set for this -# particular service. -service [2345] cgroup.user:cpu.weight:250,mem.max:10M env:-/etc/default/ssh /usr/sbin/sshd -D $SSHD_OPTS -- OpenSSH daemon +# to user cgroup with cpu.weight 250. Default weight in the user group +# is 100 (above). +service sshd { + description = "OpenSSH daemon" + runlevel = "2345" + envfile = "-/etc/default/ssh" + cgroup user { + cpu.weight = 250 + memory.max = 10M + } + command = "/usr/sbin/sshd -D $SSHD_OPTS" +} # The BusyBox ntpd does not use syslog when running in the foreground # So we use this trick to redirect stdout/stderr to a log file. The # log file is rotated with the above settings. The condition declares -# a dependency on a system default route (gateway) to be set. A single -# at the beginning means ntpd does not respect SIGHUP for restart. -service [2345] log:/var/log/ntpd.log ntpd -n -l -I eth0 -- NTP daemon +# a dependency on a system default route (gateway) to be set. ntpd +# does not respect SIGHUP, so Finit restarts it on reload instead. +service ntpd { + description = "NTP daemon" + runlevel = "2345" + conditions = { "net/route/default" } + reload-signal = "none" + log { file = "/var/log/ntpd.log" } + command = "ntpd -n -l -I eth0" +} # Run start scripts from this directory -# runparts /etc/start.d +#runparts = "/etc/start.d" -# For multiple instances of the same service, add :ID somewhere between -# the service/run/task keyword and the command. -service :80 [2345] /sbin/httpd -f -h /http -p 80 -- Web server -service :8080 [2345] /sbin/httpd -f -h /http -p 8080 -- Old web server +# For multiple instances of the same service, add :ID to the block title. +service httpd:80 { + description = "Web server" + runlevel = "2345" + command = "/sbin/httpd -f -h /http -p 80" +} +service httpd:8080 { + description = "Old web server" + runlevel = "2345" + command = "/sbin/httpd -f -h /http -p 8080" +} diff --git a/contrib/void/finit.conf b/contrib/void/finit.conf index e16dec3e..e0830ae8 100644 --- a/contrib/void/finit.conf +++ b/contrib/void/finit.conf @@ -3,24 +3,34 @@ ## Runlevel to start after bootstrap, runlevel 'S' # Default is 2 -#runlevel 2 +#runlevel = 2 # Top-level cgroups and their default settings. All groups mandatory # but more can be added, max 8 groups in total currently. The cgroup # 'root' is also available, reserved for RT processes. Settings are # as-is, only one shorthand 'mem.' exists, other than that it's the # cgroup v2 controller default names. -#cgroup init cpu.weight:100 -#cgroup user cpu.weight:100 -#cgroup system cpu.weight:9700 +#cgroup init { cpu.weight = 100 } +#cgroup user { cpu.weight = 100 } +#cgroup system { cpu.weight = 9700 } # Task to run if ctrl-alt-del is pressed. This condition is asserted by # Finit upon receiving SIGINT (from the kernel). -#task [12345789] initctl reboot -- Rebooting system +#task reboot { +# description = "Rebooting system" +# runlevel = "12345789" +# conditions = { "sys/key/ctrlaltdel" } +# command = "initctl reboot" +#} # Task to run if the kernel gets a power fail condition is pressed. # Asserted by Finit upon receiving SIGPWR (from the kernel). -#task [12345789] initctl poweroff -- Shutting down system +#task poweroff { +# description = "Shutting down system" +# runlevel = "12345789" +# conditions = { "sys/pwr/fail" } +# command = "initctl poweroff" +#} ## Bootstrap services and tasks # Can be listed here or in /etc/finit.d/*.conf diff --git a/contrib/void/finit.d/available/acpid.conf b/contrib/void/finit.d/available/acpid.conf index 4cf422a5..f37354bf 100644 --- a/contrib/void/finit.d/available/acpid.conf +++ b/contrib/void/finit.d/available/acpid.conf @@ -1,3 +1,7 @@ # Handle PWR button to shutdown/reboot -- useful in Qemu (virt-manager) # Depends on syslogd having started. Redirect any output to log. -service [2345] acpid -f -- ACPI daemon +service acpid { + description = "ACPI daemon" + runlevel = "2345" + command = "acpid -f" +} diff --git a/contrib/void/finit.d/available/crond.conf b/contrib/void/finit.d/available/crond.conf index 1ee0538a..17174f61 100644 --- a/contrib/void/finit.d/available/crond.conf +++ b/contrib/void/finit.d/available/crond.conf @@ -1 +1,6 @@ -service [2345] crond -f -S -c /etc/crontabs -- Cron daemon +service crond { + description = "Cron daemon" + runlevel = "2345" + conditions = { "pid/syslogd" } + command = "crond -f -S -c /etc/crontabs" +} diff --git a/contrib/void/finit.d/available/dhcpcd.conf b/contrib/void/finit.d/available/dhcpcd.conf index 67a411e6..109a3ce8 100644 --- a/contrib/void/finit.d/available/dhcpcd.conf +++ b/contrib/void/finit.d/available/dhcpcd.conf @@ -1 +1,5 @@ -service [2345] dhcpcd -B -M -- DHCP client +service dhcpcd { + description = "DHCP client" + runlevel = "2345" + command = "dhcpcd -B -M" +} diff --git a/contrib/void/finit.d/available/dmeventd.conf b/contrib/void/finit.d/available/dmeventd.conf index 1d4fe6e0..3e3cafe0 100644 --- a/contrib/void/finit.d/available/dmeventd.conf +++ b/contrib/void/finit.d/available/dmeventd.conf @@ -1 +1,5 @@ -service [S12345] dmeventd -f -- Device mapper event daemon +service dmeventd { + description = "Device mapper event daemon" + runlevel = "S12345" + command = "dmeventd -f" +} diff --git a/contrib/void/finit.d/available/getty.conf b/contrib/void/finit.d/available/getty.conf index 6d31e47d..cf5cb613 100644 --- a/contrib/void/finit.d/available/getty.conf +++ b/contrib/void/finit.d/available/getty.conf @@ -1,4 +1,19 @@ # Consoles to start Finit built-in getty on when system is up -tty [12345] /dev/tty1 noclear nowait -tty [2345] /dev/tty2 noclear nowait -tty [2345] /dev/tty3 noclear nowait +tty tty1 { + runlevel = "12345" + device = "/dev/tty1" + noclear = true + nowait = true +} +tty tty2 { + runlevel = "2345" + device = "/dev/tty2" + noclear = true + nowait = true +} +tty tty3 { + runlevel = "2345" + device = "/dev/tty3" + noclear = true + nowait = true +} diff --git a/contrib/void/finit.d/available/keymap.conf b/contrib/void/finit.d/available/keymap.conf index 203253b3..e73dede8 100644 --- a/contrib/void/finit.d/available/keymap.conf +++ b/contrib/void/finit.d/available/keymap.conf @@ -1,2 +1,6 @@ # Oneshot task to run once at bootstrap -task [S] zcat /etc/keymap/se.bmap.gz | loadkmap -- Loading keymap +task keymap { + description = "Loading keymap" + runlevel = "S" + command = "zcat /etc/keymap/se.bmap.gz | loadkmap" +} diff --git a/contrib/void/finit.d/available/lxdm.conf b/contrib/void/finit.d/available/lxdm.conf index 51354ba5..ff4c2d96 100644 --- a/contrib/void/finit.d/available/lxdm.conf +++ b/contrib/void/finit.d/available/lxdm.conf @@ -1 +1,5 @@ -service [2345] lxdm -- Lightweight Login Manager +service lxdm { + description = "Lightweight Login Manager" + runlevel = "2345" + command = "lxdm" +} diff --git a/contrib/void/finit.d/available/modules.conf b/contrib/void/finit.d/available/modules.conf index 39aab7be..6fd5b180 100644 --- a/contrib/void/finit.d/available/modules.conf +++ b/contrib/void/finit.d/available/modules.conf @@ -1,7 +1,3 @@ ## Linux kernel modules to load -#module fbcon -#module button -#module evdev -#module mousedev -#module 8139cp -module softdog +# Other candidates: fbcon, button, evdev, mousedev, 8139cp +modules = { "softdog" } diff --git a/contrib/void/finit.d/available/ntpd.conf b/contrib/void/finit.d/available/ntpd.conf index ff443ab1..dea14b8e 100644 --- a/contrib/void/finit.d/available/ntpd.conf +++ b/contrib/void/finit.d/available/ntpd.conf @@ -1,2 +1,8 @@ # Silly Busybox ntpd has no option to use syslog when running in foreground -service [2345] log ntpd -n -N -p pool.ntp.org -- NTP daemon +service ntpd { + description = "NTP daemon" + runlevel = "2345" + conditions = { "pid/syslogd" } + log { } + command = "ntpd -n -N -p pool.ntp.org" +} diff --git a/contrib/void/finit.d/available/sshd.conf b/contrib/void/finit.d/available/sshd.conf index c85370e2..7739423c 100644 --- a/contrib/void/finit.d/available/sshd.conf +++ b/contrib/void/finit.d/available/sshd.conf @@ -1,2 +1,6 @@ # Start SSH daemon as soon as basic networking comes up -service [2345] /usr/sbin/sshd -D -- OpenSSH daemon +service sshd { + description = "OpenSSH daemon" + runlevel = "2345" + command = "/usr/sbin/sshd -D" +} diff --git a/contrib/void/finit.d/available/syslog.conf b/contrib/void/finit.d/available/syslog.conf index eb45f125..60423cff 100644 --- a/contrib/void/finit.d/available/syslog.conf +++ b/contrib/void/finit.d/available/syslog.conf @@ -1,4 +1,13 @@ # Start syslogd as soon as possible, should always run # Start klogd as soon as possible, but after syslogd -service [S12345] syslogd -n -- Syslog daemon -service [S12345] klogd -n -- Kernel log daemon +service syslogd { + description = "Syslog daemon" + runlevel = "S12345" + command = "syslogd -n" +} +service klogd { + description = "Kernel log daemon" + runlevel = "S12345" + conditions = { "pid/syslogd" } + command = "klogd -n" +} diff --git a/contrib/void/finit.d/available/uuidd.conf b/contrib/void/finit.d/available/uuidd.conf index 9841d338..587127f7 100644 --- a/contrib/void/finit.d/available/uuidd.conf +++ b/contrib/void/finit.d/available/uuidd.conf @@ -1 +1,7 @@ -service @uuidd:uuidd [2345] uuidd -F -- UUID generation daemon +service uuidd { + description = "UUID generation daemon" + runlevel = "2345" + user = "uuidd" + group = "uuidd" + command = "uuidd -F" +} diff --git a/system/10-hotplug.conf.in b/system/10-hotplug.conf.in index 85cb09ce..873cfe37 100644 --- a/system/10-hotplug.conf.in +++ b/system/10-hotplug.conf.in @@ -5,51 +5,151 @@ # often needs to be synchronized carefully, we suggest using your system log # daemon as the barrier for all other services. E.g.: # -# service if:udevd [S0123456789] syslogd -F -- System log daemon -# service if:mdev [S0123456789] syslogd -F -- System log daemon -# service if:mdevd [S0123456789] syslogd -F -- System log daemon +# service syslogd { +# description = "System log daemon" +# runlevel = "S0123456789" +# if = "udevd" +# conditions = { "run/udevadm:5/success" } +# command = "syslogd -F" +# } +# +# with `if = "mdev"` or `if = "mdevd"` and the matching coldplug condition +# for those variants. # # This provdes a condition that can act as a barrier for all -# other services. Notice the `if:` statement and the condition for starting +# other services. Notice the `if` setting: the condition for starting # syslogd is only considered if either udevd or mdev (service) is loaded and # is guaranteed to run after each respective run stanza have completed. # # Override this file by copying it to /etc/finit.d/, using the same name, then # change the contents any way you like, it can even be empty. +# +# The leading '-' on every command says a missing binary is expected here, so +# the block is skipped quietly and the next candidate gets its turn. # Check for systemd-udevd and eudev, if we find both, we opt for the latter. -service nowarn cgroup.system,name:udevd name:udevd notify:none env:-/etc/default/udevd pid:udevd log \ - [S12345789] /lib/systemd/systemd-udevd $UDEVD_ARGS -- Device event daemon (udev) -service nowarn cgroup.system,name:udevd name:udevd notify:none env:-/etc/default/udevd pid:udevd log \ - [S12345789] udevd $UDEVD_ARGS -- Device event daemon (udev) +service udevd { + description = "Device event daemon (udev)" + runlevel = "S12345789" + notify = "none" + envfile = "-/etc/default/udevd" + pidfile = "udevd" + pidfile-create = true + log { } + cgroup system { name = "udevd" } + command = "-/lib/systemd/systemd-udevd $UDEVD_ARGS" +} +service udevd { + description = "Device event daemon (udev)" + runlevel = "S12345789" + notify = "none" + envfile = "-/etc/default/udevd" + pidfile = "udevd" + pidfile-create = true + log { } + cgroup system { name = "udevd" } + command = "-udevd $UDEVD_ARGS" +} # Wait for udevd to start, then trigger coldplug events and module loading. # The last 'settle' call waits for it to finalize processing all uevents. -run nowarn if:udevd cgroup.init,name:udevadm :1 [S] log udevadm settle -t 0 -- -run nowarn if:udevd cgroup.init,name:udevadm :2 [S] log udevadm control --reload -- -run nowarn if:udevd cgroup.init,name:udevadm :3 [S] log udevadm trigger -c add -t devices -- Requesting device events -run nowarn if:udevd cgroup.init,name:udevadm :4 [S] log udevadm trigger -c add -t subsystems -- Requesting subsystem events -run nowarn if:udevd cgroup.init,name:udevadm :5 [S] log udevadm settle -t 30 -- Waiting for udev to finish +run udevadm:1 { + runlevel = "S" + if = "udevd" + conditions = { "service/udevd/ready" } + log { } + cgroup init { name = "udevadm" } + command = "-udevadm settle -t 0" +} +run udevadm:2 { + runlevel = "S" + if = "udevd" + conditions = { "service/udevd/ready" } + log { } + cgroup init { name = "udevadm" } + command = "-udevadm control --reload" +} +run udevadm:3 { + description = "Requesting device events" + runlevel = "S" + if = "udevd" + conditions = { "service/udevd/ready" } + log { } + cgroup init { name = "udevadm" } + command = "-udevadm trigger -c add -t devices" +} +run udevadm:4 { + description = "Requesting subsystem events" + runlevel = "S" + if = "udevd" + conditions = { "service/udevd/ready" } + log { } + cgroup init { name = "udevadm" } + command = "-udevadm trigger -c add -t subsystems" +} +run udevadm:5 { + description = "Waiting for udev to finish" + runlevel = "S" + if = "udevd" + conditions = { "service/udevd/ready" } + log { } + cgroup init { name = "udevadm" } + command = "-udevadm settle -t 30" +} # If udevd is not available, check for mdevd. Unlike plain 'mdev -df', the # mdevd-coldplug process exits when mdevd has completed. So the condition -# (same as for plain mdev below) can be relied on as a -# barrier for services that, e.g., need to probe for switchcore ports or PHYs -# that require firmware loading before they show up. -service nowarn conflict:udevd,mdev cgroup.init,name:mdevd notify:none if:!udevd \ - [S12345789] notify:s6 mdevd -O 4 -D %n -- Device event daemon (mdevd) -run nowarn conflict:udevd,mdev cgroup.init,name:coldplug \ - [S] mdevd-coldplug -- Cold plugging system +# can be relied on as a barrier for services +# that, e.g., need to probe for switchcore ports or PHYs that require +# firmware loading before they show up. +service mdevd { + description = "Device event daemon (mdevd)" + runlevel = "S12345789" + if = "!udevd" + conflicts = { "udevd", "mdev" } + notify = "s6" + cgroup init { name = "mdevd" } + command = "-mdevd -O 4 -D %n" +} + +# NOTE: this block is named for its command, so its barrier condition is +# , not the the +# plain mdev stanza below provides. The legacy line spelled the +# name inside the cgroup argument, where it names the cgroup leaf +# rather than the service, and the two paths have differed ever +# since. Left as it was so boot ordering does not change. +run mdevd-coldplug { + description = "Cold plugging system" + runlevel = "S" + conflicts = { "udevd", "mdev" } + conditions = { "service/mdevd/ready" } + cgroup init { name = "coldplug" } + command = "-mdevd-coldplug" +} # If neither udevd or mdevd are available, fall back to mdev. The new daemon # mode calls `mdev -s` internally but does not create a PID file when that is # done, so synchronization with coldplug is fragile. -service nowarn conflict:udevd,mdevd cgroup.init,name:mdev notify:none if:!udevd,!mdevd \ - [S12345789] mdev -df -S -- Device event daemon (mdev) +service mdev { + description = "Device event daemon (mdev)" + runlevel = "S12345789" + if = "!udevd,!mdevd" + conflicts = { "udevd", "mdevd" } + notify = "none" + cgroup init { name = "mdev" } + command = "-mdev -df -S" +} # Trigger a replay of all uevents from boot, before userspace was up and the # filesystem mounted. Compared to udevd, we don't know when 'mdev -df' has # finished processing all events, i.e., depending on is # not an indicator of all devices having been (re)discovered and fully set up. -run nowarn conflict:udevd,mdevd cgroup.init name:coldplug if:mdev \ - [S] @pkglibexecdir@/coldplug -- Cold plugging system +run coldplug { + description = "Cold plugging system" + runlevel = "S" + if = "mdev" + conflicts = { "udevd", "mdevd" } + conditions = { "service/mdev/running" } + cgroup init {} + command = "-@pkglibexecdir@/coldplug" +} diff --git a/system/90-testserv.conf b/system/90-testserv.conf index d165f88e..0d677e11 100644 --- a/system/90-testserv.conf +++ b/system/90-testserv.conf @@ -1,4 +1,10 @@ # Test service, only used for `make check`, not for public use -service [S123456789] name:testserv pid:!/run/testserv.pid \ - cgroup.system notify:none \ - /sbin/serv -n -p -i testserv -- Test serv daemon +service testserv { + description = "Test serv daemon" + runlevel = "S123456789" + conditions = { "boot/testserv" } + notify = "none" + pidfile = "/run/testserv.pid" + cgroup system {} + command = "/sbin/serv -n -p -i testserv" +}