summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorMichael Stapelberg <stapelberg@debian.org>2013-06-19 19:34:32 +0200
committerMichael Stapelberg <michael@stapelberg.de>2013-06-19 19:34:32 +0200
commit161f08adc64afa64557f2e39cdfc8631dfa509a3 (patch)
tree48536c37ed8912b2a22f545c2e31b61a94d34e42 /script
parent9af8007ebd68dff0358aa1b82f7e38c2e4b67b5b (diff)
downloadinit-system-helpers-161f08adc64afa64557f2e39cdfc8631dfa509a3.tar.gz
deb-systemd-helper: delete state file on remove if user didn’t disable service
This makes dpkg -i, dpkg -r, dpkg -i work correctly. Before, the user would end up with a disabled service.
Diffstat (limited to 'script')
-rwxr-xr-xscript/deb-systemd-helper8
1 files changed, 6 insertions, 2 deletions
diff --git a/script/deb-systemd-helper b/script/deb-systemd-helper
index 1a4e30f..186a7d8 100755
--- a/script/deb-systemd-helper
+++ b/script/deb-systemd-helper
@@ -195,8 +195,12 @@ sub remove_links {
# Also disable all the units which were enabled when this one was enabled.
for my $link (@other) {
- # Delete the corresponding state file
- if (is_purge()) {
+ # Delete the corresponding state file:
+ # • Always when purging
+ # • If the user did not disable (= link still exists) the service.
+ # If we don’t do this, the link will be deleted a few lines down,
+ # but not re-created when re-installing the package.
+ if (is_purge() || -l $link) {
my $link_state = $link;
$link_state =~ s,^/etc/systemd/system/,$state_dir/,;
unlink($link_state);