bajia/etc/init.rc

65 lines
1.9 KiB
Text
Raw Normal View History

2026-08-27 19:08:08 +01:00
# bajia init.rc - example configuration for an embedded/VM system.
#
# constructs:
# service NAME /path/to/exe [args...]
2026-08-27 22:50:44 +01:00
# user = ... | group = ... | class = ... | respawn = ... | crash-threshold = ...
# crash-window = ... | setenv = ... | cwd = ... | seclabel = ...
2026-08-28 23:24:19 +01:00
# logfile = ... | depends = ...
2026-08-27 22:50:44 +01:00
# oneshot | disabled | console (flag options, no value)
2026-08-27 19:08:08 +01:00
#
# on TRIGGER
# start NAME | stop NAME | restart NAME
# exec /cmd args... (run synchronously, wait to finish)
# mkdir PATH [mode]
# chmod PATH mode
# chown PATH uid gid
# setenv K V
# write PATH CONTENT
# symlink TARGET LINK
# mount SOURCE TARGET FSTYPE
2026-08-28 23:24:19 +01:00
# setprop KEY VALUE | getprop KEY
2026-08-27 19:08:08 +01:00
# log message...
#
# standard trigger sequence run at boot: early-init, init, boot.
2026-08-28 23:24:19 +01:00
# property:<key>=<value> actions fire when `setprop KEY VALUE` runs;
# service-started:<name> is on the roadmap.
2026-08-27 19:08:08 +01:00
on early-init
mount proc /proc proc
mount sysfs /sys sysfs
mount devtmpfs /dev devtmpfs
mkdir /dev/pts 0755
mount devpts /dev/pts devpts
mkdir /run 0755
mount tmpfs /run tmpfs
on init
exec /sbin/modprobe virtio_rng
write /proc/sys/kernel/hostname bajia
2026-08-28 23:24:19 +01:00
setprop config.ready 1
2026-08-27 19:08:08 +01:00
log **** bajia init on-line ****
2026-08-28 23:24:19 +01:00
on property:config.ready=1
log configuration is ready
2026-08-27 19:08:08 +01:00
on boot
start console
start watchdog
# the console service: bind stdio to /dev/console, always respawn.
service console /sbin/getty -L ttyS0 115200 vt100
2026-08-27 22:50:44 +01:00
class = core
2026-08-27 19:08:08 +01:00
console
2026-08-27 22:50:44 +01:00
user = root
2026-08-27 19:08:08 +01:00
# a long-lived example daemon. respawning is the default (always).
2026-08-28 23:24:19 +01:00
# logfile captures its stdout+stderr (parent dir /run exists via early-init).
2026-08-27 19:08:08 +01:00
service watchdog /usr/sbin/watchdog
2026-08-27 22:50:44 +01:00
class = core
respawn = always
2026-08-28 23:24:19 +01:00
logfile = /run/watchdog.log
2026-08-27 19:08:08 +01:00
# a one-shot job: runs once, exits, never respawns.
service boot-logo /usr/bin/show-boot-logo
2026-08-27 22:50:44 +01:00
class = late
2026-08-27 19:08:08 +01:00
oneshot