[systemd-devel] How to properly write an "umbrella" unit

Marc Haber mh+systemd-devel at zugschlus.de
Tue Jul 21 05:34:28 PDT 2015


Hi Alexandre,

thanks for your fast answer and correctly guessing my Distribution ,-)

On Tue, Jul 21, 2015 at 02:13:12PM +0200, Alexandre Detiste wrote:
> Le mardi 21 juillet 2015, 13:43:48 Marc Haber a écrit :
> > This works as designed. Unfortunately, my Distribution's build tools
> > don't handle package-provided targets too well, and I feel that using
> > a target here is kind of wrong anyway.
> 
> Hi,
> 
> Package-provided targets works well,
> but by default debhelper will try to enable everything.

In my case, dh_systemd_enable doesn't install the file:
dh_systemd_enable --verbose -pisc-dhcp-server --name=isc-dhcp-server.target
        echo "# Automatically added by dh_systemd_enable">> debian/isc-dhcp-server.postinst.debhelper
        sed "s/#UNITFILE#/isc-dhcp-server-v6.service/" /usr/share/debhelper/autoscripts/postinst-systemd-enable >> debian/isc-dhcp-server.postinst.debhelper
        echo '# End automatically added section' >> debian/isc-dhcp-server.postinst.debhelper
        echo "# Automatically added by dh_systemd_enable">> debian/isc-dhcp-server.postinst.debhelper
        sed "s/#UNITFILE#/isc-dhcp-server-v4.service/" /usr/share/debhelper/autoscripts/postinst-systemd-enable >> debian/isc-dhcp-server.postinst.debhelper
        echo '# End automatically added section' >> debian/isc-dhcp-server.postinst.debhelper
        echo "# Automatically added by dh_systemd_enable">> debian/isc-dhcp-server.postinst.debhelper
        sed "s/#UNITFILE#/isc-dhcp-server-v4-old.service/" /usr/share/debhelper/autoscripts/postinst-systemd-enable >> debian/isc-dhcp-server.postinst.debhelper
        echo '# End automatically added section' >> debian/isc-dhcp-server.postinst.debhelper
        echo "# Automatically added by dh_systemd_enable"> debian/isc-dhcp-server.postrm.debhelper.new
        sed "s/#UNITFILES#/isc-dhcp-server-v6.service isc-dhcp-server-v4.service isc-dhcp-server-v4-old.service/" /usr/share/debhelper/autoscripts/postrm-systemd >> debian/isc-dhcp-server.postrm.debhelper.new
        echo '# End automatically added section' >> debian/isc-dhcp-server.postrm.debhelper.new
        cat debian/isc-dhcp-server.postrm.debhelper >> debian/isc-dhcp-server.postrm.debhelper.new
        mv debian/isc-dhcp-server.postrm.debhelper.new debian/isc-dhcp-server.postrm.debhelper
        (grep -s -v misc:Depends debian/isc-dhcp-server.substvars; echo "misc:Depends=debconf (>= 0.5) | debconf-2.0, init-system-helpers (>= 1.18~)") > debian/isc-dhcp-server.substvars.new
        mv debian/isc-dhcp-server.substvars.new debian/isc-dhcp-server.substvars
dh_installinit -Nisc-dhcp-server
        install -d debian/isc-dhcp-relay/etc/init.d
        install -p -m755 debian/isc-dhcp-relay.init.d debian/isc-dhcp-relay/etc/init.d/isc-dhcp-relay
        echo "# Automatically added by dh_installinit">> debian/isc-dhcp-relay.postinst.debhelper
        sed "s/#SCRIPT#/isc-dhcp-relay/;s/#INITPARMS#/defaults/;s/#ERROR_HANDLER#/exit \$?/" /usr/share/debhelper/autoscripts/postinst-init >> debian/isc-dhcp-relay.postinst.debhelper
        echo '# End automatically added section' >> debian/isc-dhcp-relay.postinst.debhelper
        echo "# Automatically added by dh_installinit">> debian/isc-dhcp-relay.prerm.debhelper
        sed "s/#SCRIPT#/isc-dhcp-relay/;s/#INITPARMS#/defaults/;s/#ERROR_HANDLER#/exit \$?/" /usr/share/debhelper/autoscripts/prerm-init >> debian/isc-dhcp-relay.prerm.debhelper
        echo '# End automatically added section' >> debian/isc-dhcp-relay.prerm.debhelper
        echo "# Automatically added by dh_installinit"> debian/isc-dhcp-relay.postrm.debhelper.new
        sed "s/#SCRIPT#/isc-dhcp-relay/;s/#INITPARMS#/defaults/;s/#ERROR_HANDLER#/exit \$?/" /usr/share/debhelper/autoscripts/postrm-init >> debian/isc-dhcp-relay.postrm.debhelper.new
        echo '# End automatically added section' >> debian/isc-dhcp-relay.postrm.debhelper.new
        cat debian/isc-dhcp-relay.postrm.debhelper >> debian/isc-dhcp-relay.postrm.debhelper.new
        mv debian/isc-dhcp-relay.postrm.debhelper.new debian/isc-dhcp-relay.postrm.debhelper
dh_installinit -pisc-dhcp-server --error-handler=true
#dh_systemd_start isc-dhcp-server.target

and dh_systemd_enable's code specialcasing service, socket, and
tmpfile, but not target, gave me the impression that target files are
unsupported.

My debian/rules is:
override_dh_installinit:
        dh_systemd_enable -pisc-dhcp-server --name=isc-dhcp-server-v4
        dh_systemd_enable -pisc-dhcp-server --name=isc-dhcp-server-v4-old
        dh_systemd_enable -pisc-dhcp-server --name=isc-dhcp-server-v6
        dh_systemd_enable --verbose -pisc-dhcp-server --name=isc-dhcp-server.target
        dh_installinit -Nisc-dhcp-server
        dh_installinit -pisc-dhcp-server --error-handler=true

what is wrong here?

(if this is off-topic in systemd-devel, which I suspect, please feel
free to reply in private mail instead).

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany    |  lose things."    Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature |  How to make an American Quilt | Fax: *49 6224 1600421


More information about the systemd-devel mailing list