[systemd-devel] [ PATCH-v2 ] dnsmasq ebuild and unit files for dnsmasq

Michał Górny mgorny at gentoo.org
Sun May 22 10:55:09 PDT 2011


On Sun, 22 May 2011 17:22:30 +0200
Henry Gebhardt <hsggebhardt at googlemail.com> wrote:

> On Sun, May 22, 2011 at 02:50:00PM +0800, microcai wrote:
> > Heya,
> > 
> > Here is the 2nd version.
> > 
> > Split the DHCP and TFTP socket and use Servie=dnsmasq.servie to
> > point to dnsmasq.
> > 
> > Add einfo to the user tell then how to do with the socket unit
> > files.
> > 
> > both DNS and tftp have been test. I haven't test DHCP activation,
> > But I think it will works.
> > 
> > CC systemd for other people to review the socket unit files.
> 
> CC'ing Michal, I hope you don't mind. But one question: Should
> services/sockets be enabled by default (e.g. using your
> systemd_enable_services() function)?

I think not. Unless I misunderstand the concept of sockets in systemd,
enabling them by default would mean reserving the particular port
for service. If a user installs dnsmasq and another DNS server
at the same time, having both of them enabled by default would result
in a conflict.

> > 	if use systemd ; then
> > 		doservices "${FILESDIR}/dnsmasq.service"
> > 		doservices "${FILESDIR}/dnsmasq.socket"
> > 		doservices "${FILESDIR}/dnsmasq-dhcp.socket"
> > 		doservices "${FILESDIR}/dnsmasq-tftp.socket"
> > 	fi
> 
> Always install the unit files, and use systemd_dounit() from the
> systemd eclass.

Well, that's not entirely guaranteed here. The point is to use
systemd_dounit() and similar functions because they can decide whether
to install the service files or not.

> > pkg_postinst(){
> > 	if use systemd ; then
> > 		einfo "You have enabled systemd use flag, enable
> > dnsmasq with " einfo "systemctl enable dnsmasq.socket"
> > 		einfo "If you want to enable dhcp and ftp support
> > in ${PN}, don't forget to run " einfo "systemctl enable
> > dnsmasq-dhcp.socket " einfo "and"
> > 		einfo "systemctl enable dnsmasq-tftp.socket"
> > 		einfo "When you enable it in the configure file"
> > 	fi
> > }
> 
> If we get rid of the systemd use-flag, you could either always print
> this message, or use systemd_enable_service() in src_install() to
> enable them by default.

These seem pretty pointless to me. We don't print 'remember to call
rc-update' either. I might consider adding a postinst helper function
to list installed unit names in weirder cases though.

-- 
Best regards,
Michał Górny
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 316 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20110522/e78929cd/attachment.pgp>


More information about the systemd-devel mailing list