[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