summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authoretckeeper2022-05-19 15:51:19 +0200
committeretckeeper2022-05-19 15:51:19 +0200
commite721c95caeaaba179520db8f5fab35d9264abe7e (patch)
treed47da615fe5227fb46f7366ee5d6a51b1b10d694
downloadaur-e721c95caeaaba179520db8f5fab35d9264abe7e.tar.gz
initial version
-rw-r--r--.SRCINFO53
-rw-r--r--PKGBUILD60
-rw-r--r--hass-update.service30
-rw-r--r--hass.env5
-rw-r--r--hass.install7
-rw-r--r--hass.service33
-rw-r--r--hass.sysusers1
-rw-r--r--hass.tmpfiles1
8 files changed, 190 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..2e51bef817d3
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,53 @@
+pkgbase = home-assistant-service-pip
+ pkgdesc = Self installing package of Home Assistant using pip
+ pkgver = 1
+ pkgrel = 1
+ url = https://home-assistant.io/
+ install = hass.install
+ arch = any
+ license = APACHE
+ depends = python-aiohttp
+ depends = python-aiohttp-cors
+ depends = python-astral
+ depends = python-async-timeout
+ depends = python-attrs
+ depends = python-awesomeversion
+ depends = python-bcrypt
+ depends = python-certifi
+ depends = python-ciso8601
+ depends = python-cryptography
+ depends = python-defusedxml
+ depends = python-httpx
+ depends = python-jinja
+ depends = python-mutagen
+ depends = python-pillow
+ depends = python-pip
+ depends = python-pyjwt
+ depends = python-pytz
+ depends = python-requests
+ depends = python-ruamel-yaml
+ depends = python-slugify
+ depends = python-sqlalchemy
+ depends = python-voluptuous
+ depends = python-voluptuous-serialize
+ depends = python-yaml
+ depends = python-yarl
+ depends = python-zeroconf
+ depends = python
+ optdepends = net-tools: Nmap host discovery
+ optdepends = openzwave: Z-Wave integration
+ optdepends = python-dtlssocket: Ikea Tradfri integration
+ optdepends = python-lxml: Meteo France integration
+ backup = etc/hass.env
+ source = hass.service
+ source = hass-update.service
+ source = hass.sysusers
+ source = hass.tmpfiles
+ source = hass.env
+ sha256sums = 680ed79423fd66af3201c9eaf08abdbd0aea0ef1e9ca7fd89d182065117a06f6
+ sha256sums = 4cc30ae7bc72471c4c918548a1574be82ca75ee0f852eb9602aa1f09566dc715
+ sha256sums = ee49a7bb8ce2cf2bb34f53708d205aea4e16c25c1cb9d3925d562286ab499852
+ sha256sums = ce1491f82b257f915d41f9556636bb2a924d95c8ae6e0e85188c2b15849f82de
+ sha256sums = 0418c572087bfd0c7946b1cf662619e58c09b4c4972d1e705354fe26b38e4a7c
+
+pkgname = home-assistant-service-pip
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..4ff008c212ed
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,60 @@
+pkgname=home-assistant-service-pip
+_serviceName=hass
+pkgdesc='Self installing package of Home Assistant using pip'
+pkgver=1
+pkgrel=1
+arch=('any')
+url='https://home-assistant.io/'
+license=(APACHE)
+depends=(
+ python-aiohttp
+ python-aiohttp-cors
+ python-astral
+ python-async-timeout
+ python-attrs
+ python-awesomeversion
+ python-bcrypt
+ python-certifi
+ python-ciso8601
+ python-cryptography
+ python-defusedxml
+ python-httpx
+ python-jinja
+ python-mutagen
+ python-pillow
+ python-pip
+ python-pyjwt
+ python-pytz
+ python-requests
+ python-ruamel-yaml
+ python-slugify
+ python-sqlalchemy
+ python-voluptuous
+ python-voluptuous-serialize
+ python-yaml
+ python-yarl
+ python-zeroconf
+ python
+)
+optdepends=(
+ 'net-tools: Nmap host discovery'
+ 'openzwave: Z-Wave integration'
+ 'python-dtlssocket: Ikea Tradfri integration'
+ 'python-lxml: Meteo France integration'
+)
+source=("${_serviceName}.service" "${_serviceName}-update.service" "${_serviceName}.sysusers" "${_serviceName}.tmpfiles" "${_serviceName}.env")
+sha256sums=('680ed79423fd66af3201c9eaf08abdbd0aea0ef1e9ca7fd89d182065117a06f6'
+ '4cc30ae7bc72471c4c918548a1574be82ca75ee0f852eb9602aa1f09566dc715'
+ 'ee49a7bb8ce2cf2bb34f53708d205aea4e16c25c1cb9d3925d562286ab499852'
+ 'ce1491f82b257f915d41f9556636bb2a924d95c8ae6e0e85188c2b15849f82de'
+ '0418c572087bfd0c7946b1cf662619e58c09b4c4972d1e705354fe26b38e4a7c')
+backup=("etc/${_serviceName}.env")
+install="${_serviceName}.install"
+
+package() {
+ install -Dvm 644 "${srcdir}/${_serviceName}.service" "${pkgdir}/usr/lib/systemd/system/${_serviceName}.service"
+ install -Dvm 644 "${srcdir}/${_serviceName}-update.service" "${pkgdir}/usr/lib/systemd/system/${_serviceName}-update.service"
+ install -Dvm 644 "${srcdir}/${_serviceName}.sysusers" "${pkgdir}/usr/lib/sysusers.d/${_serviceName}.conf"
+ install -Dvm 644 "${srcdir}/${_serviceName}.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/${_serviceName}.conf"
+ install -Dvm 644 "${srcdir}/${_serviceName}.env" "${pkgdir}/etc/${_serviceName}.env"
+}
diff --git a/hass-update.service b/hass-update.service
new file mode 100644
index 000000000000..7bd0207f192e
--- /dev/null
+++ b/hass-update.service
@@ -0,0 +1,30 @@
+[Unit]
+Description=Home assistant update
+After=network.target
+
+[Service]
+User=hass
+Group=hass
+LogsDirectory=hass
+StateDirectory=hass
+WorkingDirectory=~
+
+EnvironmentFile=-/etc/hass.env
+
+Type=oneshot
+# delete old python version libraries in the venv
+ExecStartPre=sh -c 'find $(python -c "import os.path as path; import site; print(path.dirname(path.dirname(site.getusersitepackages())))") -mindepth 1 -type d -path $(python -c "import os.path as path; import site; print(path.basename(path.dirname(path.relpath(site.getusersitepackages(),site.getuserbase()))))") -prune -print0 | xargs --no-run-if-empty -0 rm --verbose --recursive'
+
+# upgrade home assistant and all its necessary libs
+ExecStartPre=pip install --no-warn-script-location --user --upgrade homeassistant
+
+LockPersonality=true
+RestrictRealtime=true
+RestrictSUIDSGID=true
+ProtectControlGroups=true
+ProtectKernelModules=true
+ProtectKernelTunables=true
+PrivateMounts=true
+
+[Install]
+WantedBy=multi-user.target
diff --git a/hass.env b/hass.env
new file mode 100644
index 000000000000..f8262f4fbc82
--- /dev/null
+++ b/hass.env
@@ -0,0 +1,5 @@
+# Strongly recommended to speed up build, it's unused anyway
+Environment=CRYPTOGRAPHY_DONT_BUILD_RUST=1
+# set to the number of jobs for the machine
+# Environment=MAKEFLAGS="-j4"
+# Environment=NPY_NUM_BUILD_JOBS="4" \ No newline at end of file
diff --git a/hass.install b/hass.install
new file mode 100644
index 000000000000..5dfba4a3fc1d
--- /dev/null
+++ b/hass.install
@@ -0,0 +1,7 @@
+post-install() {
+ cat - <<- 'EOF'
+ This package installs a hass.service and a hass-update.service to manage the Home Assistant installation.
+ You can ( and should ) configure the parameters for native modules compilation at /etc/hass.env.
+ Auto update and installation of Home Assistant is handled before service launch/restart, it may take a while, especially the first time.
+ EOF
+} \ No newline at end of file
diff --git a/hass.service b/hass.service
new file mode 100644
index 000000000000..9430597e1c29
--- /dev/null
+++ b/hass.service
@@ -0,0 +1,33 @@
+[Unit]
+Description=Home assistant
+After=network.target
+After=hass-update.service
+Wants=hass-update.service
+
+[Service]
+Restart=on-failure
+User=hass
+Group=hass
+LogsDirectory=hass
+StateDirectory=hass
+WorkingDirectory=~
+
+EnvironmentFile=-/etc/hass.env
+
+ExecStart=python -m homeassistant \
+ --config "." \
+ --log-file "${LOGS_DIRECTORY}/home-assistant.log" \
+ --log-rotate-days 1
+RestartForceExitStatus=100
+
+LockPersonality=true
+RestrictRealtime=true
+RestrictSUIDSGID=true
+ProtectControlGroups=true
+ProtectKernelModules=true
+ProtectKernelTunables=true
+PrivateMounts=true
+
+
+[Install]
+WantedBy=multi-user.target
diff --git a/hass.sysusers b/hass.sysusers
new file mode 100644
index 000000000000..405affd762a3
--- /dev/null
+++ b/hass.sysusers
@@ -0,0 +1 @@
+u hass - "Home Assistant" /var/lib/hass
diff --git a/hass.tmpfiles b/hass.tmpfiles
new file mode 100644
index 000000000000..5d57ecf8b1c9
--- /dev/null
+++ b/hass.tmpfiles
@@ -0,0 +1 @@
+d /var/lib/hass/ 700 hass hass