-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_gpg.sh
executable file
·66 lines (52 loc) · 1.31 KB
/
setup_gpg.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
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env bash
set -eo pipefail
os=$1
cpu=$2
repo=$3
if [[ -z ${os} || -z ${cpu} || -z ${repo} ]]; then
echo 1>&2 "Incorrect arguments given to setup_gpg.sh; os: $os cpu: $cpu repo: $repo"
exit 1
fi
echo 1>&2 "**"
echo 1>&2 "** Setup gpg"
echo 1>&2 "**"
mkdir -p ~/.gnupg
if [[ -d ${repo}/shared/gnupg ]]; then
pushd ${repo}/shared/gnupg >/dev/null
for filepath in *; do
if [[ -f ${filepath} ]]; then
filename=$(basename ${filepath})
full=${repo}/shared/gnupg/${filename}
if [[ -f ${full} ]]; then
ln -v -f -s ${full} ~/.gnupg/${filename}
fi
fi
done
popd >/dev/null
fi
if [[ -d ${repo}/${os}/gnupg ]]; then
pushd ${repo}/${os}/gnupg >/dev/null
for filepath in *; do
if [[ -f ${filepath} ]]; then
filename=$(basename ${filepath})
full=${repo}/${os}/gnupg/${filename}
if [[ -f ${full} ]]; then
ln -v -f -s ${full} ~/.gnupg/${filename}
fi
fi
done
popd >/dev/null
fi
if [[ -d ${repo}/${os}-${cpu}/gnupg ]]; then
pushd ${repo}/${os}-${cpu}/gnupg >/dev/null
for filepath in *; do
if [[ -f ${filepath} ]]; then
filename=$(basename ${filepath})
full=${repo}/${os}-${cpu}/gnupg/${filename}
if [[ -f ${full} ]]; then
ln -v -f -s ${full} ~/.gnupg/${filename}
fi
fi
done
popd >/dev/null
fi