Browse Source

Add parameters to setup network

Change-Id: I3a5f52f9df396e70456e511509dfdd27e25a8bc7
Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>
Guo Ruijing 2 years ago
parent
commit
a8359af0ca
2 changed files with 33 additions and 7 deletions
  1. 32
    6
      demo/01_setup_network.sh
  2. 1
    1
      demo/README.md

+ 32
- 6
demo/01_setup_network.sh View File

@@ -1,8 +1,34 @@
1 1
 #!/bin/sh
2
-HTTP_PROXY=http://10.19.8.225:911
3
-DNS_SERVER=10.248.2.1
4
-SOCK5_IP=10.7.211.16
5
-SOCK5_PORT=1080
2
+
3
+HTTP_PROXY=${HTTP_PROXY:-http://10.19.8.225:911}
4
+DNS_SERVER=${DNS_SERVER:-10.248.2.1}
5
+SOCKS5_IP=${SOCKS5_IP:-10.7.211.16}
6
+SOCKS5_PORT=${SOCKS5:-1080}
7
+
8
+for i in "$@"
9
+do
10
+case $i in
11
+    -h=*|--http=*)
12
+    HTTP_PROXY="${i#*=}"
13
+    shift
14
+    ;;
15
+    -d=*|--dns=*)
16
+    DNS_SERVER="${i#*=}"
17
+    shift
18
+    ;;
19
+    -s=*|--socks5-ip=*)
20
+    SOCKS5_IP="${i#*=}"
21
+    shift
22
+    ;;
23
+    -p=*|--socks5-port=*)
24
+    SOCKS5_PORT="${i#*=}"
25
+    shift
26
+    ;;
27
+    *)
28
+    # unknown option
29
+    ;;
30
+esac
31
+done
6 32
 
7 33
 cat <<EOF | sudo tee /etc/apt/apt.conf
8 34
 Acquire::http::Proxy "$HTTP_PROXY";
@@ -23,8 +49,8 @@ base {
23 49
 redsocks {
24 50
  local_ip = 0.0.0.0;
25 51
  local_port = 6666;
26
- ip = $SOCK5_IP;
27
- port = $SOCK5_PORT;
52
+ ip = $SOCKS5_IP;
53
+ port = $SOCKS5_PORT;
28 54
  type = socks5;
29 55
 }
30 56
 

+ 1
- 1
demo/README.md View File

@@ -31,7 +31,7 @@ d. SOCK5_PORT: socks5 proxy for fuel VM
31 31
 
32 32
 In fresh installation, 01_setup_network.sh can be run by:
33 33
 
34
-curl --socks5 <socks5 proxy> https://raw.githubusercontent.com/openstack/fuel-plugin-ovs/master/demo/01_setup_network.sh | bash
34
+curl --socks5 <socks5-proxy> https://raw.githubusercontent.com/openstack/fuel-plugin-ovs/master/demo/01_setup_network.sh | bash -s -- -h=<http-proxy>-d=<dns-server> -s=<socks5-ip> -p=<socks5-port>
35 35
 
36 36
 2. 02_install_packages.sh
37 37
 

Loading…
Cancel
Save