diff --git a/CT-Build/Fedora.yaml b/CT-Build/Fedora.yaml index acd76d3..b557d3a 100644 --- a/CT-Build/Fedora.yaml +++ b/CT-Build/Fedora.yaml @@ -60,6 +60,12 @@ files: download_updates = yes upgrade_type = security +#FileForHass +- path: /opt/Setup + generator: copy + source: CT-Files/hass + variants: + - hass packages: manager: dnf @@ -86,6 +92,7 @@ packages: - policycoreutils - procps-ng - systemd-udev + - systemd-networkd - which - dnf-automatic action: install @@ -96,6 +103,34 @@ packages: - sssd-client action: remove +#PKGS for Hass + - packages: + - git + - python3 + - python3-virtualenv + - python3-pip + - python3-devel + - libffi-devel + - openssl-devel + - nmap + - glibc + - glibc-devel + - gcc + - gcc-c++ + - make + - patch + - binutils + - turbojpeg + #- mariadb + - mariadb-connector-c-devel + - libudev-devel + - ffmpeg + - unzip + #- nano + action: install + variants: + - hass + actions: - trigger: post-unpack action: |- @@ -109,6 +144,9 @@ actions: # Let dnf find the fastest mirror echo fastestmirror=True >> /etc/dnf/dnf.conf + # skip weak dependencies + echo install_weak_deps=False >> /etc/dnf/dnf.conf + #ProxyCacheSetting echo '#CacheServer not set' >> /etc/dnf/dnf.conf @@ -140,8 +178,6 @@ actions: #!/bin/sh umount -l /etc/resolv.conf || true rm /etc/resolv.conf - ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf - systemctl enable systemd-resolved cp -R /etc/skel/.bash* /root/ systemctl enable dnf-automatic.timer @@ -154,4 +190,13 @@ actions: # Restore repos for repo in $(ls /etc/yum.repos.d/*.bak); do mv "${repo}" ${repo%.*} - done \ No newline at end of file + done + +#Run provided init script +- trigger: post-files + action: |- + #!/bin/sh + bash /opt/Setup/Scripts/Init.sh || exit 1 + rm /opt/Setup/Scripts/Init.sh + variants: + - hass \ No newline at end of file diff --git a/CT-Files/hass/Configs/hass.service b/CT-Files/hass/Configs/hass.service new file mode 100644 index 0000000..d270211 --- /dev/null +++ b/CT-Files/hass/Configs/hass.service @@ -0,0 +1,13 @@ +[Unit] +Description=Home Assistant +After=network-online.target + +[Service] +Type=simple +User=hass +WorkingDirectory=/opt/HomeAssistant/data +ExecStart=/opt/HomeAssistant/srv/bin/hass -c "/opt/HomeAssistant/data" +RestartForceExitStatus=100 + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/CT-Files/hass/Scripts/Init.sh b/CT-Files/hass/Scripts/Init.sh new file mode 100644 index 0000000..2df0890 --- /dev/null +++ b/CT-Files/hass/Scripts/Init.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#Install HomeAssistant +mkdir -p /opt/HomeAssistant/srv +mkdir -p /opt/HomeAssistant/data/custom_components/hacs +touch /opt/HomeAssistant/data/home-assistant.log +adduser --system --shell /bin/sh --home /opt/HomeAssistant/data hass +chown -R hass:hass /opt/HomeAssistant +su hass -c 'python3 -m venv /opt/HomeAssistant/srv' + +su hass -c '. /opt/HomeAssistant/srv/bin/activate; pip install --upgrade pip; pip3 install wheel isal zlib-ng mysqlclient; pip3 install homeassistant' + +#Install Home Assistant Community Store +curl -L --retry 7 --retry-delay 5 https://github.com/hacs/integration/releases/latest/download/hacs.zip -o /tmp/hacs.zip +su hass -c 'unzip -q /tmp/hacs.zip -d /opt/HomeAssistant/data/custom_components/hacs' + +#Update script +mv /opt/Setup/Scripts/UpdateHASS.sh /opt/UpdateHASS.sh + +#CleanUp +rm -rf /opt/HomeAssistant/data/.cache/* +rm -rf /usr/lib/python3.13/__pycache__/* + +#Setup HomeAssistant service +mv /opt/Setup/Configs/hass.service /etc/systemd/system/hass.service +systemctl enable hass \ No newline at end of file diff --git a/CT-Files/hass/Scripts/PTKAppUpdate.sh b/CT-Files/hass/Scripts/PTKAppUpdate.sh new file mode 100644 index 0000000..9c71933 --- /dev/null +++ b/CT-Files/hass/Scripts/PTKAppUpdate.sh @@ -0,0 +1,3 @@ +#!/bin/sh +# Update script for updating apps with ProxmoxHelper/ProxMoxToolKit +bash /opt/UpdateHASS.sh \ No newline at end of file diff --git a/CT-Files/hass/Scripts/UpdateHASS.sh b/CT-Files/hass/Scripts/UpdateHASS.sh new file mode 100644 index 0000000..e7b1ea7 --- /dev/null +++ b/CT-Files/hass/Scripts/UpdateHASS.sh @@ -0,0 +1,4 @@ +#!/bin/bash +systemctl stop hass +sudo -u hass sh -c '. /opt/HomeAssistant/srv/bin/activate && pip install --upgrade pip && pip3 install --upgrade homeassistant' +service start hass \ No newline at end of file