Don't update the helpers if the resolv.conf added matches what we already have for...
authorRoy Marples <roy@marples.name>
Fri, 22 Aug 2008 09:58:55 +0000 (09:58 +0000)
committerRoy Marples <roy@marples.name>
Fri, 22 Aug 2008 09:58:55 +0000 (09:58 +0000)
resolvconf.8.in
resolvconf.in

index 9e601ab5b9c3265b52c573be9f334c3725916591..687626fec041ba466ff3f9064d1d686aa4695642 100644 (file)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd Mar 07, 2008
+.Dd August 22, 2008
 .Dt RESOLVCONF 8 SMM
 .Sh NAME
 .Nm resolvconf
@@ -127,6 +127,9 @@ is specified then we list the files for the interfaces that match it.
 Force
 .Nm
 to update all it's helpers.
+.Nm
+does not update the helpers when adding a reslov.conf that matches
+what it already has for that interface.
 .El
 .Pp
 .Nm
index e975ad4b88676d7b4f3fac180cdffe296324444a..1dc88b0a30037fb04be3a5fe796914e704c2dfd7 100755 (executable)
@@ -310,7 +310,7 @@ if [ ! -d "${IFACEDIR}" ]; then
                error_exit "Failed to create needed directory ${IFACEDIR}"
 else
        # Delete any existing information about the interface
-       if [ "${CMD}" = "a" -o "${CMD}" = "d" ]; then
+       if [ "${CMD}" = "d" ]; then
                cd "${IFACEDIR}"
                for ARG in ${ARGS}; do
                        if [ "${CMD}" = "d" -a ! -e "${ARG}" ]; then
@@ -323,8 +323,17 @@ else
 fi
 
 if [ "${CMD}" = "a" ]; then
-       # Create our resolv.conf file
-       cat >"${IFACEDIR}"/"${IFACE}" || exit $?
+       # Read resolv.conf from stdin
+       RESOLV="$(cat)"
+       # If what we are given matches what we have, then do nothing
+       if [ -e "${IFACEDIR}/${IFACE}" ]; then
+               if [ "$(printf "${RESOLV}")" = "$(cat "${IFACEDIR}/${IFACE}")" ]
+               then
+                       exit 0
+               fi
+               rm "${IFACEDIR}/${IFACE}"
+       fi
+       printf "${RESOLV}" >"${IFACEDIR}/${IFACE}" || exit $?
 fi
 
 RETVAL=0