106.10. openresolv-3.17.4
resolvconf: one writer of /etc/resolv.conf for NetworkManager, dhcpcd and wg-quick
3.17.4-1 · BSD-2-Clause · 0.1 SBU · 86.0 KiB, 13 files · 41_system, 649 of 1047 · ports/core/network/openresolv
Homepage: https://roy.marples.name/projects/openresolv/
Why it is in KDOS. The comment above it in script/phases/41_system/packages.d/network.txt:
resolvconf, which wg-quick runs for a config's DNS= line and NetworkManager writes /etc/resolv.conf through.
openresolv’s resolvconf is the one writer of /etc/resolv.conf. NetworkManager, the fallback dhcpcd and wg-quick each hand it the servers of a link, and it merges them into the file and into the configuration of the subscribers named in SUBSCRIBERS: the C library’s resolver (libc), dnsmasq, named, pdnsd, pdns_recursor and unbound. libc always runs; the others act only when their key is set in /etc/resolvconf.conf. Each restarts its service after a change when that service is running, so it reads the new servers: libc’s is nscd.
Depends on: bash.
Required by (2): networkmanager, wireguard-tools.
Sources: openresolv-3.17.4.tar.xz (25.1 KiB). Every step kpkg takes applies to this port.
Install: script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install openresolv'
build.sh:
subs="libc dnsmasq named pdnsd pdns_recursor unbound"
restart='"/usr/sbin/service status \\$$1 >/dev/null 2>\&1 \&\& /usr/sbin/service restart \\$$1"'
./configure --prefix=/usr --sysconfdir=/etc --sbindir=/usr/sbin \
--libexecdir=/usr/lib/resolvconf --rundir=/run --mandir=/usr/share/man
make SUBSCRIBERS="$subs" RESTARTCMD="$restart"
make SUBSCRIBERS="$subs" RESTARTCMD="$restart" DESTDIR=$PKG install
RESTARTCMD— on bothmakelines: the command a subscriber runs to restart its service, with the service’s name in$1. Unset,resolvconfprobes the running system for an init system it knows and finds/sbin/service, which it calls as Red Hat’s,service <name>and thenservice <name> restart;ksvctakes the command first,service status <name>, and answers the other order with its usage, so no subscriber would ever be restarted. The value restarts a service only whenservice statusreports it running, as the probed commands do.
Programs: resolvconf.
Directories: /usr/lib/resolvconf, /usr/share/licenses/openresolv.
RESTARTCMD is passed to make rather than to configure --restartcmd. configure writes the value into config.mk with echo, and whether echo turns \\ into \ depends on which shell /bin/sh is, so the same flag would give a different resolvconf under dash and bash. On the make line the value passes through two layers, the same under any shell:
- make expands
$$1to$1. - The Makefile substitutes the value into
resolvconf.inwithsed 's:@RESTARTCMD@:…:g', so the value holds no:,\&stands for&and\\for\.
The result in /usr/sbin/resolvconf is RESTARTCMD="/usr/sbin/service status \$1 >/dev/null 2>&1 && /usr/sbin/service restart \$1". That line is an unquoted shell assignment in resolvconf.in, so the value carries its own double quotes, and \$1 keeps the name from being expanded until each subscriber evals the command. resolvconf -R prints the command as the subscribers run it.