| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 1 | #!/bin/sh |
| beierlm | a4a37f7 | 2020-06-26 12:55:01 -0400 | [diff] [blame] | 2 | # |
| 3 | # Copyright 2020 ETSI |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 17 | |
| garciadeblas | fa81f28 | 2020-12-15 00:32:13 +0000 | [diff] [blame^] | 18 | RELEASE="ReleaseNINE-daily" |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 19 | REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg" |
| 20 | REPOSITORY="testing" |
| 21 | REPOSITORY_BASE="http://osm-download.etsi.org/repository/osm/debian" |
| 22 | DEBUG= |
| 23 | |
| Mike Marchetti | 9cf4156 | 2018-10-01 12:37:59 -0400 | [diff] [blame] | 24 | while getopts ":r:k:u:R:b:-:dm:p:" o; do |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 25 | case "${o}" in |
| 26 | r) |
| 27 | REPOSITORY=${OPTARG} |
| 28 | ;; |
| 29 | R) |
| 30 | RELEASE=${OPTARG} |
| 31 | ;; |
| 32 | k) |
| 33 | REPOSITORY_KEY=${OPTARG} |
| 34 | ;; |
| 35 | u) |
| 36 | REPOSITORY_BASE=${OPTARG} |
| 37 | ;; |
| 38 | d) |
| 39 | DEBUG=y |
| 40 | ;; |
| Mike Marchetti | 9cf4156 | 2018-10-01 12:37:59 -0400 | [diff] [blame] | 41 | p) |
| 42 | PACKAGE_NAME=${OPTARG} |
| 43 | ;; |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 44 | m) |
| 45 | MDG=${OPTARG} |
| 46 | ;; |
| 47 | -) |
| 48 | ;; |
| 49 | esac |
| 50 | done |
| 51 | |
| 52 | if [ -z "$MDG" ]; then |
| 53 | echo "missing MDG" |
| 54 | fi |
| 55 | |
| Mike Marchetti | 9cf4156 | 2018-10-01 12:37:59 -0400 | [diff] [blame] | 56 | [ -z "$PACKAGE_NAME" ] && PACKAGE_NAME=$MDG |
| 57 | |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 58 | if [ -n "$DEBUG" ]; then |
| 59 | echo curl $REPOSITORY_BASE/$RELEASE/dists/$REPOSITORY/$MDG/binary-amd64/Packages |
| 60 | fi |
| 61 | |
| Mike Marchetti | 9cf4156 | 2018-10-01 12:37:59 -0400 | [diff] [blame] | 62 | curl $REPOSITORY_BASE/$RELEASE/dists/$REPOSITORY/$MDG/binary-amd64/Packages 2>/dev/null | awk -v pkg=$PACKAGE_NAME '{ |
| 63 | if ( /Package:/ && match($2,sprintf("%s$",tolower(pkg)) ) ) { |
| Mike Marchetti | 13d76c8 | 2018-09-19 15:00:36 -0400 | [diff] [blame] | 64 | package=1; |
| 65 | } else if (package==1 && match($1,"Version:")) { |
| 66 | package=0; |
| 67 | printf("%s\n", $2); |
| 68 | } |
| 69 | }' | head -1 |