[systemd-devel] How to properly write an "umbrella" unit
Marc Haber
mh+pkg-systemd-maintainers at zugschlus.de
Wed Jul 22 09:06:08 BST 2015
Hi Alexandre,
On Tue, Jul 21, 2015 at 10:00:17PM +0200, Alexandre Detiste wrote:
> > thanks for your fast answer and correctly guessing my Distribution ,-)
> >
> > (if this is off-topic in systemd-devel, which I suspect, please feel
> > free to reply in private mail instead).
>
> Oops, I just tought I was reading other list
> pkg-systemd-maintainers at lists.alioth.debian.org ;
> you can send your dh_systemd specific questions there.
>
> Im' subscribed
I'm not at the moment, please keep me CC'ed.
> > 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
>
> I wouldn't mix "systemd" stuff under a sysV rule, but under a separate systemd rule
> then If you only need to enable the target that would pull the 2 or 3 services,
> so this is basicaly enough:
>
> override_dh_installinit:
> dh_installinit -pisc-dhcp-server --error-handler=true
>
> override_dh_systemd_enable:
> dh_systemd_enable -pisc-dhcp-server isc-dhcp-server.target
You're right of course, sorry. Idiot me.
> Well, are you even using "dh --with systemd" ?
Yes ;-)
I have changed my debian/rules to saying:
(…)
%:
dh $@ --parallel --with autoreconf,systemd
override_dh_auto_configure:
override_dh_auto_build:
# ldap-enabled build
test -f Makefile && $(MAKE) distclean || true
./configure --with-ldap --with-ldapcrypto $(CONFFLAGS)
$(MAKE) $(CROSS)
mv server/dhcpd dhcpd
# ldap-disabled build
test -f Makefile && $(MAKE) distclean || true
./configure $(CONFFLAGS)
$(MAKE) $(CROSS)
override_dh_install:
dh_install
cp debian/dhclient-script.$(DEB_HOST_ARCH_OS) \
debian/isc-dhcp-client$(DHCLIENT_SCRIPT)
cp debian/dhclient-script.$(DEB_HOST_ARCH_OS).udeb \
debian/isc-dhcp-client-udeb$(DHCLIENT_SCRIPT)
cp debian/rfc3442-classless-routes.$(DEB_HOST_ARCH_OS) \
debian/isc-dhcp-client/etc/dhcp/dhclient-exit-hooks.d/rfc3442-classless-routes
cp contrib/dhcp-lease-list.pl \
debian/isc-dhcp-server/usr/sbin/dhcp-lease-list
override_dh_systemd_enable:
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
install -p -m644 debian/isc-dhcp-server.isc-dhcp-server.target debian/isc-dhcp-server/lib/systemd/system/isc-dhcp-server.target
dh_systemd_enable -pisc-dhcp-server --name=isc-dhcp-server.target
override_dh_installinit:
dh_installinit -Nisc-dhcp-server
dh_installinit -pisc-dhcp-server --error-handler=true
override_dh_systemd_start:
#dh_systemd_start isc-dhcp-server.target
override_dh_strip:
dh_strip --dbg-package=isc-dhcp-dbg
Please note that the manual install of
isc-dhcp-server.isc-dhcp-server.target is actually needed,
dh_systemd_enable will install service units automatically, but not
targets.
I am wondering whether to actually drop the target in favor of an ugly
ExecStart=/bin/true service unit, since that's the way other packages
(such as postgresql and openvpn) do it.
I have filed #793153 to have this clarified in dh-systemd.
> In theory, it's possible to use dh_systemd_* directly, but that's
> mostly useless pain.
Can I use it more directly than the way I'm already doing it?
Now, I need to get over the incredible frustration that one cannot
test systemd units in a simple chroot as it was possible with init
scripts. Easier, yeah, right.
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 Pkg-systemd-maintainers
mailing list