Files
operating-system/buildroot-external/rootfs-overlay/usr/sbin/hassos-cli
Stefan Agner 31fc13cf03 Resize serial terminal on login (#860) (#863)
The new readline utilty used by the CLI add-on requires the size of the
terminal to be set. Use the resize command to initialize terminal size
on login if we are running on a serial terminal.
2020-09-12 09:07:03 +02:00

28 lines
684 B
Bash
Executable File

#!/bin/sh
# ==============================================================================
# Run logging cli
# ==============================================================================
# Setup terminal size on serial console
if [ "${TERM}" = "vt220" ] || [ "${TERM}" = "vt102" ] || \
[ "${TERM}" = "vt100" ]; then
resize
fi
# Run CLI container
if [ "$(docker ps -q -f name=hassio_cli)" ]; then
docker container exec \
-ti hassio_cli \
/usr/bin/cli.sh \
# Jump to root login shell
if [ $? -eq 10 ]; then
/bin/ash -l
fi
else
echo "[WARN] Home Assistant CLI is not running! Jump into emergency console..."
/bin/ash -l
fi
exit