blob: 5a9199cbce787101d2bca3dddae68268d8e162fd [file] [log] [blame]
garciadeblas93c61312016-09-28 15:12:48 +02001#!/bin/bash
garciadeblasd8bc5c32018-05-09 17:37:56 +02002REPOSITORY_BASE=https://osm-download.etsi.org/repository/osm/debian
garciadeblasa5e66072019-05-29 12:23:22 +02003RELEASE=ReleaseSIX
garciadeblas18787462018-12-03 17:54:31 +01004REPOSITORY=stable
garciadeblasa5e66072019-05-29 12:23:22 +02005DOCKER_TAG=6
garciadeblas93c61312016-09-28 15:12:48 +02006
garciadeblasd8bc5c32018-05-09 17:37:56 +02007add_repo() {
8 REPO_CHECK="^$1"
9 grep "${REPO_CHECK/\[arch=amd64\]/\\[arch=amd64\\]}" /etc/apt/sources.list > /dev/null 2>&1
10 if [ $? -ne 0 ]
11 then
garciadeblasbd925e42018-06-14 14:32:12 +020012 need_packages_lw="software-properties-common apt-transport-https"
13 echo -e "Checking required packages: $need_packages_lw"
14 dpkg -l $need_packages_lw &>/dev/null \
15 || ! echo -e "One or several required packages are not installed. Updating apt cache requires root privileges." \
16 || sudo apt-get -q update \
Mike Marchetti34124182018-10-16 08:22:30 -040017 || ! echo "failed to run apt-get update" \
garciadeblasbd925e42018-06-14 14:32:12 +020018 || exit 1
19 dpkg -l $need_packages_lw &>/dev/null \
20 || ! echo -e "Installing $need_packages_lw requires root privileges." \
21 || sudo apt-get install -y $need_packages_lw \
Mike Marchetti34124182018-10-16 08:22:30 -040022 || ! echo "failed to install $need_packages_lw" \
garciadeblasbd925e42018-06-14 14:32:12 +020023 || exit 1
garciadeblasd8bc5c32018-05-09 17:37:56 +020024 wget -qO - $REPOSITORY_BASE/$RELEASE/OSM%20ETSI%20Release%20Key.gpg | sudo apt-key add -
25 sudo DEBIAN_FRONTEND=noninteractive add-apt-repository -y "$1" && sudo DEBIAN_FRONTEND=noninteractive apt-get update
garciadeblas429b9f82018-03-20 02:09:44 +010026 return 0
garciadeblasd8bc5c32018-05-09 17:37:56 +020027 fi
28
29 return 1
garciadeblas55490d42016-10-29 14:22:03 +020030}
31
garciadeblasd8bc5c32018-05-09 17:37:56 +020032add_repo "deb [arch=amd64] $REPOSITORY_BASE/$RELEASE $REPOSITORY devops"
garciadeblas35f96ae2018-05-23 12:33:36 +020033sudo DEBIAN_FRONTEND=noninteractive apt-get -q update
34sudo DEBIAN_FRONTEND=noninteractive apt-get install osm-devops
garciadeblasa5e66072019-05-29 12:23:22 +020035/usr/share/osm-devops/installers/full_install_osm.sh -R $RELEASE -r $REPOSITORY -u $REPOSITORY_BASE -D /usr/share/osm-devops -t $DOCKER_TAG "$@"