-if [ -n "$SHOWOPTS" ]; then
- echo "DEVELOP=$DEVELOP"
- echo "INSTALL_FROM_SOURCE=$INSTALL_FROM_SOURCE"
- echo "UNINSTALL=$UNINSTALL"
- echo "NAT=$NAT"
- echo "UPDATE=$UPDATE"
- echo "RECONFIGURE=$RECONFIGURE"
- echo "TEST_INSTALLER=$TEST_INSTALLER"
- echo "LXD=$LXD"
- echo "SHOWOPTS=$SHOWOPTS"
- echo "Install from specific refspec (-b): $COMMIT_ID"
- exit 0
-fi
-
-# if develop, we force master
-[ -z "$COMMIT_ID" ] && [ -n "$DEVELOP" ] && COMMIT_ID="master"
-
-# forcing source from master removed. Now only install from source when explicit
-# [ -n "$COMMIT_ID" ] && [ "$COMMIT_ID" == "master" ] && INSTALL_FROM_SOURCE="y"
-
-if [ -n "$TEST_INSTALLER" ]; then
- echo -e "\nUsing local devops repo for OSM installation"
- TEMPDIR="$(dirname $(realpath $(dirname $0)))"
-else
- echo -e "\nCreating temporary dir for OSM installation"
- TEMPDIR="$(mktemp -d -q --tmpdir "installosm.XXXXXX")"
- trap 'rm -rf "$TEMPDIR"' EXIT
-fi
-
-echo -e "Checking required packages: git"
-dpkg -l git &>/dev/null || ! echo -e " git not installed.\nInstalling git requires root privileges" || sudo apt-get install -y git
-if [ -z "$TEST_INSTALLER" ]; then
- echo -e "\nCloning devops repo temporarily"
- git clone https://osm.etsi.org/gerrit/osm/devops.git $TEMPDIR
- RC_CLONE=$?
-fi
-
-echo -e "\nGuessing the current stable release"
-LATEST_STABLE_DEVOPS=`git -C $TEMPDIR tag -l v[0-9].* | tail -n1`
-[ -z "$COMMIT_ID" ] && [ -z "$LATEST_STABLE_DEVOPS" ] && echo "Could not find the current latest stable release" && exit 0
-echo "Latest tag in devops repo: $LATEST_STABLE_DEVOPS"
-[ -z "$COMMIT_ID" ] && [ -n "$LATEST_STABLE_DEVOPS" ] && COMMIT_ID="tags/$LATEST_STABLE_DEVOPS"
-[ -z "$TEST_INSTALLER" ] && git -C $TEMPDIR checkout tags/$LATEST_STABLE_DEVOPS
-
-OSM_DEVOPS=$TEMPDIR
-OSM_JENKINS="$TEMPDIR/jenkins"
-. $OSM_JENKINS/common/all_funcs
-
-[ -n "$UNINSTALL" ] && uninstall && echo -e "\nDONE" && exit 0
-[ -n "$NAT" ] && nat && echo -e "\nDONE" && exit 0
-[ -n "$UPDATE" ] && update && echo -e "\nDONE" && exit 0
-[ -n "$RECONFIGURE" ] && configure && echo -e "\nDONE" && exit 0
-
-#Installation starts here
-echo -e "\nInstalling OSM from refspec: $COMMIT_ID"
-if [ -n "$INSTALL_FROM_SOURCE" ] && [ -z "$ASSUME_YES" ]; then
- ! ask_user "The installation will take about 75-90 minutes. Continue (Y/n)? " y && echo "Cancelled!" && exit 1
-fi
-
-echo -e "\nChecking required packages: wget, curl, tar"
-dpkg -l wget curl tar &>/dev/null || ! echo -e " One or several packages are not installed.\nInstalling required packages\n Root privileges are required" || sudo apt-get install -y wget curl tar
-
-echo -e "Checking required packages: lxd"
-lxd --version &>/dev/null || FATAL "lxd not present, exiting."
-[ -n "$LXD" ] && echo -e "\nConfiguring lxd" && install_lxd
-
-wget -q -O- https://osm-download.etsi.org/ftp/osm-2.0-two/README.txt &> /dev/null
-
-# use local devops for containers
-export OSM_USE_LOCAL_DEVOPS=true
-if [ -z "$INSTALL_FROM_SOURCE" ]; then
- echo -e "\nCreating the containers and installing from binaries ..."
- $OSM_DEVOPS/jenkins/host/install RO $REPOSITORY $RELEASE $REPOSITORY_KEY $REPOSITORY_BASE || FATAL "RO install failed"
- $OSM_DEVOPS/jenkins/host/start_build VCA || FATAL "VCA install failed"
- $OSM_DEVOPS/jenkins/host/install SO $REPOSITORY $RELEASE $REPOSITORY_KEY $REPOSITORY_BASE || FATAL "SO install failed"
- $OSM_DEVOPS/jenkins/host/install UI $REPOSITORY $RELEASE $REPOSITORY_KEY $REPOSITORY_BASE || FATAL "UI install failed"
-else #install from source
- echo -e "\nCreating the containers and building from source ..."
- $OSM_DEVOPS/jenkins/host/start_build RO --notest checkout $COMMIT_ID || FATAL "RO container build failed (refspec: '$COMMIT_ID')"
- $OSM_DEVOPS/jenkins/host/start_build VCA || FATAL "VCA container build failed"
- $OSM_DEVOPS/jenkins/host/start_build SO checkout $COMMIT_ID || FATAL "SO container build failed (refspec: '$COMMIT_ID')"
- $OSM_DEVOPS/jenkins/host/start_build UI checkout $COMMIT_ID || FATAL "UI container build failed (refspec: '$COMMIT_ID')"
-fi
-
-#Install iptables-persistent and configure NAT rules
-nat
-
-#Configure components
-configure
-
-wget -q -O- https://osm-download.etsi.org/ftp/osm-2.0-two/README2.txt &> /dev/null
-echo -e "\nDONE"