automated_script: keep configurator on real TTY; scope logging to install phase
This commit is contained in:
2 files changed
+28
-32
No files matched your search
@@ -1,48 +1,48 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# Live ISO entry point on tty1: set up the live VT, run the configurator
|
# Live ISO entry point on tty1: set up the live VT, run the configurator
|
||||||
# wizard, then hand off to the Python install orchestrator. All install-phase
|
# wizard with full TTY access, then start broad logging and hand off to the
|
||||||
# logic lives in orchestrator/ (omarchy-iso package) and the omarchy-iso-*
|
# Python install orchestrator.
|
||||||
# bash helpers; this shim only dispatches.
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
[[ $(tty) == /dev/tty1 ]] || exit 0
|
[[ $(tty) == /dev/tty1 ]] || exit 0
|
||||||
|
|
||||||
# Live ISO helpers (gum styling, padding constants, etc.) used by the
|
|
||||||
# configurator. Sourced here so the configurator inherits the environment.
|
|
||||||
export OMARCHY_MIRROR="$(cat /root/omarchy_mirror)"
|
export OMARCHY_MIRROR="$(cat /root/omarchy_mirror)"
|
||||||
export OMARCHY_PATH=/usr/share/omarchy
|
export OMARCHY_PATH=/usr/share/omarchy
|
||||||
export OMARCHY_INSTALL=$OMARCHY_PATH/install
|
export OMARCHY_INSTALL=$OMARCHY_PATH/install
|
||||||
export OMARCHY_INSTALL_LOG_FILE=/var/log/omarchy-install.log
|
export OMARCHY_INSTALL_LOG_FILE=/var/log/omarchy-install.log
|
||||||
source "$OMARCHY_INSTALL/helpers/all.sh"
|
source "$OMARCHY_INSTALL/helpers/all.sh"
|
||||||
|
|
||||||
# Tokyo Night palette so the live VT matches the installed look. Must run
|
# Tokyo Night palette so the live VT matches the installed look.
|
||||||
# before we redirect stdout so the OSC palette escapes reach the tty.
|
|
||||||
set_tokyo_night_colors() {
|
set_tokyo_night_colors() {
|
||||||
if [[ $(tty) == /dev/tty* ]]; then
|
echo -en "\e]P01a1b26"; echo -en "\e]P1f7768e"; echo -en "\e]P29ece6a"
|
||||||
echo -en "\e]P01a1b26"; echo -en "\e]P1f7768e"; echo -en "\e]P29ece6a"
|
echo -en "\e]P3e0af68"; echo -en "\e]P47aa2f7"; echo -en "\e]P5bb9af7"
|
||||||
echo -en "\e]P3e0af68"; echo -en "\e]P47aa2f7"; echo -en "\e]P5bb9af7"
|
echo -en "\e]P67dcfff"; echo -en "\e]P7a9b1d6"; echo -en "\e]P8414868"
|
||||||
echo -en "\e]P67dcfff"; echo -en "\e]P7a9b1d6"; echo -en "\e]P8414868"
|
echo -en "\e]P9f7768e"; echo -en "\e]PA9ece6a"; echo -en "\e]PBe0af68"
|
||||||
echo -en "\e]P9f7768e"; echo -en "\e]PA9ece6a"; echo -en "\e]PBe0af68"
|
echo -en "\e]PC7aa2f7"; echo -en "\e]PDbb9af7"; echo -en "\e]PE7dcfff"
|
||||||
echo -en "\e]PC7aa2f7"; echo -en "\e]PDbb9af7"; echo -en "\e]PE7dcfff"
|
echo -en "\e]PFc0caf5"
|
||||||
echo -en "\e]PFc0caf5"
|
echo -en "\033[0m"
|
||||||
echo -en "\033[0m"
|
clear
|
||||||
clear
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_tokyo_night_colors
|
set_tokyo_night_colors
|
||||||
|
|
||||||
# Capture all subsequent output (configurator + orchestrator) to the install
|
# Tell gum and friends the actual terminal size. stty size on /dev/tty is
|
||||||
# log with CSI escape sequences stripped. omarchy-iso-install also tees its
|
# more reliable than tput when stdout could end up redirected.
|
||||||
# Python orchestrator output to the same log file (raw), so the orchestrator
|
if size=$(stty size </dev/tty 2>/dev/null); then
|
||||||
# portion appears twice in the log — once raw, once stripped. Acceptable.
|
export LINES="${size%% *}"
|
||||||
mkdir -p /var/log
|
export COLUMNS="${size##* }"
|
||||||
touch /var/log/omarchy-install.log
|
fi
|
||||||
exec > >(tee >(sed -u 's/\x1b\[[0-9;]*[a-zA-Z]//g' >>/var/log/omarchy-install.log) 2>/dev/null) 2>&1
|
|
||||||
|
|
||||||
|
# Configurator phase: real TTY on both streams. No tee/pipe.
|
||||||
|
mkdir -p /var/log
|
||||||
|
touch "$OMARCHY_INSTALL_LOG_FILE"
|
||||||
cd /root
|
cd /root
|
||||||
./configurator
|
./configurator >/dev/tty 2>/dev/tty </dev/tty
|
||||||
|
|
||||||
|
# Install phase: now safe to capture output to the install log. Strip CSI
|
||||||
|
# escapes so the log file is readable. Keep stderr going to the log too so
|
||||||
|
# install-time errors are captured.
|
||||||
|
exec > >(tee >(sed -u 's/\x1b\[[0-9;]*[a-zA-Z]//g' >>"$OMARCHY_INSTALL_LOG_FILE") >/dev/tty) 2>&1
|
||||||
|
|
||||||
# Absolute paths because omarchy-iso-install cd's into /usr/share/omarchy-iso
|
# Absolute paths because omarchy-iso-install cd's into /usr/share/omarchy-iso
|
||||||
# before exec'ing python; relative paths would resolve against the wrong dir.
|
# before exec'ing python; relative paths would resolve against the wrong dir.
|
||||||
|
|||||||
@@ -2,18 +2,14 @@
|
|||||||
#
|
#
|
||||||
# Live-ISO entry point for the Omarchy install orchestrator. Invoked from
|
# Live-ISO entry point for the Omarchy install orchestrator. Invoked from
|
||||||
# /root/.automated_script.sh after the configurator wizard has produced its
|
# /root/.automated_script.sh after the configurator wizard has produced its
|
||||||
# user_*.json / user_*.txt files. Tees the full output to
|
# user_*.json / user_*.txt files. The outer shim owns install logging.
|
||||||
# /var/log/omarchy-install.log so omarchy-upload-log can pick it up.
|
|
||||||
|
|
||||||
set -eEo pipefail
|
set -eEo pipefail
|
||||||
|
|
||||||
mkdir -p /var/log
|
|
||||||
touch /var/log/omarchy-install.log
|
|
||||||
|
|
||||||
# Patch archinstall BEFORE Python loads it. orchestrator/main.py top-level
|
# Patch archinstall BEFORE Python loads it. orchestrator/main.py top-level
|
||||||
# imports archinstall_adapter, which top-level imports archinstall.*; patching
|
# imports archinstall_adapter, which top-level imports archinstall.*; patching
|
||||||
# inside a phase would be too late (bytecode already loaded).
|
# inside a phase would be too late (bytecode already loaded).
|
||||||
omarchy-iso-patch-archinstall
|
omarchy-iso-patch-archinstall
|
||||||
|
|
||||||
cd /usr/share/omarchy-iso
|
cd /usr/share/omarchy-iso
|
||||||
exec python -m orchestrator.main "$@" 2>&1 | tee -a /var/log/omarchy-install.log
|
exec python -m orchestrator.main "$@"
|
||||||
Reference in new issue
Block a user