home / codeberg / blog / docs


dinit configuration

to install dinit

git clone --depth=1 https://github.com/davmac314/dinit.git
cd dinit && ./configure --prefix=/usr
make -j$(nproc)
make install
ln -sf /usr/bin/dinit /sbin/init

then, make services in /etc/dinit.d/. You can make it by yourself, but if you dont know how to do it, use my simple service files

/etc/dinit.d/scripts/mount.sh

#!/bin/sh -ue

mount -t proc proc /proc
mount -t sysfs sysfs /sys
mount -t tmpfs tmpfs /run
mount -t tmpfs tmpfs /tmp
mount -t devtmpfs devtmpfs /dev
mkdir /dev/pts /dev/shm

mount -t devpts devpts /dev/pts -o mode=0620,gid=5
mount -t tmpfs tmpfs /dev/shm -o mode=1777
mkdir /run/lock

/etc/dinit.d/mount

type = scripted
command = /bin/sh /etc/dinit.d/scripts/mount.sh
options = starts-rwfs

/etc/dinit.d/tty1

type = process
command = /sbin/agetty --noclear tty1 38400 linux
depends-on: mount
restart = true
termsignal = HUP

/etc/dinit.d/scripts/net.sh

#!/bin/sh -ue
ip link set lo up
ip link set eth0 up
dhcpcd eth0 -B

/etc/dinit.d/net

type = process
command = /bin/sh /etc/dinit.d/scripts/net.sh
waits-for = mount

/etc/dinit.d/hostname

type = scripted
command = /bin/hostname -F /etc/hostname

/etc/dinit.d/boot

type = internal
waits-for = mount
waits-for = net
waits-for = tty1

I kind of stole it from jlxip LFS video and from void_dinit