From 905aa21e8ce8f2b7e352eb5f3ac6748594ae5a9b Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Wed, 24 Mar 2021 19:14:06 +0100 Subject: [PATCH] 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. --- buildroot-external/rootfs-overlay/usr/sbin/hassos-cli | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/buildroot-external/rootfs-overlay/usr/sbin/hassos-cli b/buildroot-external/rootfs-overlay/usr/sbin/hassos-cli index 6748febd6..3aa662ed5 100755 --- a/buildroot-external/rootfs-overlay/usr/sbin/hassos-cli +++ b/buildroot-external/rootfs-overlay/usr/sbin/hassos-cli @@ -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 \