This makes sure that we always get a Linux shell in other targets such as the rescue.target.
38 lines
998 B
Bash
Executable File
38 lines
998 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
|
|
|
|
if [ "$(systemctl is-active default.target)" != "active" ]; then
|
|
echo "[INFO] System not in default.target! Jump into emergency console..."
|
|
exec /bin/ash -l
|
|
fi
|
|
|
|
if [ ! "$(findmnt /mnt/data)" ]; then
|
|
echo "[WARN] Data partition not mounted! Jump into emergency console..."
|
|
exec /bin/ash -l
|
|
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..."
|
|
exec /bin/ash -l
|
|
fi
|
|
|
|
exit
|