-
Notifications
You must be signed in to change notification settings - Fork 6.5k
/
Copy pathfetch_gpg_keys.sh
executable file
·53 lines (46 loc) · 1.62 KB
/
fetch_gpg_keys.sh
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
53
#!/bin/bash
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# A script to fetch gpg keys with retry.
function retry {
if [[ "${#}" -le 1 ]]; then
echo "Usage: ${0} retry_count commands.."
exit 1
fi
local retries=${1}
local command="${@:2}"
until [[ "${retries}" -le 0 ]]; do
$command && return 0
if [[ $? -ne 0 ]]; then
echo "command failed, retrying"
((retries--))
fi
done
return 1
}
# 2.7.17 (Benjamin Peterson)
retry 3 gpg --keyserver keyserver.ubuntu.com --recv-keys \
C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
# 3.4.10, 3.5.9 (Larry Hastings)
retry 3 gpg --keyserver keyserver.ubuntu.com --recv-keys \
97FC712E4C024BBEA48A61ED3A5CA953F73C700D
# 3.6.9, 3.7.5 (Ned Deily)
retry 3 gpg --keyserver keyserver.ubuntu.com --recv-keys \
0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
# 3.8.0, 3.9.0 (Łukasz Langa)
retry 3 gpg --keyserver keyserver.ubuntu.com --recv-keys \
E3FF2839C048B25C084DEBE9B26995E310250568
# 3.10.x and 3.11.x (Pablo Galindo Salgado)
retry 3 gpg --keyserver keyserver.ubuntu.com --recv-keys \
A035C8C19219BA821ECEA86B64E628F8D684696D