summaryrefslogtreecommitdiffstats
path: root/prebuilt/common
diff options
context:
space:
mode:
authorTakuo Kitame <kitame@gmail.com>2010-07-02 02:01:15 +0900
committerctso <ctsoyars@gmail.com>2010-07-02 17:32:07 +0000
commit2f8fef39200fe07da66dd4c9cac3e9d9eab2ac3d (patch)
tree79480c10e1f903403bdacde83d0c4b664627ec4c /prebuilt/common
parent084c8771973fdf01d3b793a59a63a9b584125a28 (diff)
downloadvendor_replicant-2f8fef39200fe07da66dd4c9cac3e9d9eab2ac3d.zip
vendor_replicant-2f8fef39200fe07da66dd4c9cac3e9d9eab2ac3d.tar.gz
vendor_replicant-2f8fef39200fe07da66dd4c9cac3e9d9eab2ac3d.tar.bz2
Added prebuilt/common/xbin/openvpn-up.sh from CM5
Diffstat (limited to 'prebuilt/common')
-rw-r--r--prebuilt/common/xbin/openvpn-up.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/prebuilt/common/xbin/openvpn-up.sh b/prebuilt/common/xbin/openvpn-up.sh
new file mode 100644
index 0000000..98bb439
--- /dev/null
+++ b/prebuilt/common/xbin/openvpn-up.sh
@@ -0,0 +1,44 @@
+#!/system/xbin/bash
+#
+# /system/xbin/openvpn-up.sh v0.2
+#
+# Philip Freeman <philip.freeman@gmail.com>
+#
+# TODO: add support for grabbing search domains ?
+#
+# Changes:
+#-- v0.2
+# - Added system logging
+# - Fixed fome path issues
+#
+
+LOG="/system/bin/log -t openvpn-up"
+SETPROP=/system/bin/setprop
+EXPR=/system/xbin/expr
+stop=0
+dns_num=1
+i=0
+
+${LOG} "Starting..."
+
+eval opt=\$foreign_option_$i
+
+while [ ${stop} -eq 0 ]; do
+ if [ "`${EXPR} substr "$opt" 1 11`" = "dhcp-option" ]; then
+ if [ "`${EXPR} substr "$opt" 13 3`" = "DNS" ]; then
+ DNS="`${EXPR} substr "$opt" 17 1024`"
+ ${LOG} "Got DNS${dns_num}: ${DNS}"
+ if [ ${dns_num} -le 2 ]; then
+ #Set it
+ ${LOG} ${SETPROP} vpn.dns${dns_num} ${DNS}
+ ${SETPROP} vpn.dns${dns_num} ${DNS}
+ fi
+ dns_num=$(( ${dns_num}+1 ))
+ fi
+ fi
+ i=$(( $i+1 ))
+ eval opt=\$foreign_option_$i
+ if [ "$opt" = "" ]; then
+ stop=1
+ fi
+done