]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Don't error if no interfaces or the state dir does not exist.
authorRoy Marples <roy@marples.name>
Thu, 14 Aug 2008 12:37:44 +0000 (12:37 +0000)
committerRoy Marples <roy@marples.name>
Thu, 14 Aug 2008 12:37:44 +0000 (12:37 +0000)
dhcpcd-hooks/20-resolv.conf

index b94f2f10735d1d8bc26a63fa1fb5e7da5cca863c..2c68f7f914b48b5403cacd35c868320bc46dbd68 100644 (file)
@@ -17,21 +17,26 @@ build_resolv_conf()
 
        # Build a list of interfaces
        for x in "${resolvconf_dir}"/*; do
+               [ -e "${x}" ] || continue
                [ -n "${interfaces}" ] && header="${header}, "
                header="${header}${x##*/}"
                interfaces="${interfaces}${interfaces:+ }${x##*/}"
        done
 
-       # Build a search list
-       search=$(cd "${resolvconf_dir}"; sed -n 's/^search //p' ${interfaces})
-       [ -n "${search}" ] && search="search $(uniqify ${search})\n"
+       if [ -n "${interfaces}" ]; then
+               # Build a search list
+               search=$(cd "${resolvconf_dir}";
+                       sed -n 's/^search //p' ${interfaces})
+               [ -n "${search}" ] && search="search $(uniqify ${search})\n"
 
-       # Build a nameserver list
-       srvs=$(cd "${resolvconf_dir}"; sed -n 's/^nameserver //p' ${interfaces})
-       if [ -n "${srvs}" ]; then
-               for x in $(uniqify ${srvs}); do
-                       servers="${servers}nameserver ${x}\n"
-               done
+               # Build a nameserver list
+               srvs=$(cd "${resolvconf_dir}";
+                       sed -n 's/^nameserver //p' ${interfaces})
+               if [ -n "${srvs}" ]; then
+                       for x in $(uniqify ${srvs}); do
+                               servers="${servers}nameserver ${x}\n"
+                       done
+               fi
        fi
 
        # Build our final resolv.conf