File: fetch_metadata.sh.erb

package info (click to toggle)
ruby-mixlib-install 3.12.16-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 193,056 kB
  • sloc: ruby: 3,843; sh: 664; makefile: 4
file content (52 lines) | stat: -rw-r--r-- 1,566 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# fetch_metadata.sh
############
# This section calls omnitruck to get the information about the build to be
#   installed.
#
# Inputs:
# $channel:
# $project:
# $version:
# $platform:
# $platform_version:
# $machine:
# $tmp_dir:
#
# Outputs:
# $download_url:
# $sha256:
############

if test "x$download_url_override" = "x"; then
  echo "Getting information for $project $channel $version for $platform..."

  metadata_filename="$tmp_dir/metadata.txt"
  metadata_url="<%= base_url %>/$channel/$project/metadata?v=$version&p=$platform&pv=$platform_version&m=$machine"

  do_download "$metadata_url"  "$metadata_filename"

  cat "$metadata_filename"

  echo ""
  # check that all the mandatory fields in the downloaded metadata are there
  if grep '^url' $metadata_filename > /dev/null && grep '^sha256' $metadata_filename > /dev/null; then
    echo "downloaded metadata file looks valid..."
  else
    echo "downloaded metadata file is corrupted or an uncaught error was encountered in downloading the file..."
    # this generally means one of the download methods downloaded a 404 or something like that and then reported a successful exit code,
    # and this should be fixed in the function that was doing the download.
    report_bug
    exit 1
  fi

  download_url=`awk '$1 == "url" { print $2 }' "$metadata_filename"`
  sha256=`awk '$1 == "sha256" { print $2 }' "$metadata_filename"`
else
  download_url=$download_url_override
  # Set sha256 to empty string if checksum not set
  sha256=${checksum=""}
fi

############
# end of fetch_metadata.sh
############