File: curl

package info (click to toggle)
golang-google-grpc 1.64.0-6
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 13,272 kB
  • sloc: sh: 1,096; makefile: 72
file content (27 lines) | stat: -rwxr-xr-x 893 bytes parent folder | download | duplicates (4)
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
#!/bin/sh

set -ux

# Copyright: 2020 Dmitry Smirnov <onlyjob@debian.org>
# License: GPL-3+

## Upstream sources are incomplete with .proto files missing.
## "go generate" runs .sh files that invokes `curl` to fetch .proto files.
## This file pretends to be `curl` to avoid downloading in favour of files
## from "debian/missing-sources". When a file is missing, this script tries
## to download it so in order to prepare a new upstream release it might
## be necessary to build the package once in the online environment.
## To update files in "debian/missing-sources", remove them so they
## could be re-downloaded.

CURDIR=$(dirname "$0")

file="${1##https://raw.githubusercontent.com/}"
file_path="${CURDIR}"/missing-sources/"${file}"

if [ ! -s "${file_path}" ]; then
    mkdir -v -p "${CURDIR}"/missing-sources/"${file%/*}"
    /usr/bin/curl "$1" > "${file_path}"
fi

cat "${file_path}"