Skip to content

Commit 7520c71

Browse files
committed
Update buildserver-upload.sh
Changes: - Handle checksums recursively in the upload directory - Add 'desktop-downloader' platform for uploading installer-downloader
1 parent aa5db48 commit 7520c71

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

ci/buildserver-upload.sh

+18-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
set -eu
4-
shopt -s nullglob
4+
shopt -s nullglob globstar
55

66
CODE_SIGNING_KEY_FINGERPRINT="A1198702FC3E0A09A9AE5B75D5A1D4F266DE8DDF"
77

@@ -23,35 +23,42 @@ function rsync_upload {
2323

2424
while true; do
2525
sleep 10
26-
for checksums_path in *.sha256; do
26+
for checksums_path in **/*.sha256; do
2727
sleep 1
2828

29+
checksums_dir=$(dirname "$checksums_path")
30+
checksums_filename=$(basename "$checksums_path")
31+
2932
# Parse the platform name and version out of the filename of the checksums file.
30-
platform="$(echo "$checksums_path" | cut -d + -f 1)"
31-
version="$(echo "$checksums_path" | cut -d + -f 3,4 | sed 's/\.sha256//')"
32-
if ! sha256sum --quiet -c "$checksums_path"; then
33+
platform="$(echo "$checksums_filename" | cut -d + -f 1)"
34+
version="$(echo "$checksums_filename" | cut -d + -f 3,4 | sed 's/\.sha256//')"
35+
if ! (cd "$checksums_dir" && sha256sum --quiet -c "$checksums_filename"); then
3336
echo "Failed to verify checksums for $version"
3437
continue
3538
fi
3639

37-
if [[ $version == *"-dev-"* ]]; then
40+
if [[ "$platform" == "installer-downloader" ]]; then
41+
upload_path="desktop/installer-downloader"
42+
elif [[ $version == *"-dev-"* ]]; then
3843
upload_path="$platform/builds"
3944
else
4045
upload_path="$platform/releases"
4146
fi
4247

43-
files=$(awk '{print $2}' < "$checksums_path")
44-
for file in $files; do
48+
readarray -t files < <(cut -f 2- -d ' ' < "$checksums_path" | sed 's/^\*\(.*\)/\1/')
49+
for filename in "${files[@]}"; do
50+
file="$checksums_dir/$filename"
51+
4552
file_upload_dir="$upload_path/$version"
46-
if [[ $platform == "desktop" && ! $file == MullvadVPN-* ]]; then
53+
if [[ $platform == "desktop" && ! $filename == MullvadVPN-* ]]; then
4754
file_upload_dir="$file_upload_dir/additional-files"
48-
elif [[ $platform == "android" && ! $file =~ MullvadVPN-"$version"(.apk|.play.apk|.play.aab) ]]; then
55+
elif [[ $platform == "android" && ! $filename =~ MullvadVPN-"$version"(.apk|.play.apk|.play.aab) ]]; then
4956
file_upload_dir="$file_upload_dir/additional-files"
5057
fi
5158

5259
rsync_upload "$file" "$file_upload_dir/" || continue
5360

54-
if [[ $file == MullvadVPN-* ]]; then
61+
if [[ $filename == MullvadVPN-* || $filename == Install* ]]; then
5562
rm -f "$file.asc"
5663
gpg -u $CODE_SIGNING_KEY_FINGERPRINT --pinentry-mode loopback --sign --armor --detach-sign "$file"
5764
rsync_upload "$file.asc" "$file_upload_dir/" || continue

installer-downloader/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ function upload {
346346
local files=( "$FILENAME."* )
347347

348348
local checksums_path
349-
checksums_path="desktop-downloader+$(hostname)+$version.sha256"
349+
checksums_path="installer-downloader+$(hostname)+$version.sha256"
350350

351351
sha256sum "${files[@]}" > "$checksums_path"
352352

0 commit comments

Comments
 (0)