-
Notifications
You must be signed in to change notification settings - Fork 384
/
Copy pathprepare-rpm-repository.sh
executable file
·46 lines (36 loc) · 1.32 KB
/
prepare-rpm-repository.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
#!/usr/bin/env bash
#
# Usage: ./prepare-rpm-repository.sh <artifact dir> <app version> <repository dir>
#
# Will create an rpm repository in <repository dir> and add all .rpm files from
# <artifact dir> matching <app version> to the repository.
set -eu
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# shellcheck source=ci/buildserver-config.sh
source "$SCRIPT_DIR/buildserver-config.sh"
artifact_dir=$1
version=$2
repo_dir=$3
function create_repository {
local arch_repo_dir=$1
local rpm_path=$2
mkdir -p "$arch_repo_dir"
# Copy RPM file into repository
cp "$rpm_path" "$arch_repo_dir"/
# Generate repository metadata files (containing among other things checksums
# for the above artifact)
createrepo_c "$arch_repo_dir"
# Sign repository metadata (created by createrepo_c above)
# --yes is passed to automatically overwrite existing files
# in the case where the build server re-builds something we already
# have built.
gpg --detach-sign --armor --yes "$arch_repo_dir/repodata/repomd.xml"
}
for arch in "${SUPPORTED_RPM_ARCHITECTURES[@]}"; do
rpm_path="$artifact_dir"/MullvadVPN-"$version"_"$arch".rpm
if [[ ! -e "$rpm_path" ]]; then
echo "RPM at $rpm_path does not exist" >&2
exit 1
fi
create_repository "$repo_dir/$arch" "$rpm_path"
done