installer: force dashboard shutdown before finish
This commit is contained in:
3 files changed
+40
-13
No files matched your search
@@ -45,19 +45,26 @@ cd /root
|
|||||||
|
|
||||||
# Keep the actual install screen calm: the dashboard owns /dev/tty while the
|
# Keep the actual install screen calm: the dashboard owns /dev/tty while the
|
||||||
# noisy installer stream is captured to the support log.
|
# noisy installer stream is captured to the support log.
|
||||||
/usr/local/bin/omarchy-install-dashboard "$OMARCHY_INSTALL_LOG_FILE" /run/omarchy-install/state.json >/dev/tty 2>&1 &
|
rm -f /run/omarchy-install/dashboard.stop
|
||||||
|
setsid /usr/local/bin/omarchy-install-dashboard "$OMARCHY_INSTALL_LOG_FILE" /run/omarchy-install/state.json >/dev/tty 2>&1 &
|
||||||
dashboard_pid=$!
|
dashboard_pid=$!
|
||||||
export OMARCHY_INSTALL_DASHBOARD_PID="$dashboard_pid"
|
export OMARCHY_INSTALL_DASHBOARD_PID="$dashboard_pid"
|
||||||
|
|
||||||
stop_install_dashboard() {
|
stop_install_dashboard() {
|
||||||
|
touch /run/omarchy-install/dashboard.stop 2>/dev/null || true
|
||||||
if [[ -n ${dashboard_pid:-} ]]; then
|
if [[ -n ${dashboard_pid:-} ]]; then
|
||||||
if kill -0 "$dashboard_pid" 2>/dev/null; then
|
if kill -0 "$dashboard_pid" 2>/dev/null; then
|
||||||
|
# The dashboard runs under setsid, so $dashboard_pid is also its process
|
||||||
|
# group. Kill the group first so child sleep/tte processes cannot keep
|
||||||
|
# the dashboard alive over the final/error UI.
|
||||||
|
kill -- -"$dashboard_pid" 2>/dev/null || true
|
||||||
kill "$dashboard_pid" 2>/dev/null || true
|
kill "$dashboard_pid" 2>/dev/null || true
|
||||||
for _ in {1..20}; do
|
for _ in {1..20}; do
|
||||||
kill -0 "$dashboard_pid" 2>/dev/null || break
|
kill -0 "$dashboard_pid" 2>/dev/null || break
|
||||||
sleep 0.05
|
sleep 0.05
|
||||||
done
|
done
|
||||||
if kill -0 "$dashboard_pid" 2>/dev/null; then
|
if kill -0 "$dashboard_pid" 2>/dev/null; then
|
||||||
|
kill -9 -- -"$dashboard_pid" 2>/dev/null || true
|
||||||
kill -9 "$dashboard_pid" 2>/dev/null || true
|
kill -9 "$dashboard_pid" 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ set -euo pipefail
|
|||||||
|
|
||||||
LOG_FILE="${1:-/var/log/omarchy-install.log}"
|
LOG_FILE="${1:-/var/log/omarchy-install.log}"
|
||||||
STATE_FILE="${2:-/run/omarchy-install/state.json}"
|
STATE_FILE="${2:-/run/omarchy-install/state.json}"
|
||||||
|
STATE_DIR="$(dirname "$STATE_FILE")"
|
||||||
|
STOP_FILE="$STATE_DIR/dashboard.stop"
|
||||||
LOGO_PATH="${OMARCHY_PATH:-/usr/share/omarchy}/logo.txt"
|
LOGO_PATH="${OMARCHY_PATH:-/usr/share/omarchy}/logo.txt"
|
||||||
|
|
||||||
CSI=$'\033['
|
CSI=$'\033['
|
||||||
@@ -151,13 +153,13 @@ weights = [
|
|||||||
('Starting installation', 1, 2, 2),
|
('Starting installation', 1, 2, 2),
|
||||||
('Preparing live environment', 2, 6, 5),
|
('Preparing live environment', 2, 6, 5),
|
||||||
('Verifying protected mounts', 6, 8, 3),
|
('Verifying protected mounts', 6, 8, 3),
|
||||||
('Installing Arch + Omarchy', 8, 86, 80),
|
('Installing Arch + Omarchy', 8, 82, 60),
|
||||||
('Installing base system', 8, 86, 80),
|
('Installing base system', 8, 82, 60),
|
||||||
('Configuring protected boot', 86, 90, 8),
|
('Configuring protected boot', 82, 86, 8),
|
||||||
('Finalizing in chroot', 90, 96, 25),
|
('Finalizing in chroot', 86, 98, 90),
|
||||||
('Configuring login', 96, 97, 3),
|
('Configuring login', 98, 99, 3),
|
||||||
('Validating protected boot setup', 97, 99, 5),
|
('Validating protected boot setup', 99, 100, 5),
|
||||||
('Validating boot setup', 97, 99, 5),
|
('Validating boot setup', 99, 100, 5),
|
||||||
('Finishing', 99, 100, 3),
|
('Finishing', 99, 100, 3),
|
||||||
]
|
]
|
||||||
start, end, expected = 1, 99, 90
|
start, end, expected = 1, 99, 90
|
||||||
@@ -234,8 +236,9 @@ printf '%s' "$HIDE_CURSOR" >/dev/tty
|
|||||||
render_static >/dev/tty
|
render_static >/dev/tty
|
||||||
frame=0
|
frame=0
|
||||||
while true; do
|
while true; do
|
||||||
|
[[ -e $STOP_FILE ]] && break
|
||||||
render_dynamic "$frame" >/dev/tty
|
render_dynamic "$frame" >/dev/tty
|
||||||
if install_finished; then
|
if install_finished || [[ -e $STOP_FILE ]]; then
|
||||||
sleep 1
|
sleep 1
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1102,7 +1102,27 @@ def _dashboard_pids() -> list[int]:
|
|||||||
return pids
|
return pids
|
||||||
|
|
||||||
|
|
||||||
|
def _signal_dashboard(pid: int, signal_number: int) -> None:
|
||||||
|
# Dashboard is launched with setsid, making its PID the process group ID.
|
||||||
|
# Signal the group first so child sleep/tte processes cannot keep drawing.
|
||||||
|
try:
|
||||||
|
os.killpg(pid, signal_number)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
os.kill(pid, signal_number)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def _stop_install_dashboard() -> None:
|
def _stop_install_dashboard() -> None:
|
||||||
|
stop_file = Path("/run/omarchy-install/dashboard.stop")
|
||||||
|
try:
|
||||||
|
stop_file.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
stop_file.touch()
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
|
|
||||||
pids = _dashboard_pids()
|
pids = _dashboard_pids()
|
||||||
for signal_number in (15, 9):
|
for signal_number in (15, 9):
|
||||||
for pid in pids:
|
for pid in pids:
|
||||||
@@ -1110,10 +1130,7 @@ def _stop_install_dashboard() -> None:
|
|||||||
continue
|
continue
|
||||||
if not _pid_is_dashboard(pid):
|
if not _pid_is_dashboard(pid):
|
||||||
continue
|
continue
|
||||||
try:
|
_signal_dashboard(pid, signal_number)
|
||||||
os.kill(pid, signal_number)
|
|
||||||
except OSError:
|
|
||||||
pass
|
|
||||||
deadline = time.time() + (1.0 if signal_number == 15 else 0.5)
|
deadline = time.time() + (1.0 if signal_number == 15 else 0.5)
|
||||||
while time.time() < deadline:
|
while time.time() < deadline:
|
||||||
if all(_dashboard_stopped(pid) for pid in pids):
|
if all(_dashboard_stopped(pid) for pid in pids):
|
||||||
|
|||||||
Reference in new issue
Block a user