fix issue with artifacts version in vFW
[demo.git] / vnfs / vFW / scripts / v_sink_install.sh
1 #!/bin/bash
2
3 REPO_URL_BLOB=$(cat /opt/config/repo_url_blob.txt)
4 INSTALL_SCRIPT_VERSION=$(cat /opt/config/install_script_version.txt)
5 CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
6
7 # OpenStack network configuration
8 if [[ $CLOUD_ENV == "openstack" ]]
9 then
10         echo 127.0.0.1 $(hostname) >> /etc/hosts
11
12         VSN_PRIVATE_IP_O=$(cat /opt/config/vsn_private_ip_0.txt)
13         echo "auto eth1" >> /etc/network/interfaces
14         echo "iface eth1 inet static" >> /etc/network/interfaces
15         echo "    address $VSN_PRIVATE_IP_O" >> /etc/network/interfaces
16         echo "    netmask 255.255.255.0" >> /etc/network/interfaces
17
18         ifup eth1
19 fi
20
21 # Download required dependencies
22 add-apt-repository -y ppa:openjdk-r/ppa
23 apt-get update
24 apt-get install -y make wget openjdk-8-jdk apt-transport-https ca-certificates darkstat
25
26 # Configure and run Darkstat
27 sed -i "s/START_DARKSTAT=.*/START_DARKSTAT=yes/g" /etc/darkstat/init.cfg
28 sed -i "s/INTERFACE=.*/INTERFACE=\"-i eth1\"/g" /etc/darkstat/init.cfg
29 /etc/init.d/darkstat start
30
31 # Download scripts for virtual sink
32 cd /opt
33 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vfw/$INSTALL_SCRIPT_VERSION/v_sink_init.sh
34 wget $REPO_URL_BLOB/org.openecomp.demo/vnfs/vfw/$INSTALL_SCRIPT_VERSION/vsink.sh
35 chmod +x v_sink_init.sh
36 chmod +x vsink.sh
37
38 # Run instantiation script
39 mv vsink.sh /etc/init.d
40 update-rc.d vsink.sh defaults
41 ./v_sink_init.sh