| garciadeblas | 93c6131 | 2016-09-28 15:12:48 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 2 | REPOSITORY_BASE=https://osm-download.etsi.org/repository/osm/debian |
| garciadeblas | a5e6607 | 2019-05-29 12:23:22 +0200 | [diff] [blame] | 3 | RELEASE=ReleaseSIX |
| garciadeblas | 1878746 | 2018-12-03 17:54:31 +0100 | [diff] [blame] | 4 | REPOSITORY=stable |
| garciadeblas | a5e6607 | 2019-05-29 12:23:22 +0200 | [diff] [blame] | 5 | DOCKER_TAG=6 |
| garciadeblas | 93c6131 | 2016-09-28 15:12:48 +0200 | [diff] [blame] | 6 | |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 7 | add_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 |
| garciadeblas | bd925e4 | 2018-06-14 14:32:12 +0200 | [diff] [blame] | 12 | 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 Marchetti | 3412418 | 2018-10-16 08:22:30 -0400 | [diff] [blame] | 17 | || ! echo "failed to run apt-get update" \ |
| garciadeblas | bd925e4 | 2018-06-14 14:32:12 +0200 | [diff] [blame] | 18 | || 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 Marchetti | 3412418 | 2018-10-16 08:22:30 -0400 | [diff] [blame] | 22 | || ! echo "failed to install $need_packages_lw" \ |
| garciadeblas | bd925e4 | 2018-06-14 14:32:12 +0200 | [diff] [blame] | 23 | || exit 1 |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 24 | 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 |
| garciadeblas | 429b9f8 | 2018-03-20 02:09:44 +0100 | [diff] [blame] | 26 | return 0 |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 27 | fi |
| 28 | |
| 29 | return 1 |
| garciadeblas | 55490d4 | 2016-10-29 14:22:03 +0200 | [diff] [blame] | 30 | } |
| 31 | |
| garciadeblas | d8bc5c3 | 2018-05-09 17:37:56 +0200 | [diff] [blame] | 32 | add_repo "deb [arch=amd64] $REPOSITORY_BASE/$RELEASE $REPOSITORY devops" |
| garciadeblas | 35f96ae | 2018-05-23 12:33:36 +0200 | [diff] [blame] | 33 | sudo DEBIAN_FRONTEND=noninteractive apt-get -q update |
| 34 | sudo DEBIAN_FRONTEND=noninteractive apt-get install osm-devops |
| garciadeblas | a5e6607 | 2019-05-29 12:23:22 +0200 | [diff] [blame] | 35 | /usr/share/osm-devops/installers/full_install_osm.sh -R $RELEASE -r $REPOSITORY -u $REPOSITORY_BASE -D /usr/share/osm-devops -t $DOCKER_TAG "$@" |