From 86ab11a54bd3dd4312cac39916fe32e110d2f0d1 Mon Sep 17 00:00:00 2001 From: Alexander Date: Wed, 24 Jun 2026 20:08:10 +0300 Subject: [PATCH] =?UTF-8?q?feat(v0.2):=20=D1=84=D0=B0=D0=B7=D0=BE=D0=B2?= =?UTF-8?q?=D1=8B=D0=B5=20systemd-=D1=82=D0=B0=D1=80=D0=B3=D0=B5=D1=82?= =?UTF-8?q?=D1=8B=20Stage=200/1/2=20+=20splash/warmup=20+=20=D0=B7=D0=BE?= =?UTF-8?q?=D0=BD=D1=82=D0=B8=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit P6.3: shturman.target → зонтик (Wants stage0/1/2). Новые: stage0/1/2.target, shturman-splash.service (Before=shell, минимум зависимостей → «мгновенно»), shturman-stage2-warmup.service (After=shell, маркер /run/shturman/stage2.ready), tmpfiles-shturman.conf (/run/shturman). Члены critical set → stage1.target (WantedBy+PartOf); у shell убран RuntimeDirectory (каталог теперь от tmpfiles). Co-Authored-By: Claude Opus 4.8 Signed-off-by: Alexander --- systemd/shturman-firstboot.service | 2 +- systemd/shturman-machineid.service | 2 +- systemd/shturman-power.service | 4 ++-- systemd/shturman-settings.service | 4 ++-- systemd/shturman-shell.service | 5 ++--- systemd/shturman-splash.service | 15 +++++++++++++++ systemd/shturman-stage0.target | 3 +++ systemd/shturman-stage1.target | 6 ++++++ systemd/shturman-stage2-warmup.service | 13 +++++++++++++ systemd/shturman-stage2.target | 4 ++++ systemd/shturman.target | 8 ++++---- systemd/tmpfiles-shturman.conf | 3 +++ 12 files changed, 56 insertions(+), 13 deletions(-) create mode 100644 systemd/shturman-splash.service create mode 100644 systemd/shturman-stage0.target create mode 100644 systemd/shturman-stage1.target create mode 100644 systemd/shturman-stage2-warmup.service create mode 100644 systemd/shturman-stage2.target create mode 100644 systemd/tmpfiles-shturman.conf diff --git a/systemd/shturman-firstboot.service b/systemd/shturman-firstboot.service index 59fef0c..320244d 100644 --- a/systemd/shturman-firstboot.service +++ b/systemd/shturman-firstboot.service @@ -11,4 +11,4 @@ RemainAfterExit=yes ExecStart=/usr/local/bin/shturman-firstboot [Install] -WantedBy=shturman.target +WantedBy=shturman-stage1.target diff --git a/systemd/shturman-machineid.service b/systemd/shturman-machineid.service index 739b57c..77e97ab 100644 --- a/systemd/shturman-machineid.service +++ b/systemd/shturman-machineid.service @@ -13,4 +13,4 @@ RemainAfterExit=yes ExecStart=/bin/sh -c '[ -e /etc/machine-id ] || : > /etc/machine-id; mount --bind /data/state/machine-id /etc/machine-id' [Install] -WantedBy=shturman.target +WantedBy=shturman-stage1.target diff --git a/systemd/shturman-power.service b/systemd/shturman-power.service index b6aab5f..70428e2 100644 --- a/systemd/shturman-power.service +++ b/systemd/shturman-power.service @@ -2,7 +2,7 @@ Description=Штурман Power (ru.shturman.Power1) Requires=data.mount shturman-firstboot.service After=data.mount shturman-firstboot.service shturman-machineid.service dbus.service -PartOf=shturman.target +PartOf=shturman-stage1.target [Service] ExecStart=/usr/local/bin/shturman-power @@ -11,4 +11,4 @@ RestartSec=2 OOMScoreAdjust=-600 [Install] -WantedBy=shturman.target +WantedBy=shturman-stage1.target diff --git a/systemd/shturman-settings.service b/systemd/shturman-settings.service index 088c437..9daa506 100644 --- a/systemd/shturman-settings.service +++ b/systemd/shturman-settings.service @@ -3,7 +3,7 @@ Description=Штурман Settings (ru.shturman.Settings1) # Requires+After firstboot: не стартуем против полу-провиженного /data (Wants недостаточно). Requires=data.mount shturman-firstboot.service After=data.mount shturman-firstboot.service shturman-machineid.service dbus.service -PartOf=shturman.target +PartOf=shturman-stage1.target [Service] ExecStart=/usr/local/bin/shturman-settings @@ -13,4 +13,4 @@ RestartSec=2 OOMScoreAdjust=-600 [Install] -WantedBy=shturman.target +WantedBy=shturman-stage1.target diff --git a/systemd/shturman-shell.service b/systemd/shturman-shell.service index f6d41bf..99dd23a 100644 --- a/systemd/shturman-shell.service +++ b/systemd/shturman-shell.service @@ -2,7 +2,7 @@ Description=Штурман Shell — первый Slint-кадр (software-render → PNG, §6) Requires=data.mount shturman-firstboot.service After=shturman-power.service shturman-settings.service shturman-machineid.service -PartOf=shturman.target +PartOf=shturman-stage1.target [Service] # v0.6: headless software-render кадра в PNG (спека §6 — основной автотест кадра, композитор не нужен). @@ -10,10 +10,9 @@ PartOf=shturman.target # Кадр читает ui.theme/Power с системной шины (After=power/settings) и пишет в tmpfs /run (volatile, A11). Type=oneshot RemainAfterExit=yes -RuntimeDirectory=shturman ExecStart=/usr/local/bin/shturman-shell --screenshot /run/shturman/frame.png TimeoutStartSec=30 OOMScoreAdjust=-600 [Install] -WantedBy=shturman.target +WantedBy=shturman-stage1.target diff --git a/systemd/shturman-splash.service b/systemd/shturman-splash.service new file mode 100644 index 0000000..3158815 --- /dev/null +++ b/systemd/shturman-splash.service @@ -0,0 +1,15 @@ +[Unit] +Description=Штурман splash (Stage 0, software-render → PNG) +# «Мгновенно»: без Requires=data.mount/dbus — стартует рано, параллельно critical set. +# Before=shell гарантирует splash.png раньше frame.png. /run/shturman даёт tmpfiles. +After=systemd-tmpfiles-setup.service +Before=shturman-shell.service + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/local/bin/shturman-splash --screenshot /run/shturman/splash.png +TimeoutStartSec=15 + +[Install] +WantedBy=shturman-stage0.target diff --git a/systemd/shturman-stage0.target b/systemd/shturman-stage0.target new file mode 100644 index 0000000..c50bd11 --- /dev/null +++ b/systemd/shturman-stage0.target @@ -0,0 +1,3 @@ +[Unit] +Description=Штурман Stage 0 — splash (мгновенно) +Wants=shturman-splash.service diff --git a/systemd/shturman-stage1.target b/systemd/shturman-stage1.target new file mode 100644 index 0000000..5397512 --- /dev/null +++ b/systemd/shturman-stage1.target @@ -0,0 +1,6 @@ +[Unit] +Description=Штурман Stage 1 — ядро + первый кадр +Requires=data.mount +After=data.mount +# Члены critical set (v0.1). Ordering — в самих юнитах (After=/Requires=). +Wants=shturman-firstboot.service shturman-machineid.service shturman-power.service shturman-settings.service shturman-shell.service diff --git a/systemd/shturman-stage2-warmup.service b/systemd/shturman-stage2-warmup.service new file mode 100644 index 0000000..f758072 --- /dev/null +++ b/systemd/shturman-stage2-warmup.service @@ -0,0 +1,13 @@ +[Unit] +Description=Штурман Stage 2 warmup (плейсхолдер фона) +# Деферред: после первого кадра. Каркас для реальных фоновых сервисов v1+ +# (Vehicle-Data/Assistant/Media/Nav). Пишет маркер — E2E проверяет «фаза разделена». +After=shturman-shell.service + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/bin/sh -c 'echo "stage2 warmup" | systemd-cat -t shturman-stage2; : > /run/shturman/stage2.ready' + +[Install] +WantedBy=shturman-stage2.target diff --git a/systemd/shturman-stage2.target b/systemd/shturman-stage2.target new file mode 100644 index 0000000..6729519 --- /dev/null +++ b/systemd/shturman-stage2.target @@ -0,0 +1,4 @@ +[Unit] +Description=Штурман Stage 2 — фон (после интерактива) +After=shturman-stage1.target +Wants=shturman-stage2-warmup.service diff --git a/systemd/shturman.target b/systemd/shturman.target index 6f0eec7..63a3944 100644 --- a/systemd/shturman.target +++ b/systemd/shturman.target @@ -1,10 +1,10 @@ [Unit] -Description=Штурман — v0 critical set (Stage 1: ядро + первый кадр) +Description=Штурман — v0 boot-конвейер (зонтик фаз Stage 0/1/2) Requires=data.mount After=data.mount -# Тянем членов critical set: `systemctl enable shturman.target` НЕ каскадит на WantedBy-юниты, -# поэтому target должен явно Wants= их (ordering — в самих юнитах через After=). -Wants=shturman-firstboot.service shturman-machineid.service shturman-power.service shturman-settings.service shturman-shell.service +# Зонтик тянет три фазовых под-таргета. Порядок «splash → кадр → фон» — на уровне сервисов +# (splash Before=shell; warmup After=shell), не сериализацией таргетов (иначе critical set ждал бы splash). +Wants=shturman-stage0.target shturman-stage1.target shturman-stage2.target [Install] WantedBy=multi-user.target diff --git a/systemd/tmpfiles-shturman.conf b/systemd/tmpfiles-shturman.conf new file mode 100644 index 0000000..71e9c1b --- /dev/null +++ b/systemd/tmpfiles-shturman.conf @@ -0,0 +1,3 @@ +# /run/shturman — volatile-каталог кадров/маркеров (splash.png, frame.png, stage2.ready). A11. +# Создаётся на boot до сервисов; splash/shell/warmup пишут сюда (tmpfs, не на flash). +d /run/shturman 0755 root root -