#!/bin/bash
-REPO_URL_BLOB=$(cat /opt/config/repo_url_blob.txt)
-REPO_URL_ARTIFACTS=$(cat /opt/config/repo_url_artifacts.txt)
+NEXUS_ARTIFACT_REPO=$(cat /opt/config/nexus_artifact_repo.txt)
DEMO_ARTIFACTS_VERSION=$(cat /opt/config/demo_artifacts_version.txt)
+if [[ "$DEMO_ARTIFACTS_VERSION" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi
INSTALL_SCRIPT_VERSION=$(cat /opt/config/install_script_version.txt)
CLOUD_ENV=$(cat /opt/config/cloud_env.txt)
echo "deb http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
echo "deb-src http://ppa.launchpad.net/openjdk-r/ppa/ubuntu $(lsb_release -c -s) main" >> /etc/apt/sources.list.d/java.list
apt-get update
-apt-get install --allow-unauthenticated -y wget openjdk-8-jdk apt-transport-https ca-certificates g++ libcurl4-gnutls-dev
+apt-get install --allow-unauthenticated -y wget openjdk-8-jdk apt-transport-https ca-certificates kea-dhcp4-server g++ libcurl4-gnutls-dev
sleep 1
-# Download DHCP config files
+# Download DHCP config and init files
cd /opt
-wget $REPO_URL_BLOB/org.onap.demo/vnfs/vcpe/$INSTALL_SCRIPT_VERSION/v_web_init.sh
-wget $REPO_URL_BLOB/org.onap.demo/vnfs/vcpe/$INSTALL_SCRIPT_VERSION/v_web.sh
+unzip -p -j /opt/vcpe-scripts-$INSTALL_SCRIPT_VERSION.zip kea-dhcp4-web.conf > /opt/kea-dhcp4-web.conf
+unzip -p -j /opt/vcpe-scripts-$INSTALL_SCRIPT_VERSION.zip v_web_init.sh > /opt/v_web_init.sh
+unzip -p -j /opt/vcpe-scripts-$INSTALL_SCRIPT_VERSION.zip v_web.sh > /opt/v_web.sh
+
+
+
+# Configure DHCP
+cp kea-dhcp4-web.conf /etc/kea-dhcp4-server.conf
+mv kea-dhcp4-web.conf /etc/kea/kea-dhcp4.conf
+
+
chmod +x v_web_init.sh
chmod +x v_web.sh
mv v_web.sh /etc/init.d
reboot
fi
-./v_web_init.sh
\ No newline at end of file
+./v_web_init.sh