[Unit] Description=Home assistant update After=network.target [Service] User=hass Group=hass LogsDirectory=hass StateDirectory=hass WorkingDirectory=~ EnvironmentFile=-/etc/hass.env Type=oneshot # upgrade home assistant and all its necessary libs ExecStart=pip install --no-warn-script-location --user --upgrade homeassistant # delete old python version libraries in the venv ExecStart=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' 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