mirror of
https://github.com/pithings/unkernel.git
synced 2026-12-07 02:47:45 +08:00
guest: preinstall dbus-daemon in the Debian image, for session buses (dbus-run-session; nothing starts at boot): 0.5 MiB more erofs, the same 4 MiB boot prefetch; the image leaves out D-Bus's random machine id, which kw-init makes once per machine, a second after the console starts (during the boot it delays the prompt by 15 ms)
This commit is contained in:
@@ -379,7 +379,9 @@ layer: boot to a prompt 0.25 s (Alpine) and 0.32 s (Debian) from
|
||||
image only; the page's boot (`kw.wayland=1`) reads it, and the build's
|
||||
traced boots boot as the page does (`KW_TRACE_BOOT` in
|
||||
`guest/lib/image.sh`), so it is in the boot set.
|
||||
`DEBIAN_PACKAGES` in build.sh (curl, ca-certificates, unzip) are
|
||||
`DEBIAN_PACKAGES` in build.sh (curl, ca-certificates, unzip, dbus-daemon
|
||||
for session buses, which starts nothing at boot: kw-init makes its
|
||||
machine id, which the image leaves out, once per machine) are
|
||||
installed at build time by the image's apt in the same build VM, from
|
||||
.debs the host fetches from snapshot.debian.org (checked against the
|
||||
baked lists); the install's changes to the overlay's upper layer are
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
# by the image's apt at build time (needs the
|
||||
# base bundle and node; else left out)
|
||||
# curl, wget, ca-certificates, unzip, procps, less, vim-tiny, xz-utils, zstd,
|
||||
# iproute2, htop, tmux, sudo, libatomic1, sysv-rc installed
|
||||
# iproute2, htop, tmux, sudo, libatomic1, sysv-rc, dbus-daemon installed
|
||||
# (DEBIAN_PACKAGES, below; needs the same)
|
||||
# /usr/lib/kw-commands "NAME PACKAGE" per command of main, for
|
||||
# kw-apt-install (command not found:
|
||||
@@ -222,7 +222,9 @@ chmod 755 "$stage/usr/lib/kw/wlandr"
|
||||
# libatomic1: the official Node.js build links it (the kw layer's node shim).
|
||||
# sysv-rc (with insserv and startpar): the service runner kw-init drives
|
||||
# (below, and rootfs/usr/local/sbin/kw-init).
|
||||
DEBIAN_PACKAGES="curl wget ca-certificates unzip procps less vim-tiny xz-utils zstd iproute2 htop tmux sudo libatomic1 sysv-rc"
|
||||
# dbus-daemon: session buses for desktop apps (dbus-run-session); nothing
|
||||
# starts at boot (the system bus is the package dbus).
|
||||
DEBIAN_PACKAGES="curl wget ca-certificates unzip procps less vim-tiny xz-utils zstd iproute2 htop tmux sudo libatomic1 sysv-rc dbus-daemon"
|
||||
# Both are made by the image's own programs: the tree as it is at that
|
||||
# point becomes a first image (erofs, uncompressed), which boots on the
|
||||
# distroless bundle (guest/tools/vm-run.ts); files come out over exec's
|
||||
@@ -244,8 +246,9 @@ DEBIAN_PACKAGES="curl wget ca-certificates unzip procps less vim-tiny xz-utils z
|
||||
# (maintainer scripts included: update-ca-certificates fills
|
||||
# /etc/ssl/certs, update-alternatives /etc/alternatives). What the install
|
||||
# created or changed in the root overlay's upper layer (ctime after a
|
||||
# stamp; not /var/log, ldconfig's aux-cache with its inode numbers, apt's
|
||||
# caches or the .debs) comes out as a tar and goes into the tree, and what
|
||||
# stamp; not /var/log, ldconfig's aux-cache with its inode numbers, D-Bus's
|
||||
# random machine id (kw-init makes one per machine), apt's caches or the
|
||||
# .debs) comes out as a tar and goes into the tree, and what
|
||||
# it deleted (whiteouts) is deleted there; mktree.py then gives the new
|
||||
# files root:root, their modes and the upstream epoch, so a rebuild is
|
||||
# identical.
|
||||
@@ -313,7 +316,7 @@ else
|
||||
cd $u
|
||||
find . -mindepth 1 -cnewer /tmp/kw-stamp -type c | sort > /tmp/kw-gone
|
||||
find . -mindepth 1 -cnewer /tmp/kw-stamp ! -type c ! -path './var/log/*' \\
|
||||
! -path ./var/cache/ldconfig/aux-cache ! -path './var/cache/apt/*' ! -path './kw-debs*' | sort > /tmp/kw-list
|
||||
! -path ./var/cache/ldconfig/aux-cache ! -path ./var/lib/dbus/machine-id ! -path './var/cache/apt/*' ! -path './kw-debs*' | sort > /tmp/kw-list
|
||||
tar -cf /tmp/kw-pkgs.tar --no-recursion --numeric-owner -T /tmp/kw-list" ||
|
||||
{ echo "debian: installing $DEBIAN_PACKAGES in the image failed" >&2; exit 1; }
|
||||
rm -rf "$archives"
|
||||
|
||||
@@ -61,6 +61,13 @@ console() { setsid -c /usr/bin/kwbox tty login <>/dev/hvc0 >&0 2>&0 & role[$!]=c
|
||||
kwtty() { { /usr/lib/kw/net wait 2>/dev/null; exec /usr/bin/kwbox tty serve; } </dev/null & role[$!]=kwtty; started[$!]=$SECONDS; }
|
||||
console
|
||||
kwtty
|
||||
# D-Bus's machine id, once per machine (the image has none, else every
|
||||
# machine would share it): dbus-daemon's postinst makes it on a Debian
|
||||
# system. A second later: made here at once, it delays the prompt by 15 ms
|
||||
# (2026-11-25).
|
||||
if [ -d /var/lib/dbus ] && [ ! -s /var/lib/dbus/machine-id ] && [ ! -s /etc/machine-id ]; then
|
||||
{ sleep 1; read -r id < /proc/sys/kernel/random/uuid && echo "${id//-/}" > /var/lib/dbus/machine-id; } </dev/null &
|
||||
fi
|
||||
while [ -z "$action" ]; do
|
||||
pid=
|
||||
# Returns for one of our children, or when a trapped signal arrives.
|
||||
|
||||
Reference in New Issue
Block a user