3 REPO_URL_ARTIFACTS=$(cat /opt/config/repo_url_artifacts.txt)
4 DEMO_ARTIFACTS_VERSION=$(cat /opt/config/demo_artifacts_version.txt)
5 INSTALL_SCRIPT_VERSION=$(cat /opt/config/install_script_version.txt)
6 CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
8 # Convert Network CIDR to Netmask
10 # Number of args to shift, 255..255, first non-255 byte, zeroes
11 set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
12 [ $1 -gt 1 ] && shift $1 || shift
13 echo ${1-0}.${2-0}.${3-0}.${4-0}
16 # OpenStack network configuration
17 if [[ $CLOUD_ENV == "openstack" ]]
19 echo 127.0.0.1 $(hostname) >> /etc/hosts
21 # Allow remote login as root
22 mv /root/.ssh/authorized_keys /root/.ssh/authorized_keys.bk
23 cp /home/ubuntu/.ssh/authorized_keys /root/.ssh
25 MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1)
27 IP=$(cat /opt/config/cpe_signal_net_ipaddr.txt)
28 BITS=$(cat /opt/config/cpe_signal_net_cidr.txt | cut -d"/" -f2)
29 NETMASK=$(cdr2mask $BITS)
30 echo "auto eth1" >> /etc/network/interfaces
31 echo "iface eth1 inet static" >> /etc/network/interfaces
32 echo " address $IP" >> /etc/network/interfaces
33 echo " netmask $NETMASK" >> /etc/network/interfaces
34 echo " mtu $MTU" >> /etc/network/interfaces
36 IP=$(cat /opt/config/oam_ipaddr.txt)
37 BITS=$(cat /opt/config/oam_cidr.txt | cut -d"/" -f2)
38 NETMASK=$(cdr2mask $BITS)
39 echo "auto eth2" >> /etc/network/interfaces
40 echo "iface eth2 inet static" >> /etc/network/interfaces
41 echo " address $IP" >> /etc/network/interfaces
42 echo " netmask $NETMASK" >> /etc/network/interfaces
43 echo " mtu $MTU" >> /etc/network/interfaces
49 # Download required dependencies
50 echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
51 echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
53 apt-get install --allow-unauthenticated -y wget openjdk-8-jdk apt-transport-https ca-certificates g++ libcurl4-gnutls-dev
56 # Download DHCP config files
58 unzip -p -j /opt/vcpe-scripts-$INSTALL_SCRIPT_VERSION.zip v_aaa_init.sh > /opt/v_aaa_init.sh
59 unzip -p -j /opt/vcpe-scripts-$INSTALL_SCRIPT_VERSION.zip v_aaa.sh > /opt/v_aaa.sh
60 chmod +x v_aaa_init.sh
62 mv v_aaa.sh /etc/init.d
63 update-rc.d v_aaa.sh defaults
65 # Download and install FreeRADIUS as AAA server
66 apt-get install -y freeradius
68 # Rename network interface in openstack Ubuntu 16.04 images. Then, reboot the VM to pick up changes
69 if [[ $CLOUD_ENV != "rackspace" ]]
71 sed -i "s/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0\"/g" /etc/default/grub
72 grub-mkconfig -o /boot/grub/grub.cfg
73 sed -i "s/ens[0-9]*/eth0/g" /etc/network/interfaces.d/*.cfg
74 sed -i "s/ens[0-9]*/eth0/g" /etc/udev/rules.d/70-persistent-net.rules
75 echo 'network: {config: disabled}' >> /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
76 echo "APT::Periodic::Unattended-Upgrade \"0\";" >> /etc/apt/apt.conf.d/10periodic