opendns/dnscrypt-proxy — pull request #37 by marguerite (2012-10-23 17:38:39+00:00)
Title: fix a hang-on-boot bug in systemd service, update opensuse license

Hi, jedisct1,

Actually I made my last commit to upstream systemd service (dnscrypt.service) instead of opensuse packages...

systemd is a new Linux init system that have been absorbed to be default init system by many Linux distributions (openSUSE, Fedora, ArchLinux, Gentoo).

Without a systemd service file, dnscrypt-proxy in those systems can't autostart on boot. for a network service, you know, it means a lot of trouble and boring repeated work to do.

So I suppose you can make that file upstream, use a few code in configure.ac to detect systemd:

* you can detect /bin/systemd directly or
* use --with-systemd and /usr/share/pkgconfig/systemd.pc to make it an option

if there is, then install that file into /lib/systemd/system ($systemdsystemunitdir). (sorry I'm not familiar with autotools...I can just handle cmake...so I'm not able to provide such a patch)

this will make Linux users very happy. because they can just install dnscrypt-proxy and use:

sudo systemctl enable dnscrypt.service
sudo systemctl start dnscrypt.service

then forget it forever. everytime you boot, you're already protected by openDNS!

just like the /etc/resolv.conf nameserver 127.0.0.1 thing, you just need to do it once instead everytime.

leave that file to distribution will make dnscrypt-proxy give different user experiences between package installers and self-compilers. I think that not what you want.

PS:

And to backport those Linux/solaris without systemd, you may need a sysvinit shell script to do the same thing I talked above.

there's a skeleton file in /etc/init.d/skeleton (at least in openSUSE, but openSUSE embraces systemd so I can write that file but I has no testing environment, you can try it in Ubuntu/Debian) which you can just copy and modify a few lines. then install it in /usr/sbin and link it to /etc/init.d.

users then can use "/etc/init.d/dnscryptd start" to achieve the same effects as systemd does.

* on a Linux box with systemd, those files can be installed together.
* on a sysvinit only Linux box, you can't install systemd services, because it'll cause an effect "config dir polution" which means you create a directory /lib/systemd/system which has no meaning and shouldn't exist at all (but /etc/init.d always exists)

Greetings,

Marguerite