Skip to content

Commit

Permalink
Rename & add cli (home-assistant#92)
Browse files Browse the repository at this point in the history
* Rename & add cli

* update readme

* update check

* Fix lint

* fix lint
  • Loading branch information
pvizeli authored Mar 30, 2020
1 parent 9646609 commit 9f5d4fd
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 23 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

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.
Expand Down Expand Up @@ -31,7 +29,7 @@ network-manager
Run as root (sudo su):

```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
Expand All @@ -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:

```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
Expand All @@ -65,4 +63,3 @@ curl -sL https://raw.githubusercontent.com/home-assistant/hassio-installer/maste
- raspberrypi3-64
- raspberrypi4-64
- tinker

2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ jobs:
- script: |
sudo docker run --rm -i \
-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'
4 changes: 4 additions & 0 deletions files/ha
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
# shellcheck disable=SC2048,SC2086

docker exec hassio_cli ha $*
2 changes: 1 addition & 1 deletion files/hassio-apparmor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash
set -e

# Load configs
Expand Down
2 changes: 1 addition & 1 deletion files/hassio-supervisor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash
set -e

# Load configs
Expand Down
37 changes: 22 additions & 15 deletions hassio_install.sh → installer.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ DOCKER_BINARY=/usr/bin/docker
DOCKER_REPO=homeassistant
DOCKER_SERVICE=docker.service
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_BIN_APPARMOR="https://raw.githubusercontent.com/home-assistant/hassio-installer/master/files/hassio-apparmor"
URL_SERVICE_HASSIO="https://raw.githubusercontent.com/home-assistant/hassio-installer/master/files/hassio-supervisor.service"
URL_SERVICE_APPARMOR="https://raw.githubusercontent.com/home-assistant/hassio-installer/master/files/hassio-apparmor.service"
URL_HA="https://raw.githubusercontent.com/home-assistant/installer/master/files/ha"
URL_BIN_HASSIO="https://raw.githubusercontent.com/home-assistant/installer/master/files/hassio-supervisor"
URL_BIN_APPARMOR="https://raw.githubusercontent.com/home-assistant/installer/master/files/hassio-apparmor"
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"

# Check env
Expand Down Expand Up @@ -147,33 +148,33 @@ docker tag "$HASSIO_DOCKER:$HASSIO_VERSION" "$HASSIO_DOCKER:latest" > /dev/null
##
# Install Hass.io Supervisor
echo "[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
curl -sL ${URL_BIN_HASSIO} > "${PREFIX}/sbin/hassio-supervisor"
curl -sL ${URL_SERVICE_HASSIO} > "${SYSCONFDIR}/systemd/system/hassio-supervisor.service"

sed -i "s,%%HASSIO_CONFIG%%,${CONFIG},g" "${PREFIX}"/sbin/hassio-supervisor
sed -i -e "s,%%DOCKER_BINARY%%,${DOCKER_BINARY},g" \
-e "s,%%DOCKER_SERVICE%%,${DOCKER_SERVICE},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

#
# Install Hass.io AppArmor
if command -v apparmor_parser > /dev/null 2>&1; then
echo "[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
curl -sL ${URL_APPARMOR_PROFILE} > "${DATA_SHARE}"/apparmor/hassio-supervisor
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"
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" \
-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 start hassio-apparmor.service
fi
Expand All @@ -182,3 +183,9 @@ fi
# Init system
echo "[Info] Run Hass.io"
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"

0 comments on commit 9f5d4fd

Please sign in to comment.