I'm trying to package a mono application to run as a systemd service.
I've followed the instructions here: https://wiki.debian.org/Teams/pkg-systemd/Packaging
I've added dh-systemd (>= 1.5) to my debian control file build depends.
I've added --with=systemd to my rules file as follows:
%:
dh $@ --with=cli --with=systemd
I've added my service file to my debian folder called mypackage.service with the following contents:
[Unit]
Description=My Service Description
After=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/mono /usr/lib/mypackage/myservice.exe
[Install]
WantedBy=multi-user.target
However building gives the following lintian warnings and errors:
Now running lintian...
E: mypackage: postrm-does-not-call-updaterc.d-for-init.d-script etc/init.d/mypackage
W: mypackage: init.d-script-not-marked-as-conffile etc/init.d/mypackage
E: mypackage: init.d-script-not-included-in-package etc/init.d/mypackage
This is confusing me for several reasons
- These warning are about init.d which is the old system which is replaced by systemd, are these errors and warnings just wrong, does debuild think I'm using init.d because I've configured my package wrong?
- I was under the impression that the --with=systemd would create these scripts for me.
Update
The generated postrm file is as follows:
#!/bin/sh
set -e
# Automatically added by dh_systemd_start
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_systemd_enable
if [ "$1" = "remove" ]; then
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper mask mypackage.service >/dev/null
fi
fi
if [ "$1" = "purge" ]; then
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper purge mypackage.service >/dev/null
deb-systemd-helper unmask mypackage.service >/dev/null
fi
fi
# End automatically added section
the generated prerm file is as follows:
#!/bin/sh
set -e
# Automatically added by dh_systemd_start
if [ -d /run/systemd/system ]; then
deb-systemd-invoke stop mypackage.service >/dev/null
fi
# End automatically added section
# Automatically added by dh_installinit
if [ -x "/etc/init.d/mypackage" ] || [ -e "/etc/init/mypackage.conf" ]; then
invoke-rc.d mypackage stop || exit $?
fi
# End automatically added section
The package actually installs fine and the service starts correctly. The lintian errors are worrying, and I'd like to get to the bottom of them.
postrm
script contain? Does it have the debhelper boilerplate?dh
) should be generating appropriate ones. Rundpkg-deb --control
on the generated deb file, and look in the newly-createdDEBIAN
directory forpostinst
,postrm
files.