evcc-io/packaging/scripts/postinstall.sh
Andreas Linde 79d6388681
Nightly build fix
APT packaging fixes

- Adopt nightly versioning to be parsed
- Fix binary source path for release builds

Improve unstable build versioning

Use timestamp as bugfix version, as we would have the same version number in all builds until the version tag gets updated
2021-12-04 19:27:08 +01:00

28 lines
No EOL
1 KiB
Bash

#!/bin/sh
set -e
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask evcc.service >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled evcc.service; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable evcc.service >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state evcc.service >/dev/null || true
fi
# Restart only if it was already started
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
if [ -n "$2" ]; then
deb-systemd-invoke try-restart evcc.service >/dev/null || true
else
deb-systemd-invoke start evcc.service >/dev/null || true
fi
fi
fi