mirror of
https://github.com/troglobit/finit.git
synced 2026-10-27 12:20:54 +00:00
contrib, system: convert the shipped .conf files to the block format
The examples people copy from were still written in the line-based
format, so the block format was documented but nowhere demonstrated.
Two names in contrib were accidents of the old format, where the
service name falls out of the command basename: the Alpine and Void
keymap task was called zcat, and Debian's console/keyboard setup tasks
carried a .sh suffix. They now carry the name their file implies.
Nothing referenced the old names.
The mdevd coldplug path keeps the name it has always had. Its legacy
line spelled the name inside the cgroup argument, where it names the
cgroup leaf and not the service, so the barrier condition really is
<run/mdevd-coldplug/success> and not the <run/coldplug/success> the
comment above it promises. Converted as-is so boot ordering does not
change; the discrepancy is now written down where it happens.
A list may not contain comments, the lexer sees the entries after the
'#' regardless:
modules = {
# "fbcon",
"softdog"
}
so the commented-out module candidates sit above the list instead.
setup-sysroot.sh removes 10-hotplug.conf from the test sysroot, so that
file is covered by parsing only, not by make check.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
46 files changed
+587
-156
No files matched your search
+107
-43
@@ -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 <sys/key/ctrlaltdel> [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 <sys/pwr/fail> [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] <pid/syslogd> 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] <!net/route/default> 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"
|
||||
}
|
||||
Reference in new issue
Block a user