Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:zzndb001:test
homeassistant-supervised
homeassistant-supervised.spec
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File homeassistant-supervised.spec of Package homeassistant-supervised
# # spec file for package homeassistant-supervised # # Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: homeassistant-supervised Version: 1.8.0 Release: 0 Summary: Home Assistant Supervised License: Apache-2.0 URL: https://github.com/home-assistant/supervised-installer Source0: %{name}-%{version}.tar.xz Source1: apparmor.txt Requires: docker Requires: NetworkManager Requires: patterns-base-apparmor Requires: jq Requires: homeassistant-os-agent Requires: systemd-network Requires: systemd-journal-remote Requires: bluez %description %{summary}. %prep %setup -q pushd homeassistant-supervised/usr/ sed -i 's|/usr/bin/env bash|/usr/bin/bash|' bin/ha sed -i 's|/usr/bin/env bash|/usr/bin/bash|' sbin/hassio-apparmor popd %build %install install -Dm755 homeassistant-supervised/usr/bin/ha %{buildroot}%{_bindir}/ha install -Dm755 homeassistant-supervised/usr/sbin/hassio-apparmor %{buildroot}%{_sbindir}/hassio-apparmor install -Dm755 homeassistant-supervised/usr/sbin/hassio-supervisor %{buildroot}%{_sbindir}/hassio-supervisor install -Dm644 %{S:1} %{buildroot}%{_datadir}/hassio/apparmor/hassio-supervisor install -Dm644 homeassistant-supervised/etc/NetworkManager/NetworkManager.conf %{buildroot}%{_sysconfdir}/NetworkManager/conf.d/hassio.conf install -Dm644 homeassistant-supervised/etc/systemd/system/hassio-apparmor.service %{buildroot}%{_unitdir}/hassio-apparmor.service install -Dm644 homeassistant-supervised/etc/systemd/system/hassio-supervisor.service %{buildroot}%{_unitdir}/hassio-supervisor.service install -Dm644 homeassistant-supervised/etc/systemd/system/systemd-journal-gatewayd.socket.d/10-hassio-supervisor.conf %{buildroot}%{_unitdir}/systemd-journal-gatewayd.socket.d/10-hassio-supervisor.conf install -d %{buildroot}%{_sbindir} ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rchassio-apparmor ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rchassio-supervisor %pre %service_add_pre hassio-apparmor.service hassio-supervisor.service %post %service_add_post hassio-apparmor.service hassio-supervisor.service if [ "$1" -ge 1 ] ; then # ref: DEBIAN/postinst ARCH=$(uname -m) BINARY_DOCKER=/usr/bin/docker DOCKER_REPO="ghcr.io/home-assistant" SERVICE_DOCKER="docker.service" SERVICE_NM="NetworkManager.service" # Read infos from web # URL_CHECK_ONLINE="https://checkonline.home-assistant.io/online.txt" # URL_VERSION="https://version.home-assistant.io/stable.json" # HASSIO_VERSION=$(curl -s ${URL_VERSION} | jq -e -r '.supervisor') # URL_APPARMOR_PROFILE="https://version.home-assistant.io/apparmor.txt" # reload systemd # echo "Reload systemd" # systemctl daemon-reload # Restart NetworkManager # echo "Restarting NetworkManager" # systemctl restart "${SERVICE_NM}" # Enable and start systemd-resolved # if [ "$(systemctl is-active systemd-resolved)" = 'inactive' ]; then # echo "Enable systemd-resolved" # systemctl enable systemd-resolved.service> /dev/null 2>&1; # systemctl start systemd-resolved.service> /dev/null 2>&1; # fi # Check and fix systemd-journal-gatewayd socket location # if [ ! -S "/run/systemd-journal-gatewayd.sock" ]; then # info "Set up systemd-journal-gatewayd socket file" # if [ "$(systemctl is-active systemd-journal-gatewayd.socket)" = 'active' ]; then # systemctl stop systemd-journal-gatewayd.socket> /dev/null 2>&1; # fi # rm -rf "/run/systemd-journal-gatewayd.sock"; # fi # Enable and start systemd-journal-gatewayd # if [ "$(systemctl is-active systemd-journal-gatewayd.socket)" = 'inactive' ]; then # info "Enable systemd-journal-gatewayd" # systemctl enable systemd-journal-gatewayd.socket> /dev/null 2>&1; # systemctl start systemd-journal-gatewayd.socket> /dev/null 2>&1; # fi # Restart Docker service # echo "Restarting docker service" # systemctl restart "${SERVICE_DOCKER}" # Check network connection # while ! curl -q ${URL_CHECK_ONLINE} >/dev/null 2>&1 ; do # echo "Waiting for ${URL_CHECK_ONLINE} - network interface might be down..." # sleep 2 # done # Get primary network interface # PRIMARY_INTERFACE=$(ip route | awk '/^default/ { print $5; exit }') # IP_ADDRESS=$(ip -4 addr show dev "${PRIMARY_INTERFACE}" | awk '/inet / { sub("/.*", "", $2); print $2 }') case ${ARCH} in "i386" | "i686") MACHINE=${MACHINE:=qemux86} HASSIO_DOCKER="${DOCKER_REPO}/i386-hassio-supervisor" ;; "x86_64") MACHINE=${MACHINE:=qemux86-64} HASSIO_DOCKER="${DOCKER_REPO}/amd64-hassio-supervisor" ;; "arm" |"armv6l") MACHINE="${MACHINE:=qemuarm}" HASSIO_DOCKER="${DOCKER_REPO}/armhf-hassio-supervisor" ;; "armv7l") MACHINE="${MACHINE:=qemuarm}" HASSIO_DOCKER="${DOCKER_REPO}/armv7-hassio-supervisor" ;; "aarch64") MACHINE="${MACHINE:=qemuarm-64}" HASSIO_DOCKER="${DOCKER_REPO}/aarch64-hassio-supervisor" ;; *) error "${ARCH} unknown!" ;; esac PREFIX=${PREFIX:-/usr} SYSCONFIDR=${SYSCONFDIR:-/etc} UNITDIR=${UNITDIR:-$PREFIX/lib/systemd} DATA_SHARE=${DATA_SHARE:-$PREFIX/share/hassio} CONFIG="${SYSCONFIDR}/hassio.json" cat > "${CONFIG}" <<- EOF { "supervisor": "${HASSIO_DOCKER}", "machine": "${MACHINE}", "data": "${DATA_SHARE}" } EOF # Install Supervisor # info "Install supervisor startup scripts" sed -i "s,%%%HASSIO_CONFIG%%%,${CONFIG},g" "${PREFIX}"/sbin/hassio-supervisor sed -i -e "s,%%%BINARY_DOCKER%%%,${BINARY_DOCKER},g" \ -e "s,%%%SERVICE_DOCKER%%%,${SERVICE_DOCKER},g" \ -e "s,%%%BINARY_HASSIO%%%,${PREFIX}/sbin/hassio-supervisor,g" \ "${UNITDIR}/system/hassio-supervisor.service" # chmod a+x "${PREFIX}/sbin/hassio-supervisor" # systemctl enable hassio-supervisor.service > /dev/null 2>&1; # Install AppArmor echo "Install AppArmor scripts" mkdir -p "${DATA_SHARE}/apparmor" # curl -sL ${URL_APPARMOR_PROFILE} > "${DATA_SHARE}/apparmor/hassio-supervisor" sed -i "s,%%%HASSIO_CONFIG%%%,${CONFIG},g" "${PREFIX}/sbin/hassio-apparmor" sed -i -e "s,%%%SERVICE_DOCKER%%%,${SERVICE_DOCKER},g" \ -e "s,%%%HASSIO_APPARMOR_BINARY%%%,${PREFIX}/sbin/hassio-apparmor,g" \ "${UNITDIR}/system/hassio-apparmor.service" # systemctl enable hassio-apparmor.service > /dev/null 2>&1; # systemctl start hassio-apparmor.service # Start Supervisor # info "Start Home Assistant Supervised" # systemctl start hassio-supervisor.service # Switch to cgroup v1 # if [ -f /etc/default/grub ] # then # if ! grep -q "systemd.unified_cgroup_hierarchy=false" /etc/default/grub; then # info "Switching to cgroup v1" # cp /etc/default/grub /etc/default/grub.bak # sed -i 's/^GRUB_CMDLINE_LINUX_DEFAULT="/&systemd.unified_cgroup_hierarchy=false /' /etc/default/grub # update-grub # touch /var/run/reboot-required # fi # elif [ -f /boot/firmware/cmdline.txt ] # then # if ! grep -q "systemd.unified_cgroup_hierarchy=false" /boot/firmware/cmdline.txt; then # info "Switching to cgroup v1" # sed -i.bak 's/$/ systemd.unified_cgroup_hierarchy=false/' /boot/firmware/cmdline.txt # touch /var/run/reboot-required # fi # else # warn "Could not find /etc/default/grub or /boot/firmware/cmdline.txt failed to switch to cgroup v1" # fi # info "Within a few minutes you will be able to reach Home Assistant at:" # info "http://homeassistant.local:8123 or using the IP address of your" # info "machine: http://${IP_ADDRESS}:8123" # if [ -f /var/run/reboot-required ] # then # warn "A reboot is required to apply changes to grub." # fi fi %preun %service_del_preun hassio-apparmor.service hassio-supervisor.service %postun %service_del_postun hassio-apparmor.service hassio-supervisor.service %files %license LICENSE %doc README.md %{_bindir}/ha %{_sbindir}/hassio-apparmor %{_sbindir}/hassio-supervisor %{_datadir}/hassio %{_datadir}/hassio/apparmor/hassio-supervisor %config %{_sysconfdir}/NetworkManager/conf.d/hassio.conf %dir %{_sysconfdir}/NetworkManager %dir %{_sysconfdir}/NetworkManager/conf.d %{_unitdir}/systemd-journal-gatewayd.socket.d/ %{_sbindir}/rchassio-apparmor %{_sbindir}/rchassio-supervisor %{_unitdir}/hassio-apparmor.service %{_unitdir}/hassio-supervisor.service %changelog
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor