Rename & add cli (#92)

* Rename & add cli

* update readme

* update check

* Fix lint

* fix lint
This commit is contained in:
Pascal Vizeli 2020-03-30 18:09:08 +02:00 committed by GitHub
parent 9646609269
commit 9f5d4fde28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 23 deletions

View file

@ -1,5 +1,3 @@
[![Build Status](https://dev.azure.com/home-assistant/Hass.io/_apis/build/status/hassio-installer?branchName=master)](https://dev.azure.com/home-assistant/Hass.io/_build/latest?definitionId=6&branchName=master)
# Install Home Assistant Supervised # 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. 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.
@ -31,7 +29,7 @@ network-manager
Run as root (sudo su): Run as root (sudo su):
```bash ```bash
curl -sL https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh | bash -s curl -sL https://raw.githubusercontent.com/home-assistant/installer/master/installer.sh | bash -s
``` ```
### Command line arguments ### Command line arguments
@ -45,7 +43,7 @@ curl -sL https://raw.githubusercontent.com/home-assistant/hassio-installer/maste
you can set these parameters by appending ` -- <parameter> <value>` like: you can set these parameters by appending ` -- <parameter> <value>` like:
```bash ```bash
curl -sL https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh | bash -s -- -m MY_MACHINE curl -sL https://raw.githubusercontent.com/home-assistant/installer/master/installer.sh | bash -s -- -m MY_MACHINE
``` ```
## Supported Machine types ## Supported Machine types
@ -65,4 +63,3 @@ curl -sL https://raw.githubusercontent.com/home-assistant/hassio-installer/maste
- raspberrypi3-64 - raspberrypi3-64
- raspberrypi4-64 - raspberrypi4-64
- tinker - tinker

View file

@ -21,5 +21,5 @@ jobs:
- script: | - script: |
sudo docker run --rm -i \ sudo docker run --rm -i \
-v $(pwd):/mnt:ro koalaman/shellcheck:$(versionShellCheck) \ -v $(pwd):/mnt:ro koalaman/shellcheck:$(versionShellCheck) \
hassio_install.sh files/hassio-apparmor files/hassio-supervisor installer.sh files/hassio-apparmor files/hassio-supervisor files/ha
displayName: 'Run ShellCheck' displayName: 'Run ShellCheck'

4
files/ha Normal file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env bash
# shellcheck disable=SC2048,SC2086
docker exec hassio_cli ha $*

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env bash
set -e set -e
# Load configs # Load configs

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/usr/bin/env bash
set -e set -e
# Load configs # Load configs

37
hassio_install.sh → installer.sh Executable file → Normal file
View file

@ -9,10 +9,11 @@ DOCKER_BINARY=/usr/bin/docker
DOCKER_REPO=homeassistant DOCKER_REPO=homeassistant
DOCKER_SERVICE=docker.service DOCKER_SERVICE=docker.service
URL_VERSION="https://version.home-assistant.io/stable.json" URL_VERSION="https://version.home-assistant.io/stable.json"
URL_BIN_HASSIO="https://raw.githubusercontent.com/home-assistant/hassio-installer/master/files/hassio-supervisor" URL_HA="https://raw.githubusercontent.com/home-assistant/installer/master/files/ha"
URL_BIN_APPARMOR="https://raw.githubusercontent.com/home-assistant/hassio-installer/master/files/hassio-apparmor" URL_BIN_HASSIO="https://raw.githubusercontent.com/home-assistant/installer/master/files/hassio-supervisor"
URL_SERVICE_HASSIO="https://raw.githubusercontent.com/home-assistant/hassio-installer/master/files/hassio-supervisor.service" URL_BIN_APPARMOR="https://raw.githubusercontent.com/home-assistant/installer/master/files/hassio-apparmor"
URL_SERVICE_APPARMOR="https://raw.githubusercontent.com/home-assistant/hassio-installer/master/files/hassio-apparmor.service" URL_SERVICE_HASSIO="https://raw.githubusercontent.com/home-assistant/installer/master/files/hassio-supervisor.service"
URL_SERVICE_APPARMOR="https://raw.githubusercontent.com/home-assistant/installer/master/files/hassio-apparmor.service"
URL_APPARMOR_PROFILE="https://version.home-assistant.io/apparmor.txt" URL_APPARMOR_PROFILE="https://version.home-assistant.io/apparmor.txt"
# Check env # Check env
@ -147,33 +148,33 @@ docker tag "$HASSIO_DOCKER:$HASSIO_VERSION" "$HASSIO_DOCKER:latest" > /dev/null
## ##
# Install Hass.io Supervisor # Install Hass.io Supervisor
echo "[Info] Install supervisor startup scripts" echo "[Info] Install supervisor startup scripts"
curl -sL ${URL_BIN_HASSIO} > "${PREFIX}"/sbin/hassio-supervisor curl -sL ${URL_BIN_HASSIO} > "${PREFIX}/sbin/hassio-supervisor"
curl -sL ${URL_SERVICE_HASSIO} > "${SYSCONFDIR}"/systemd/system/hassio-supervisor.service curl -sL ${URL_SERVICE_HASSIO} > "${SYSCONFDIR}/systemd/system/hassio-supervisor.service"
sed -i "s,%%HASSIO_CONFIG%%,${CONFIG},g" "${PREFIX}"/sbin/hassio-supervisor sed -i "s,%%HASSIO_CONFIG%%,${CONFIG},g" "${PREFIX}"/sbin/hassio-supervisor
sed -i -e "s,%%DOCKER_BINARY%%,${DOCKER_BINARY},g" \ sed -i -e "s,%%DOCKER_BINARY%%,${DOCKER_BINARY},g" \
-e "s,%%DOCKER_SERVICE%%,${DOCKER_SERVICE},g" \ -e "s,%%DOCKER_SERVICE%%,${DOCKER_SERVICE},g" \
-e "s,%%HASSIO_BINARY%%,${PREFIX}/sbin/hassio-supervisor,g" \ -e "s,%%HASSIO_BINARY%%,${PREFIX}/sbin/hassio-supervisor,g" \
"${SYSCONFDIR}"/systemd/system/hassio-supervisor.service "${SYSCONFDIR}/systemd/system/hassio-supervisor.service"
chmod a+x "${PREFIX}"/sbin/hassio-supervisor chmod a+x "${PREFIX}/sbin/hassio-supervisor"
systemctl enable hassio-supervisor.service systemctl enable hassio-supervisor.service
# #
# Install Hass.io AppArmor # Install Hass.io AppArmor
if command -v apparmor_parser > /dev/null 2>&1; then if command -v apparmor_parser > /dev/null 2>&1; then
echo "[Info] Install AppArmor scripts" echo "[Info] Install AppArmor scripts"
mkdir -p "${DATA_SHARE}"/apparmor mkdir -p "${DATA_SHARE}/apparmor"
curl -sL ${URL_BIN_APPARMOR} > "${PREFIX}"/sbin/hassio-apparmor curl -sL ${URL_BIN_APPARMOR} > "${PREFIX}/sbin/hassio-apparmor"
curl -sL ${URL_SERVICE_APPARMOR} > "${SYSCONFDIR}"/systemd/system/hassio-apparmor.service curl -sL ${URL_SERVICE_APPARMOR} > "${SYSCONFDIR}/systemd/system/hassio-apparmor.service"
curl -sL ${URL_APPARMOR_PROFILE} > "${DATA_SHARE}"/apparmor/hassio-supervisor curl -sL ${URL_APPARMOR_PROFILE} > "${DATA_SHARE}/apparmor/hassio-supervisor"
sed -i "s,%%HASSIO_CONFIG%%,${CONFIG},g" "${PREFIX}"/sbin/hassio-apparmor sed -i "s,%%HASSIO_CONFIG%%,${CONFIG},g" "${PREFIX}/sbin/hassio-apparmor"
sed -i -e "s,%%DOCKER_SERVICE%%,${DOCKER_SERVICE},g" \ sed -i -e "s,%%DOCKER_SERVICE%%,${DOCKER_SERVICE},g" \
-e "s,%%HASSIO_APPARMOR_BINARY%%,${PREFIX}/sbin/hassio-apparmor,g" \ -e "s,%%HASSIO_APPARMOR_BINARY%%,${PREFIX}/sbin/hassio-apparmor,g" \
"${SYSCONFDIR}"/systemd/system/hassio-apparmor.service "${SYSCONFDIR}/systemd/system/hassio-apparmor.service"
chmod a+x "${PREFIX}"/sbin/hassio-apparmor chmod a+x "${PREFIX}/sbin/hassio-apparmor"
systemctl enable hassio-apparmor.service systemctl enable hassio-apparmor.service
systemctl start hassio-apparmor.service systemctl start hassio-apparmor.service
fi fi
@ -182,3 +183,9 @@ fi
# Init system # Init system
echo "[Info] Run Hass.io" echo "[Info] Run Hass.io"
systemctl start hassio-supervisor.service systemctl start hassio-supervisor.service
##
# Setup CLI
echo "[Info] Install cli 'ha'"
curl -sL ${URL_HA} > "${PREFIX}/bin/ha"
chmod a+x "${PREFIX}/bin/ha"