Skip to content

Commit

Permalink
Pull request: scripts: fix build-release
Browse files Browse the repository at this point in the history
Merge in DNS/adguard-home from 2276-fix-release-3 to master

Updates AdguardTeam#2276.
Updates AdguardTeam#2507.

Squashed commit of the following:

commit 1f75697
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Dec 31 13:45:25 2020 +0300

    scripts: fix build-release
  • Loading branch information
ainar-g authored and heyxkhoa committed Mar 17, 2023
1 parent 385c402 commit 2041f9a
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions scripts/make/build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ build() {
GOMIPS="${build_mips#0}"\
GOOS="$os"\
VERBOSE="$(( verbose - 1 ))"\
VERSION="$version"\
OUT="$build_output"\
sh ./scripts/make/go-build.sh\
;
Expand Down Expand Up @@ -287,14 +288,17 @@ log "calculating checksums"
cd "./${dist}"

# Don't use quotes to get word splitting.
sha256sum $(ls *.tar.gz *.zip) > ./checksums.txt
sha256sum $(ls -1 -A -q *.tar.gz *.zip) > ./checksums.txt
)

log "writing versions"

echo "$version" > "./${dist}/version.txt"

# Create the verison.json file.
#
# TODO(a.garipov): Perhaps rewrite this as a go run program. Dealing
# with structured documents is really not a Shell's job.

readonly version_download_url="https://static.adguard.com/adguardhome/${channel}"
readonly version_json="./${dist}/version.json"
Expand All @@ -319,8 +323,12 @@ echo "{
# Use +f here so that ls works and we don't need to use find.
set +f

readonly ar_files="$(ls -1 -A -q "./${dist}/"*.tar.gz "./${dist}/"*.zip)"
readonly ar_files_len="$(echo "$ar_files" | wc -l)"

i='1'
# Don't use quotes to get word splitting.
for f in $(ls "./${dist}/"*.tar.gz "./${dist}/"*.zip)
for f in $ar_files
do
platform="$f"

Expand All @@ -334,7 +342,14 @@ echo "{
# Use the filename's base path.
filename="${f#./${dist}/}"

echo " \"download_${platform}\": \"${version_download_url}/${filename}\"," >> "$version_json"
if [ "$i" = "$ar_files_len" ]
then
echo " \"download_${platform}\": \"${version_download_url}/${filename}\"" >> "$version_json"
else
echo " \"download_${platform}\": \"${version_download_url}/${filename}\"," >> "$version_json"
fi

: "$(( i++ ))"
done
)

Expand Down

0 comments on commit 2041f9a

Please sign in to comment.