1
0
mirror of https://github.com/home-assistant/operating-system.git synced 2025-12-24 12:28:43 +00:00
Files
operating-system/buildroot-external/scripts/rootfs-layer.sh
Stefan Agner 40b4d5ca2e Start Home Assistant CLI on tty1 without login (#1366)
* Start ha-cli on tty1 instead of a getty

Instead of starting a getty start the ha-cli directly. This will show
the banner right on startup with the important information such as IP
address of the instance or the URL to reach it.

* Use default shell as root shell instead of HA CLI

Instead of using the ha-cli.sh script as login shell use the regular
shell. Amongst other things, this allows to run VS Code devcontainers
remotely via SSH or using scp. The HA CLI is still available using the
`ha` command.
2021-05-19 13:18:02 +02:00

43 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
function fix_rootfs() {
# Cleanup etc
rm -rf "${TARGET_DIR:?}/etc/init.d"
rm -rf "${TARGET_DIR:?}/etc/network"
rm -rf "${TARGET_DIR:?}/etc/X11"
rm -rf "${TARGET_DIR:?}/etc/xdg"
# Cleanup root
rm -rf "${TARGET_DIR:?}/media"
rm -rf "${TARGET_DIR:?}/srv"
rm -rf "${TARGET_DIR:?}/opt"
# Cleanup miscs
rm -rf "${TARGET_DIR}/usr/lib/modules-load.d"
# systemd-update-done.service relies on writeable /var and /etc
rm -f "${TARGET_DIR}/usr/lib/systemd/system/sysinit.target.wants/systemd-update-done.service"
# Fix: permission for system connection files
chmod 600 "${TARGET_DIR}/etc/NetworkManager/system-connections"/*
# Fix: tempfs with /srv
sed -i "/srv/d" "${TARGET_DIR}/usr/lib/tmpfiles.d/home.conf"
# Fix: Could not generate persistent MAC address
sed -i "s/MACAddressPolicy=persistent/MACAddressPolicy=none/g" "${TARGET_DIR}/usr/lib/systemd/network/99-default.link"
# Use systemd-resolved for Host OS resolve
sed -i '/^hosts:/ {/resolve/! s/files/resolve [!UNAVAIL=return] files/}' "${TARGET_DIR}/etc/nsswitch.conf"
# Remove e2scrub (LVM specific tools provided by e2fsprogs)
rm -f "/usr/lib/systemd/system/e2scrub*"
rm -f "/usr/sbin/e2scrub*" "/usr/lib/e2fsprogs/e2scrub*"
}
function install_tini_docker() {
ln -fs /usr/bin/tini "${TARGET_DIR}/usr/bin/docker-init"
}