# EDON Argos: the appliance's name servers follow its DNS settings, whatever the lease names
# (app/lib/resolv.ts). Sourced by dhcpcd-run-hooks, after 20-resolv.conf.
argos_resolv_conf=/etc/resolv.conf
argos_resolv_lines=/var/lib/argos/resolv.argos
if [ -s "$argos_resolv_lines" ] && [ -f "$argos_resolv_conf" ] && [ ! -L "$argos_resolv_conf" ]; then
	argos_resolv_tmp="$argos_resolv_conf.argos-$$"
	if { grep -v -e '^[ 	]*nameserver[ 	]' -e '^# argos:' "$argos_resolv_conf"; cat "$argos_resolv_lines"; } >"$argos_resolv_tmp" &&
		! cmp -s "$argos_resolv_tmp" "$argos_resolv_conf"; then
		chmod 644 "$argos_resolv_tmp" && mv -f "$argos_resolv_tmp" "$argos_resolv_conf"
	fi
	rm -f "$argos_resolv_tmp"
fi
unset argos_resolv_conf argos_resolv_lines argos_resolv_tmp
