shit
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# Default boot target. dinit starts this service as PID 1; it pulls in the
|
||||
# rest of the system. waits-for (rather than depends-on) keeps the machine
|
||||
# coming up even if an individual service fails.
|
||||
type = internal
|
||||
waits-for = early-fs
|
||||
waits-for = udevd
|
||||
waits-for = udev-trigger
|
||||
waits-for = seatd
|
||||
waits-for = tty1
|
||||
@@ -0,0 +1,4 @@
|
||||
# Mount the early virtual filesystems needed before anything else runs.
|
||||
type = scripted
|
||||
command = /etc/dinit.d/scripts/early-fs.sh
|
||||
restart = false
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
# Bring up the kernel virtual filesystems and runtime dirs before other
|
||||
# services start. Safe to re-run: each mount is guarded by mountpoint checks.
|
||||
set -eu
|
||||
export PATH=/usr/bin:/usr/sbin:/bin:/sbin
|
||||
|
||||
mountpoint -q /proc || mount -t proc proc /proc
|
||||
mountpoint -q /sys || mount -t sysfs sysfs /sys
|
||||
mountpoint -q /dev || mount -t devtmpfs devtmpfs /dev
|
||||
mkdir -p /dev/pts /dev/shm
|
||||
mountpoint -q /dev/pts || mount -t devpts devpts /dev/pts
|
||||
mountpoint -q /dev/shm || mount -t tmpfs tmpfs /dev/shm
|
||||
# NOTE: /run is intentionally NOT remounted here. dinit (PID 1) binds its
|
||||
# control socket under /run before this script runs; on the all-RAM initramfs
|
||||
# boot /run is already writable, and a fresh tmpfs mount would hide that socket.
|
||||
# (A disk-rooted system should instead mount /run before starting dinit.)
|
||||
mkdir -p /run/user /run/udev
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# Coldplug devices that already existed before udevd started: replay "add"
|
||||
# uevents for subsystems then devices, and wait for processing to finish so
|
||||
# DRM/input nodes (and their autoloaded modules) are present before Weston.
|
||||
set -eu
|
||||
export PATH=/usr/bin:/usr/sbin:/bin:/sbin
|
||||
|
||||
udevadm trigger --action=add --type=subsystems
|
||||
udevadm trigger --action=add --type=devices
|
||||
udevadm settle || true
|
||||
|
||||
# Safety net for QEMU/virtio: ensure the virtio-gpu DRM driver is loaded even if
|
||||
# coldplug autoload missed it. (Input/evdev is built into the kernel.)
|
||||
modprobe virtio_gpu 2>/dev/null || true
|
||||
@@ -0,0 +1,6 @@
|
||||
# Seat management daemon. Weston (via libseat) asks seatd to open DRM/input
|
||||
# devices, so no logind is needed. The "seat" group may use the seatd socket.
|
||||
type = process
|
||||
command = /usr/bin/seatd -g seat
|
||||
restart = true
|
||||
depends-on = early-fs
|
||||
@@ -0,0 +1,7 @@
|
||||
# Autologin getty on tty1. login runs the user's profile, which launches Weston
|
||||
# (see /etc/profile.d/weston.sh shipped by base-files).
|
||||
type = process
|
||||
command = /usr/bin/agetty --autologin user --noclear --login-program /usr/bin/login tty1 linux
|
||||
restart = true
|
||||
depends-on = seatd
|
||||
depends-on = udev-trigger
|
||||
@@ -0,0 +1,5 @@
|
||||
# Coldplug: replay add events so udev autoloads DRM/input modules, then settle.
|
||||
type = scripted
|
||||
command = /etc/dinit.d/scripts/udev-trigger.sh
|
||||
restart = false
|
||||
depends-on = udevd
|
||||
@@ -0,0 +1,5 @@
|
||||
# eudev device manager daemon (udevd). Loads/uevents DRM/input drivers.
|
||||
type = process
|
||||
command = /usr/bin/udevd
|
||||
restart = true
|
||||
depends-on = early-fs
|
||||
@@ -0,0 +1,51 @@
|
||||
version = "0.20.0"
|
||||
revision = 1
|
||||
description = "Service manager / init system (dinit)"
|
||||
license = "Apache-2.0"
|
||||
url = "https://davmac.org/projects/dinit/"
|
||||
source = tarball(
|
||||
url=f"https://github.com/davmac314/dinit/archive/refs/tags/v{version}.tar.gz",
|
||||
sha256="cd75b572a2eab4a9bd0610a2bb8cc154da7e80074e61cb1059a996dfd977baae",
|
||||
)
|
||||
host_deps = ["binutils", "gcc", "pkgconf"]
|
||||
deps = [profile["libc"], "libstdc++"]
|
||||
|
||||
|
||||
def configure(self):
|
||||
# dinit's hand-written configure expects an in-tree build and reads the
|
||||
# toolchain from the environment; CXX_FOR_BUILD compiles its small build-time
|
||||
# helper with the native compiler.
|
||||
self.run("cp", "-rp", f"{self.source_dir}/.", self.build_dir)
|
||||
self.run(
|
||||
"./configure",
|
||||
"--prefix=/usr",
|
||||
"--sbindir=/usr/bin",
|
||||
"--enable-utmpx",
|
||||
"--enable-shutdown",
|
||||
"--disable-strip",
|
||||
env={
|
||||
"CXX": f"{self.triple}-g++",
|
||||
"CXX_FOR_BUILD": "g++",
|
||||
# dinit 0.20.0 uses std::allocator<T>::construct(), removed from the
|
||||
# default C++ mode in GCC 16's libstdc++; build it as C++17 where it
|
||||
# still exists.
|
||||
"CXXFLAGS": self.options["cxxflags"] + " -std=gnu++17",
|
||||
"LDFLAGS": self.options["ldflags"],
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def build(self):
|
||||
self.run("make", f"-j{self.jobs}")
|
||||
|
||||
|
||||
def install(self):
|
||||
self.run("make", "install", f"DESTDIR={self.dest_dir}")
|
||||
# Ship the dinit service set (boot target + udev/seatd/agetty services).
|
||||
self.run("install", "-d", self.dest_dir / "etc/dinit.d")
|
||||
self.run(
|
||||
"sh",
|
||||
"-c",
|
||||
f"cp -rp {self.files}/dinit.d/. {self.dest_dir}/etc/dinit.d/ && "
|
||||
f"chmod +x {self.dest_dir}/etc/dinit.d/scripts/*.sh",
|
||||
)
|
||||
Reference in New Issue
Block a user