@@ -19,6 +19,25 @@ if [[ ! -f "${REPO_ROOT}/publish.py" ]]; then
1919 exit 1
2020fi
2121
22+ chvt_path=" $( command -v chvt || true) "
23+ setterm_path=" $( command -v setterm || true) "
24+
25+ if [[ -z " ${chvt_path} " ]]; then
26+ echo " Could not locate 'chvt'. Aborting."
27+ exit 1
28+ fi
29+
30+ if [[ -z " ${setterm_path} " ]]; then
31+ echo " Could not locate 'setterm'. Aborting."
32+ exit 1
33+ fi
34+
35+ playback_tty=" /dev/tty4"
36+ playback_tty_name=" ${playback_tty#/ dev/ } "
37+ playback_vt_number=" ${playback_tty_name# tty} "
38+ playback_getty_unit=" getty@${playback_tty_name} .service"
39+ playback_console_status=" pending"
40+
2241blanking_status=" Not configured"
2342
2443default_user=" ${SUDO_USER:- } "
@@ -215,6 +234,15 @@ escaped_cmd=$(printf "%s" "${start_command}" | sed "s/'/'\"'\"'/g")
215234 if [[ -n " ${env_lines} " ]]; then
216235 printf " %s" " ${env_lines} "
217236 fi
237+ echo " PermissionsStartOnly=yes"
238+ echo " TTYPath=${playback_tty} "
239+ echo " TTYReset=yes"
240+ echo " TTYVTDisallocate=yes"
241+ echo " StandardInput=tty"
242+ echo " StandardOutput=journal"
243+ echo " StandardError=journal"
244+ echo " ExecStartPre=${chvt_path} ${playback_vt_number} "
245+ echo " ExecStartPre=/bin/sh -c 'TERM=linux ${setterm_path} --term linux --clear all --foreground black --background black --cursor off >${playback_tty} '"
218246 echo " ExecStart=/bin/bash -lc '${escaped_cmd} '"
219247 echo
220248 echo " [Install]"
@@ -225,6 +253,14 @@ chmod 644 "${service_path}"
225253systemctl daemon-reload
226254systemctl enable " ${service_name} .service"
227255
256+ if systemctl list-unit-files --type=service --no-legend | awk ' {print $1}' | grep -qx " ${playback_getty_unit} " ; then
257+ systemctl stop " ${playback_getty_unit} " > /dev/null 2>&1 || true
258+ systemctl mask " ${playback_getty_unit} " > /dev/null 2>&1 || true
259+ playback_console_status=" getty masked"
260+ else
261+ playback_console_status=" no getty service"
262+ fi
263+
228264dm_service=" $( detect_dm) "
229265gui_status=" kept"
230266
@@ -241,7 +277,7 @@ if [[ "${keep_gui}" != "y" ]]; then
241277else
242278 systemctl set-default graphical.target
243279 if [[ -n " ${dm_service} " ]]; then
244- systemctl enable " ${dm_service} .service" > /dev/null 2>&1 || true
280+ systemctl enable " ${dm_service} .service" > /dev/null 2>&1 || true
245281 fi
246282fi
247283
@@ -258,6 +294,7 @@ Configuration complete!
258294- Systemd service : ${service_path}
259295- Runs as user : ${service_user}
260296- Launch command : ${start_command}
297+ - Playback console: ${playback_tty} (${playback_console_status} )
261298- Desktop status : ${gui_status}
262299- Screen blanking : ${blanking_status}
263300
0 commit comments