| 1 | #!/bin/sh -e |
| 2 | |
| 3 | # exit if the resolvconf package is installed |
| 4 | [ -x /sbin/resolvconf ] && exit 0 |
| 5 | |
| 6 | # exit if systemd-resolved is running |
| 7 | [ -e /run/systemd/system ] && \ |
| 8 | systemctl is-active --quiet systemd-resolved.service && |
| 9 | exit 0 |
| 10 | |
| 11 | # follow any symlink to find the real file |
| 12 | if [ -e /etc/resolv.conf ]; then |
| 13 | REALRESOLVCONF=$(readlink --canonicalize /etc/resolv.conf) |
| 14 | else |
| 15 | REALRESOLVCONF=/etc/resolv.conf |
| 16 | fi |
| 17 | |
| 18 | # if an old resolv.conf file exists, restore it |
| 19 | if [ -e $REALRESOLVCONF.pppd-backup.$PPP_IFACE ]; then |
| 20 | mv -f $REALRESOLVCONF.pppd-backup.$PPP_IFACE $REALRESOLVCONF |
| 21 | |
| 22 | # restart nscd because resolv.conf has changed |
| 23 | if [ -e /var/run/nscd.pid ]; then |
| 24 | /etc/init.d/nscd restart || true |
| 25 | fi |
| 26 | fi |
| 27 | |
| 28 | exit 0 |