#!/rchusr/bin/env bash
if [[ -f /etc/init.d/resolvconf ]]; then
	/etc/init.d/resolvconf stop;
fi
\
apt install -y --reinstall resolvconf

mkdir -p /etc/resolvconf/resolv.conf.d/

# head:
bash -c 'echo "# Managed by resolvconf" > /etc/resolvconf/resolv.conf.d/head'
bash -c 'echo "search lan" >> /etc/resolvconf/resolv.conf.d/head'

# base: options
bash -c 'echo "options rotate attempts:2 timeout:1" > /etc/resolvconf/resolv.conf.d/base'

# Original:
cat > /etc/resolvconf/resolv.conf.d/original <<EOF
nameserver 208.67.222.222
nameserver 94.247.43.254
nameserver 212.159.6.10
nameserver 69.164.196.21
nameserver 84.200.79.111
nameserver 192.168.1.1
EOF

# tail: options lines and can be a symlink to originl
bash -c "ln -sf /etc/resolvconf/resolv.conf.d/original /etc/resolvconf/resolv.conf.d/tail"

#/etc/init.d/resolvconf reload
/etc/init.d/resolvconf start
