diff --git a/.goreleaser-nightly.yml b/.goreleaser-nightly.yml index 4e2d01636..0acc51d6d 100644 --- a/.goreleaser-nightly.yml +++ b/.goreleaser-nightly.yml @@ -85,6 +85,7 @@ nfpms: dependencies: - adduser + - ucf contents: - src: ./packaging/init/evcc.service diff --git a/.goreleaser.yml b/.goreleaser.yml index 1521acf90..f7d61b785 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -105,6 +105,7 @@ nfpms: dependencies: - adduser + - ucf contents: - src: ./packaging/init/evcc.service diff --git a/packaging/scripts/postinstall.sh b/packaging/scripts/postinstall.sh index 89d7414c1..722ba9e28 100644 --- a/packaging/scripts/postinstall.sh +++ b/packaging/scripts/postinstall.sh @@ -58,6 +58,11 @@ KEEP_ETC_SERVICE=$KEEP_ETC_SERVICE KEEP_USR_LOCAL_BIN=$KEEP_USR_LOCAL_BIN EOF + # Register file with ucfr so it is tracked as belonging to the evcc package + if [ -x /usr/bin/ucfr ]; then + ucfr evcc "$USER_CHOICE_CONFIG" + fi + # Execute the user decision if [ -f "$ETC_SERVICE" ] && [ "$KEEP_ETC_SERVICE" -eq 0 ]; then echo "Deleting old service file '$ETC_SERVICE'" diff --git a/packaging/scripts/postremove.sh b/packaging/scripts/postremove.sh index a0398ef77..610f53a68 100644 --- a/packaging/scripts/postremove.sh +++ b/packaging/scripts/postremove.sh @@ -16,6 +16,12 @@ if [ "$1" = "purge" ]; then deb-systemd-helper purge evcc.service > /dev/null || true deb-systemd-helper unmask evcc.service > /dev/null || true fi + + # Remove the user choices config file and deregister it from ucfr + if [ -x /usr/bin/ucfr ]; then + ucfr --purge evcc /etc/evcc-userchoices.sh || true + fi + rm -f /etc/evcc-userchoices.sh fi # if interactive: call `/usr/bin/evcc checkconfig` and check the return code (newer version)