Using openresolv with udhcpc?
Einar Jón
Mon Jul 08 12:32:14 2019
Hello
I just discovered openresolv, and I'm trying to get resolvconf to work
with udhcpc
Openresolv doesn't seem to like the format udhcpc uses:
$ cat /etc/resolv.conf
search xxxxxxxx.com # eth0
nameserver 192.168.2.xx # eth0
nameserver 62.140.1xx.xx # wwan0
nameserver 62.140.1xx.xx # wwan0
----
WIth this:comments at the end of a line become a "nameserver #" and
:"nameserver eth0":
This silly little script below seems to work, if I also add resolvconf
scripts to
/etc/network/if-up.d and /etc/network/if-down.d/
But I find it silly to write /etc/resolv.conf twice in a non-atomic
way. (first udhcpc and then resolvconf)
What is the recommended approach? I'd like to keep
/usr/share/udhcpc/default.script as is, if possible...
$ cat /usr/share/udhcpc/default.script.d/resolvconf
#!/bin/bash
# Make udhcpc changes to resolv.conf readable for resolvconf
[ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
RESOLV_DIR=/var/run/resolvconf/interfaces/
case "$1" in
renew|bound)
mkdir -p $RESOLV_DIR
grep $interface /etc/resolv.conf | sed -e "s/#.*//" >
$RESOLV_DIR/$interface.udhcpc
;;
esac
exit 0
--
Regards
Einar Jón
Archive administrator: postmaster@marples.name