rats

RAdix iniT Suite
git clone https://git.daat.foo/repos/rats.git
Log | Files | Refs | README | LICENSE

commit 6880d2a9d9a124d4d22ebc0ac0f428785cee3101
parent c8bcb45a39aaf2a63681974aee0943238c4f3323
Author: cowmonk <cowmonk@based.pt>
Date:   Wed, 24 Jun 2026 20:26:16 +0000

Mount VFS with correct flags

Additionally added the `/dev/shm` to be mounted by default now for
wayland setups.

Diffstat:
MREADME | 9++++++++-
Morigo.c | 9++++++---
2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/README b/README @@ -34,7 +34,7 @@ Project Overview origo: PID 1 - minimal init. ---------------------------- -Mounts /proc /sys /dev /dev/pts, runs /etc/rc.boot, +Mounts /proc /sys /dev /dev/pts /dev/shm, runs /etc/rc.boot, spawns+respawns serva, handles poweroff/reboot/single-user. Signal mapping (same as sinit): - SIGINT -> reboot (CtrlAltDel) @@ -42,6 +42,13 @@ Signal mapping (same as sinit): - SIGUSR2 -> reboot - SIGTERM -> single-user +NOTE: origo won't mount `/run` nor `/tmp` to tmpfs because they are +optional in most setups. For users who want to mount these at boot, +you can edit your `/etc/fstab` to do so: This applies to those who +install the optional example rc.boot script but you can do so yourself +by invoking `mount -a` in your own rc.boot scripts to have your system +respect `/etc/fstab`. + origo will do the following on shutdown/reboot: 1. stopping serva (which stops all supervised services) 2. kills all remaining processes diff --git a/origo.c b/origo.c @@ -61,15 +61,18 @@ run_script(const char *path) static void mount_fs(void) { - if (mount("proc", "/proc", "proc", 0, NULL) < 0) + if (mount("proc", "/proc", "proc", MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME, NULL) < 0) weprintf("mount /proc:"); - if (mount("sysfs", "/sys", "sysfs", 0, NULL) < 0) + if (mount("sysfs", "/sys", "sysfs", MS_NODEV | MS_NOEXEC | MS_NOSUID | MS_RELATIME, NULL) < 0) weprintf("mount /sys:"); if (mount("devtmpfs", "/dev", "devtmpfs", 0, NULL) < 0) weprintf("mount /dev:"); mkdir("/dev/pts", 0755); - if (mount("devpts", "/dev/pts", "devpts", 0, NULL) < 0) + if (mount("devpts", "/dev/pts", "devpts", MS_NOSUID | MS_NOEXEC | MS_RELATIME, NULL) < 0) weprintf("mount /dev/pts:"); + mkdir("/dev/shm", 0755); + if (mount("tmpfs", "/dev/shm", "tmpfs", MS_NODEV | MS_NOSUID | MS_NOEXEC, NULL) < 0) + weprintf("mount /dev/shm:"); } /* reap: handle SIGCHLD, respawn serva if it died */