Files
Jan Čermák 5511610ae4 Harmonize hassos/HassOS naming to haos across the tree (#4740)
* Harmonize systemd unit and helper-script prefixes to haos (#4725)

Rename the hassos-prefixed systemd units and their ExecStart helper
binaries to a consistent haos- prefix, and update all in-repo
references. Normalize the affected unit Description= strings as well.

Units renamed in this commit are not referred externally (except for
syslog identifiers used in Supervisor Host logs), so no other changes
should be needed.

* Rename hassos-config to haos-config with alias

Rename the hassos-config.service unit and its binary to the haos-
prefix. This unit is restarted by Supervisor in os/manager.py, so add
Alias= to avoid the need to try both variants there.

* Rename hassos-cli binary to haos-cli

* Change HassOS to HAOS in unit descriptions and comments

* Rename hassos->haos in Buildroot makefiles, scripts and configs

* Rename bootargs_hassos to bootargs_haos in U-Boot scripts

* Rename external Buildroot tree HASSOS to HAOS

Set external.desc name to HAOS and rename all BR2_EXTERNAL_HASSOS_PATH
references to BR2_EXTERNAL_HAOS_PATH accordingly.

* Rename hassos.conf service drop-ins to haos.conf

* Rename hassos.config kernel fragment to haos.config

* Rename hassos-blobs repo in package/bluetooth-rtl8723

The repo was renamed somewhere in the past and it now relies on an
internal GitHub redirect. Change the URL to match the new repo name.
2026-06-01 23:25:43 +02:00

66 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
# ==============================================================================
# Run logging cli
# ==============================================================================
run_shell() { exec /bin/ash -l; }
interrupt() { echo " cancelled"; systemctl reset-failed "ha-cli@*"; run_shell; }
emergency_shell() {
printf "\n\n[WARNING] Home Assistant CLI is not starting or was interrupted.\n"
echo ""
echo "This happens when start of all services takes longer than expected, or because"
echo "of slow internet connection. Emergency console has been started, you can use"
echo "for example the following commands for troubleshooting:"
echo ""
echo " * 'docker ps -a' - e.g. to check if 'hassio_supervisor' container is running"
echo " * 'journalctl -e' - to investigate latest system logs"
echo " * 'exit' or Ctrl+D - to exit the emergency console and retry HA CLI startup"
echo ""
run_shell
}
trap interrupt INT
printf "Waiting for the Home Assistant CLI to be ready..."
i=0
while [ ! "$(docker ps -q -f name=hassio_cli)" ]; do
sleep 1
if [ $((i % 4)) = 0 ]; then
printf "\010\010\010 \010\010\010"
else
printf "."
fi
i=$((i+1))
if [ $i = 180 ]; then
emergency_shell
fi
done
docker container exec \
-ti hassio_cli \
/usr/bin/cli.sh
case $? in
10)
# Jump to root login shell (login command)
run_shell
;;
130)
# 130 is CLI termination with Ctrl+C (SIGINT)
printf "\nHome Assistant CLI has been interrupted.\n"
systemctl reset-failed "ha-cli@*"
;;
143)
# 143 graceful termination (SIGTERM). Most likely a proper shutdown.
# Just sleep for a while until actual systemd shutdown gets invoked.
printf "\nHome Assistant CLI has been terminated.\n"
;;
*)
printf "\nHA CLI failed with error code: %s\n" "$?"
;;
esac