blob: bb2d118cb562102944d00add4372085a7bdfae3b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
[Unit]
Description=Home assistant update
After=network.target
[Service]
User=hass
Group=hass
LogsDirectory=hass
StateDirectory=hass hass-installation
CacheDirectory=hass
Environment=CARGO_HOME=%C/hass/cargo
Environment=PYTHON_EGG_CACHE=%C/hass/python-eggs
Environment=VIRTUAL_ENV=%S/hass-installation
WorkingDirectory=~
EnvironmentFile=-/etc/hass.env
Type=oneshot
# install or upgrade the python venv, we want
ExecStart=python -m venv --system-site-packages --upgrade "${VIRTUAL_ENV}"
# upgrade home assistant and all its necessary libs
ExecStart=%S/hass-installation/bin/pip install --no-warn-script-location --upgrade homeassistant
ExecStart=sh -c '\
find \
$(%S/hass-installation/bin/python -c "import os.path as path; import site; print(path.dirname(path.dirname(site.getsitepackages()[0])))") -mindepth 1 -type d \
-path $(%S/hass-installation/bin/python -c "import os.path as path; import site; print(path.basename(path.dirname(path.relpath(site.getsitepackages()[0],'${VIRTUAL_ENV}/lib'))))") -prune \
-print0 \
| xargs --no-run-if-empty -0 rm --verbose --recursive'
LockPersonality=true
RestrictRealtime=true
RestrictSUIDSGID=true
ProtectControlGroups=true
ProtectKernelModules=true
ProtectKernelTunables=true
PrivateMounts=true
PrivateTmp=true
ProtectSystem=full
PrivateDevices=true
[Install]
WantedBy=multi-user.target
|