简体   繁体   中英

Systemd service in package is restarted on upgrade

I use debhelper with python setuptools in order to build my packages. I recently updated the compatibility level 9 to 11 in order to use the systemd timers.

From that moment every time I upgrade the package the service contained is restarted. I tried to build with the following rules:

#! /usr/bin/make -f

#export DH_VERBOSE = 1
export PYBUILD_NAME=my_pkg
export DH_ALWAYS_EXCLUDE=CVS:.svn:.git:.vscode*
export PYBUILD_INTERPRETERS=python3

%:
    dh $@ --with python3 --buildsystem=pybuild

override_dh_installinit:
        dh_installinit --no-stop-on-upgrade --no-restart-on-upgrade --no-restart-after-upgrade --no-start

override_dh_systemd_enable:
        dh_systemd_enable --name=my_pkg

override_dh_systemd_start:
        dh_systemd_start --no-stop-on-upgrade --no-restart-on-upgrade --no-restart-after-upgrade --no-start
        python3 setup.py clean --all

According to the documentation those tags should do what I look for but probably there is something I'm missing:

dh_systemd_start

dh_installinit

Every time I update it the service contained is restarted. The service is running the update itself so when is restarted the update is left uncompleted.

As expected I was looking in the wrong direction. The correct option to use is: dh_installsystemd

change the rule file into:

#! /usr/bin/make -f

#export DH_VERBOSE = 1
export PYBUILD_NAME=my_pkg
export DH_ALWAYS_EXCLUDE=CVS:.svn:.git:.vscode*
export PYBUILD_INTERPRETERS=python3

%:
    dh $@ --with python3 --buildsystem=pybuild

override_dh_systemd_enable:
        dh_systemd_enable --name=my_pkg

override_dh_installsystemd:
        dh_installsystemd --no-restart-after-upgrade

override_dh_systemd_start:
        python3 setup.py clean --all

I hope this will help someone else in the same situation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM