Only start the HA CLI if we are in the default.target (#1287)

This makes sure that we always get a Linux shell in other targets such
as the rescue.target.
This commit is contained in:
Stefan Agner 2021-03-24 19:14:06 +01:00 committed by GitHub
parent ab19c8c6cf
commit 905aa21e8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,12 +9,17 @@ if [ "${TERM}" = "vt220" ] || [ "${TERM}" = "vt102" ] || \
resize
fi
# Run CLI container
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 \