From: Rachid Koucha <47061324+Rachid-Koucha@users.noreply.github.com> Date: Sun, 27 Jan 2019 12:46:48 +0000 (+0100) Subject: /etc/resolv.conf grows indefinitely X-Git-Tag: lxc-3.2.0~175^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=567f8915962316dfee3b040bad404da7cdcbbe38;p=thirdparty%2Flxc.git /etc/resolv.conf grows indefinitely This file grows indefinitely : upon each DHCP lease renew, the "nameserver ..dns..." line is added at the end of the file. Make a "grep" in the file to make sure that the same line does not already exist. Signed-off-by: Rachid Koucha --- diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in index 2171e2d59..3782687a5 100644 --- a/templates/lxc-busybox.in +++ b/templates/lxc-busybox.in @@ -164,7 +164,10 @@ case "\$1" in [ -n "\$domain" ] && echo search \$domain > /etc/resolv.conf for i in \$dns ; do - echo nameserver \$i >> /etc/resolv.conf + grep "nameserver \$i" /etc/resolv.conf > /dev/null 2>&1 + if [ \$? -ne 0 ]; then + echo nameserver \$i >> /etc/resolv.conf + fi done ;; esac