Профиль настройки Home Assistant

master 79
parent b234c35a2a
commit 6e68867037

@ -0,0 +1,2 @@
calculate:default/amd64/20/server
../..

@ -0,0 +1,2 @@
../../../../calculate/profiles/default/amd64/18/server
..

@ -0,0 +1,3 @@
[main]
os_linux_name = 'Calculate Home Assistant'
os_linux_shortname = 'homeassistant'

@ -7,8 +7,8 @@
#arch profile_directory status
# AMD64 Profiles
amd64 homeassistant/amd64/20 dev
amd64 scratch/amd64/20 stable
amd64 mastodon/amd64/20 dev
amd64 taiga/amd64/20 dev
# vim: set ts=8

@ -0,0 +1,23 @@
#!/bin/bash
# Install Home Assistant
set -ueo pipefail
export PATH="/lib/rc/bin:$PATH"
scriptpath=$(dirname $(readlink -f $0))
. /var/db/repos/calculate/scripts/ini.sh
echo "Home Assistant setup"
chown homeassistant: /var/calculate/ini.env
for script in $scriptpath/step/*.sh; do
"$script"
done
if [[ ! -e /etc/runlevels/default/homeassistant ]]; then
cl-setup-system
rc-update -u
fi
openrc
echo -e "\nAll is done! Open the link ${ini[homeassistant.protocol]}://${ini[homeassistant.domain]} on your browser."

@ -0,0 +1,28 @@
#!/bin/bash
set -ueo pipefail
export PATH="/lib/rc/bin:$PATH"
SCRIPT=$(readlink -f $0)
[[ $UID == 0 ]] && exec su - homeassistant -c "$SCRIPT"
. /var/db/repos/container/scripts/functions.sh
. /var/db/repos/calculate/scripts/ini.sh
if [[ ! -e ~/.venv ]]; then
einfo 'Create a virtualenv'
cd ~
python -m venv .venv
source .venv/bin/activate
echo
einfo 'Install Python dependencies'
python -m pip install wheel
echo
einfo 'Install Home Assistant'
pip install homeassistant
eend
fi

@ -0,0 +1,33 @@
#!/bin/bash
set -ueo pipefail
[[ -n "$(ls -A /var/lib/postgresql)" ]] && exit
export PATH="/lib/rc/bin:$PATH"
. /var/db/repos/container/scripts/functions.sh
. /var/db/repos/calculate/scripts/ini.sh
pgver() {
local ver=$(ls -d /var/db/pkg/dev-db/postgresql-*)
ver=${ver#*postgresql-}
if [[ ${1:-} == 'slot' ]]; then
echo ${ver%%.*}
else
echo ${ver%%-*}
fi
}
emerge --config =dev-db/postgresql-$(pgver)
/etc/init.d/postgresql-$(pgver slot) start
psql -U postgres -c "ALTER USER postgres WITH PASSWORD '${ini[postgresql.postgres_password]}'"
psql -U postgres -c "CREATE ROLE ${ini[postgresql.homeassistant_user]} WITH login"
psql -U postgres -c "CREATE DATABASE homeassistant OWNER homeassistant"
psql -U postgres -c "ALTER USER ${ini[postgresql.homeassistant_user]} WITH PASSWORD '${ini[postgresql.homeassistant_password]}'"
cl-core-setup -n postgresql -f
/etc/init.d/postgresql-$(pgver slot) restart

@ -0,0 +1,21 @@
#!/bin/bash
set -ueo pipefail
export PATH="/lib/rc/bin:$PATH"
SCRIPT=$(readlink -f $0)
[[ $UID == 0 ]] && exec su - homeassistant -c "$SCRIPT"
. /var/db/repos/container/scripts/functions.sh
. /var/db/repos/calculate/scripts/ini.sh
cd ~
timeout 5 /var/calculate/www/homeassistant/.venv/bin/hass || true
if ! grep -q http .homeassistant/configuration.yaml; then
cat >> .homeassistant/configuration.yaml << EOF
http:
use_x_forwarded_for: true
trusted_proxies: 127.0.0.1
EOF
fi
Loading…
Cancel
Save