Files
operating-system/buildroot-external/rootfs-overlay/usr/sbin/hassos-cli
Stefan Agner 2cc78abe56 Enter console if data partition is missing (#1055)
In case the data partition is missing avoid using the Docker command.
The Docker command triggers a socket activation, which in turn makes
systemd wait for the data partition. This blocks entry into the shell
forever.

Just enter the shell in case data partition is not mounted.
2020-12-03 20:29:07 +01:00

33 lines
829 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 [ ! "$(findmnt /mnt/data)" ]; then
echo "[WARN] Data partition not mounted! Jump into emergency console..."
exec /bin/ash -l
fi
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..."
exec /bin/ash -l
fi
exit