Lott, Christopher (cl778h) | 95cc089 | 2020-03-25 09:20:01 -0400 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # O-RAN-SC |
| 4 | # |
| 5 | # Copyright (C) 2020 AT&T Intellectual Property and Nokia |
| 6 | # |
| 7 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | # you may not use this file except in compliance with the License. |
| 9 | # You may obtain a copy of the License at |
| 10 | # |
| 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | # |
| 13 | # Unless required by applicable law or agreed to in writing, software |
| 14 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | # See the License for the specific language governing permissions and |
| 17 | # limitations under the License. |
| 18 | |
Lott, Christopher (cl778h) | 18c7159 | 2020-04-27 17:46:12 -0400 | [diff] [blame] | 19 | # Installs RMR headers and shared-object libraries from PackageCloud |
| 20 | # on a Debian; does NOT install or assume NNG. |
Lott, Christopher (cl778h) | f8e18d5 | 2020-03-25 13:20:04 -0400 | [diff] [blame] | 21 | # Reads RMR version number from repo file rmr-version.yaml like this: |
| 22 | # --- |
| 23 | # repo: staging (this entry is optional) |
Lott, Christopher (cl778h) | 18c7159 | 2020-04-27 17:46:12 -0400 | [diff] [blame] | 24 | # version: 3.8.2 (this entry is required) |
Lott, Christopher (cl778h) | 95cc089 | 2020-03-25 09:20:01 -0400 | [diff] [blame] | 25 | |
Lott, Christopher (cl778h) | 18c7159 | 2020-04-27 17:46:12 -0400 | [diff] [blame] | 26 | echo "---> install-deb-rmr.sh" |
Lott, Christopher (cl778h) | 95cc089 | 2020-03-25 09:20:01 -0400 | [diff] [blame] | 27 | # stop on error or unbound var, and be chatty |
| 28 | set -eux |
| 29 | |
| 30 | version_file=rmr-version.yaml |
| 31 | if [[ -f $version_file ]]; then |
| 32 | # pipeline is less elegant than yq but that requires venv and pip install |
Lott, Christopher (cl778h) | f8e18d5 | 2020-03-25 13:20:04 -0400 | [diff] [blame] | 33 | repo=$(grep "^repo:" "$version_file" | cut -d: -f2 | xargs ) |
Lott, Christopher (cl778h) | 95cc089 | 2020-03-25 09:20:01 -0400 | [diff] [blame] | 34 | ver=$(grep "^version:" "$version_file" | cut -d: -f2 | xargs) |
| 35 | else |
| 36 | echo "File $version_file not found." |
| 37 | exit 1 |
| 38 | fi |
| 39 | if [[ -z $ver ]]; then |
| 40 | echo "Failed to get RMR version string from file $version_file" |
| 41 | exit 1 |
Lott, Christopher (cl778h) | 95cc089 | 2020-03-25 09:20:01 -0400 | [diff] [blame] | 42 | fi |
Lott, Christopher (cl778h) | f8e18d5 | 2020-03-25 13:20:04 -0400 | [diff] [blame] | 43 | # default to release repo; accept override to use staging repo |
| 44 | repo=${repo:-"release"} |
| 45 | # |
Lott, Christopher (cl778h) | 95cc089 | 2020-03-25 09:20:01 -0400 | [diff] [blame] | 46 | for deb in "rmr_${ver}_amd64.deb" "rmr-dev_${ver}_amd64.deb"; do |
Lott, Christopher (cl778h) | f8e18d5 | 2020-03-25 13:20:04 -0400 | [diff] [blame] | 47 | wget -nv --content-disposition "https://packagecloud.io/o-ran-sc/${repo}/packages/debian/stretch/${deb}/download.deb" |
Lott, Christopher (cl778h) | 95cc089 | 2020-03-25 09:20:01 -0400 | [diff] [blame] | 48 | sudo dpkg -i "${deb}" |
Lott, Christopher (cl778h) | 9a0c181 | 2020-03-26 20:42:14 -0400 | [diff] [blame] | 49 | rm -f "${deb}" |
Lott, Christopher (cl778h) | 95cc089 | 2020-03-25 09:20:01 -0400 | [diff] [blame] | 50 | done |
| 51 | |
Lott, Christopher (cl778h) | 18c7159 | 2020-04-27 17:46:12 -0400 | [diff] [blame] | 52 | echo "---> install-deb-rmr.sh ends" |