Browse code

Remove hardcoded path to resolvconf

Signed-off-by: Jesse Young <jesse.young@gmail.com>
Acked-by: David Sommerseth <dazo@users.sourceforge.net>
Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>

Jesse Young authored on 2010/11/02 01:33:26
Showing 2 changed files
... ...
@@ -34,9 +34,10 @@
34 34
 # A horrid work around, from a security perspective,
35 35
 # is to run OpenVPN as root. THIS IS NOT RECOMMENDED. You have
36 36
 # been WARNED.
37
+PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
37 38
 
38
-if [ -x /sbin/resolvconf ] ; then
39
-  /sbin/resolvconf -d "${1}"
39
+if type resolvconf >/dev/null 2>&1; then
40
+  resolvconf -d "${1}" -f
40 41
 elif [ -e /etc/resolv.conf.ovpnsave ] ; then
41 42
   # cp + rm rather than mv in case it's a symlink
42 43
   cp /etc/resolv.conf.ovpnsave /etc/resolv.conf
... ...
@@ -33,6 +33,7 @@
33 33
 # A horrid work around, from a security perspective,
34 34
 # is to run OpenVPN as root. THIS IS NOT RECOMMENDED. You have
35 35
 # been WARNED.
36
+PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
36 37
 
37 38
 # init variables
38 39
 
... ...
@@ -86,8 +87,8 @@ fi
86 86
 out="# resolv.conf autogenerated by ${0} (${1})${nl}${dns}${nl}${ds}${domains}"
87 87
 
88 88
 # use resolvconf if it's available
89
-if [ -x /sbin/resolvconf ] ; then
90
-  printf "%s\n" "${out}" | /sbin/resolvconf -a "${1}"
89
+if type resolvconf >/dev/null 2>&1; then
90
+  printf "%s\n" "${out}" | resolvconf -p -a "${1}"
91 91
 else
92 92
   # Preserve the existing resolv.conf
93 93
   if [ -e /etc/resolv.conf ] ; then