From 128dfdefc800be60cdc2c8039068ea62b074ac72 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Tue, 9 Jun 2020 20:43:23 +0200 Subject: [PATCH 1/7] Remove confirmation as it breaks piped runs (#101) --- installer.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/installer.sh b/installer.sh index 3f4b0c5..f783275 100644 --- a/installer.sh +++ b/installer.sh @@ -12,13 +12,6 @@ warn "If you want more control over your own system, run" warn "Home Assistant as a VM or run Home Assistant Core" warn "via a Docker container." warn "" -echo 'Please typ "not supported" to continue this installation' -read x -if [ "$x" != "not supported" ] -then - echo "OK, bye!" - exit 1 -fi ARCH=$(uname -m) DOCKER_BINARY=/usr/bin/docker From 8049cb952830dfb1f7da30435cfc435c0d5e8ca4 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 10 Aug 2020 15:50:11 +0200 Subject: [PATCH 2/7] Update README.md --- README.md | 36 +++++++----------------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index ab9146b..35497a0 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,18 @@ -# This install method has been deprecated. +# This installation method is for advanced users only -## https://www.home-assistant.io/blog/2020/05/09/deprecating-home-assistant-supervised-on-generic-linux/ +## Make sure you understand [the requirements](https://github.com/home-assistant/architecture/blob/master/adr/0014-home-assistant-supervised.md) # Install Home Assistant Supervised -As an alternative to using the images which include the Home Assistant operating-system and Docker, it is also possible to run Home Assistant on a generic system running another Linux of your choice such as Ubuntu, Debian, etc as Supervised. Because of all the various possible install options, these are more of a community supported installation choice. It follows that the more esoteric of a choice made with the OS, the less a user will find in terms of information and support from the community. +This installation method provides the full Home Assistant experience on a regular operating system. This means, all components from the Home Assistant method are used, except for the Home Assistant Operating System. This system will run the Home Assistant Supervisor. The Supervisor is not just an application, it is a full appliance that manages the whole system. It will clean up, repair or reset settings to default if they no longer match expected values. -## Warning +By not using the Home Assistant Operating System, the user is responsible for making sure that all required components are installed and maintained. Required components and their versions will change over time. Home Assistant Supervised is provided as-is as a foundation for community supported do-it-yourself solutions. We only accept bug reports for issues that have been reproduced on a freshly installed, fully updated Debian with no additional packages. -The Supervisord system is designed to provide a full-featured environment that is comparable with Kubernetes, which is also a bad idea to run it by the side of another orchestrator on the same Host. The Supervisor is also not caring for other software they run on your Host, and it can affect things bad on both sides. You also need to know that the Home Assistant OS runs with less overhead on your Proxmox or other Hypervisor as if you install first Debian and Ubuntu. In most cases, it's not the best choice to run the Supervisord on top of a Linux, if you not 100% sure what you do. It is not just a container inside Docker! +This method is considered advanced and should only be used if one is an expert in managing a Linux operating system, Docker and networking. -**If you have issues, don't report this to us. You are self responsible for what you do, if you use this installer.** +**If you have issues, don't report this to us. You are responsible for your system if you use this installer.** -## Requirements - -We only support Linux distributions that follow the [FHS 3.0](https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard)! - -``` -docker-ce -bash -jq -curl -avahi-daemon -dbus -``` - -## Optional - -``` -apparmor-utils -network-manager -``` - -**Important**: Don't only install NetworkManager, you need also use it on your system. - -## Run +## Installation Run as root (sudo su): From 632918f5087448d9e8d235d6a236e62e61e448a8 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Wed, 12 Aug 2020 16:13:23 +0200 Subject: [PATCH 3/7] Fix installer --- installer.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/installer.sh b/installer.sh index f783275..5f927f7 100644 --- a/installer.sh +++ b/installer.sh @@ -4,9 +4,6 @@ set -e function error { echo -e "[Error] $*"; exit 1; } function warn { echo -e "[Warning] $*"; } -warn "This installer is no longer supported." -warn "" -warn "Home Assistant might work today, tomorrow maybe not." warn "" warn "If you want more control over your own system, run" warn "Home Assistant as a VM or run Home Assistant Core" @@ -32,8 +29,8 @@ command -v jq > /dev/null 2>&1 || error "Please install jq first" command -v curl > /dev/null 2>&1 || error "Please install curl first" command -v avahi-daemon > /dev/null 2>&1 || error "Please install avahi first" command -v dbus-daemon > /dev/null 2>&1 || error "Please install dbus first" -command -v nmcli > /dev/null 2>&1 || warn "No NetworkManager support on host." -command -v apparmor_parser > /dev/null 2>&1 || warn "No AppArmor support on host." +command -v nmcli > /dev/null 2>&1 || error "No NetworkManager support on host." +command -v apparmor_parser > /dev/null 2>&1 || error "No AppArmor support on host." # Check if Modem Manager is enabled From 4a5692cbb29ed219e1c12f3d9174b6dbf91a6478 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Thu, 13 Aug 2020 11:25:20 +0200 Subject: [PATCH 4/7] Use new machine flag (#102) --- files/hassio-supervisor | 7 ++++--- installer.sh | 9 ++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/files/hassio-supervisor b/files/hassio-supervisor index 4e83324..8a31502 100644 --- a/files/hassio-supervisor +++ b/files/hassio-supervisor @@ -5,7 +5,7 @@ set -e CONFIG_FILE=%%HASSIO_CONFIG%% SUPERVISOR="$(jq --raw-output '.supervisor' ${CONFIG_FILE})" -HOMEASSISTANT="$(jq --raw-output '.homeassistant' ${CONFIG_FILE})" +MACHINE="$(jq --raw-output '.machine' ${CONFIG_FILE})" DATA="$(jq --raw-output '.data // "/usr/share/hassio"' ${CONFIG_FILE})" # AppArmor Support @@ -30,10 +30,11 @@ runSupervisor() { --security-opt seccomp=unconfined \ -v /run/docker.sock:/run/docker.sock \ -v /run/dbus:/run/dbus \ - -v "${HASSIO_DATA}":/data \ + -v /etc/machine-id:/etc/machine-id:ro \ + -v "${HASSIO_DATA}":/data:rw \ -e SUPERVISOR_SHARE="${HASSIO_DATA}" \ -e SUPERVISOR_NAME=hassio_supervisor \ - -e HOMEASSISTANT_REPOSITORY="${HOMEASSISTANT}" \ + -e SUPERVISOR_MACHINE="${MACHINE}" \ "${SUPERVISOR}" } diff --git a/installer.sh b/installer.sh index 5f927f7..8357bfb 100644 --- a/installer.sh +++ b/installer.sh @@ -83,33 +83,28 @@ CONFIG=$SYSCONFDIR/hassio.json case $ARCH in "i386" | "i686") MACHINE=${MACHINE:=qemux86} - HOMEASSISTANT_DOCKER="$DOCKER_REPO/$MACHINE-homeassistant" HASSIO_DOCKER="$DOCKER_REPO/i386-hassio-supervisor" ;; "x86_64") MACHINE=${MACHINE:=qemux86-64} - HOMEASSISTANT_DOCKER="$DOCKER_REPO/$MACHINE-homeassistant" HASSIO_DOCKER="$DOCKER_REPO/amd64-hassio-supervisor" ;; "arm" |"armv6l") if [ -z $MACHINE ]; then error "Please set machine for $ARCH" fi - HOMEASSISTANT_DOCKER="$DOCKER_REPO/$MACHINE-homeassistant" HASSIO_DOCKER="$DOCKER_REPO/armhf-hassio-supervisor" ;; "armv7l") if [ -z $MACHINE ]; then error "Please set machine for $ARCH" fi - HOMEASSISTANT_DOCKER="$DOCKER_REPO/$MACHINE-homeassistant" HASSIO_DOCKER="$DOCKER_REPO/armv7-hassio-supervisor" ;; "aarch64") if [ -z $MACHINE ]; then error "Please set machine for $ARCH" fi - HOMEASSISTANT_DOCKER="$DOCKER_REPO/$MACHINE-homeassistant" HASSIO_DOCKER="$DOCKER_REPO/aarch64-hassio-supervisor" ;; *) @@ -140,7 +135,7 @@ HASSIO_VERSION=$(curl -s $URL_VERSION | jq -e -r '.supervisor') cat > "$CONFIG" <<- EOF { "supervisor": "${HASSIO_DOCKER}", - "homeassistant": "${HOMEASSISTANT_DOCKER}", + "machine": "${MACHINE}", "data": "${DATA_SHARE}" } EOF @@ -187,7 +182,7 @@ fi ## # Init system -echo "[Info] Run Hass.io" +echo "[Info] Run Home Assistant Supervised" systemctl start hassio-supervisor.service ## From 3df59fffdefa65a8301e9af1a6ef39caecf4c023 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Fri, 14 Aug 2020 09:51:03 +0200 Subject: [PATCH 5/7] Cleanup --- installer.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/installer.sh b/installer.sh index 8357bfb..637cb1c 100644 --- a/installer.sh +++ b/installer.sh @@ -112,10 +112,6 @@ case $ARCH in ;; esac -if [ -z "${HOMEASSISTANT_DOCKER}" ]; then - error "Found no Home Assistant Docker images for this host!" -fi - if [[ ! "intel-nuc odroid-c2 odroid-n2 odroid-xu qemuarm qemuarm-64 qemux86 qemux86-64 raspberrypi raspberrypi2 raspberrypi3 raspberrypi4 raspberrypi3-64 raspberrypi4-64 tinker" = *"${MACHINE}"* ]]; then error "Unknown machine type ${MACHINE}!" fi From 756f6db062aa1f315ac04d7831cb255b1c683445 Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Fri, 14 Aug 2020 09:54:44 +0200 Subject: [PATCH 6/7] tweaks on readme --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 35497a0..a16faf4 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,6 @@ By not using the Home Assistant Operating System, the user is responsible for ma This method is considered advanced and should only be used if one is an expert in managing a Linux operating system, Docker and networking. -**If you have issues, don't report this to us. You are responsible for your system if you use this installer.** - ## Installation Run as root (sudo su): From 928e46db76912daaee8bf1eb3b8fd1f9af95ce5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Sat, 15 Aug 2020 23:16:26 +0200 Subject: [PATCH 7/7] Add default daemon config, and check for journald (#104) * Add default daemon config, and check for journald * Remove snap * Add storage-driver check * Remove exit * Change echo -> info --- installer.sh | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/installer.sh b/installer.sh index 637cb1c..c69c0d6 100644 --- a/installer.sh +++ b/installer.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash set -e +function info { echo -e "[Info] $*"; } function error { echo -e "[Error] $*"; exit 1; } function warn { echo -e "[Warning] $*"; } @@ -14,6 +15,7 @@ ARCH=$(uname -m) DOCKER_BINARY=/usr/bin/docker DOCKER_REPO=homeassistant DOCKER_SERVICE=docker.service +DOCKER_DAEMON_CONFIG=/etc/docker/daemon.json URL_VERSION="https://version.home-assistant.io/stable.json" URL_HA="https://raw.githubusercontent.com/home-assistant/supervised-installer/master/files/ha" URL_BIN_HASSIO="https://raw.githubusercontent.com/home-assistant/supervised-installer/master/files/hassio-supervisor" @@ -38,12 +40,28 @@ if systemctl list-unit-files ModemManager.service | grep enabled; then warn "ModemManager service is enabled. This might cause issue when using serial devices." fi -# Detect if running on snapped docker -if snap list docker >/dev/null 2>&1; then - DOCKER_BINARY=/snap/bin/docker - DATA_SHARE=/root/snap/docker/common/hassio - CONFIG=$DATA_SHARE/hassio.json - DOCKER_SERVICE="snap.docker.dockerd.service" +# Detect wrong docker logger config +if [ ! -f "$DOCKER_DAEMON_CONFIG" ]; then + # Write default configuration + info "Creating default docker deamon configuration $DOCKER_DAEMON_CONFIG" + cat > "$DOCKER_DAEMON_CONFIG" <<- EOF + { + "log-driver": "journald", + "storage-driver": "overlay2" + } +EOF + # Restart Docker service + info "Restarting docker service" + systemctl restart "$DOCKER_SERVICE" +else + STORRAGE_DRIVER=$(docker info -f "{{json .}}" | jq -r -e .Driver) + LOGGING_DRIVER=$(docker info -f "{{json .}}" | jq -r -e .LoggingDriver) + if [[ "$STORRAGE_DRIVER" != "overlay2" ]]; then + warn "Docker is using $STORRAGE_DRIVER and not 'overlay2' as the storrage driver, this is not supported." + fi + if [[ "$LOGGING_DRIVER" != "journald" ]]; then + warn "Docker is using $LOGGING_DRIVER and not 'journald' as the logging driver, this is not supported." + fi fi # Parse command line parameters @@ -138,13 +156,13 @@ EOF ## # Pull supervisor image -echo "[Info] Install supervisor Docker container" +info "Install supervisor Docker container" docker pull "$HASSIO_DOCKER:$HASSIO_VERSION" > /dev/null docker tag "$HASSIO_DOCKER:$HASSIO_VERSION" "$HASSIO_DOCKER:latest" > /dev/null ## # Install Hass.io Supervisor -echo "[Info] Install supervisor startup scripts" +info "Install supervisor startup scripts" curl -sL ${URL_BIN_HASSIO} > "${PREFIX}/sbin/hassio-supervisor" curl -sL ${URL_SERVICE_HASSIO} > "${SYSCONFDIR}/systemd/system/hassio-supervisor.service" @@ -160,7 +178,7 @@ systemctl enable hassio-supervisor.service # # Install Hass.io AppArmor if command -v apparmor_parser > /dev/null 2>&1; then - echo "[Info] Install AppArmor scripts" + info "Install AppArmor scripts" mkdir -p "${DATA_SHARE}/apparmor" curl -sL ${URL_BIN_APPARMOR} > "${PREFIX}/sbin/hassio-apparmor" curl -sL ${URL_SERVICE_APPARMOR} > "${SYSCONFDIR}/systemd/system/hassio-apparmor.service" @@ -178,11 +196,11 @@ fi ## # Init system -echo "[Info] Run Home Assistant Supervised" +info "Run Home Assistant Supervised" systemctl start hassio-supervisor.service ## # Setup CLI -echo "[Info] Install cli 'ha'" +info "Install cli 'ha'" curl -sL ${URL_HA} > "${PREFIX}/bin/ha" chmod a+x "${PREFIX}/bin/ha"