From 853f80b92836f68548bf30ebd54ede40b2b37227 Mon Sep 17 00:00:00 2001 From: CalDescent Date: Mon, 14 Jun 2021 18:46:21 +0100 Subject: [PATCH] Updates to build-zip.sh and build-release.sh There were necessary for these scripts to function in my build environment (Mac OSX). This may give errors when running in other environments, but we can deal with that in future, when others need to use these scripts. --- tools/build-release.sh | 17 ++++++++++++++--- tools/build-zip.sh | 16 ++++++++-------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/tools/build-release.sh b/tools/build-release.sh index 5c18187e..f78ec1b0 100755 --- a/tools/build-release.sh +++ b/tools/build-release.sh @@ -1,7 +1,8 @@ #!/usr/bin/env bash # Change this to where AdvancedInstaller outputs built EXE installers -WINDOWS_INSTALLER_DIR=/home/transfer/Qortal/Qortal-SetupFiles +SCRIPT_DIR=$(dirname $(realpath "$0")) +WINDOWS_INSTALLER_DIR="${SCRIPT_DIR}/../WindowsInstaller/Qortal-SetupFiles" set -e shopt -s expand_aliases @@ -16,6 +17,16 @@ saved_pwd=$PWD alias SHA256='(sha256 -q || sha256sum | cut -d" " -f1) 2>/dev/null' +function 3hash { + local zip_src=$1 + local md5hash=$(md5 ${zip_src} | awk '{ print $NF }') + local sha1hash=$(shasum ${zip_src} | awk '{ print $1 }') + local sha256hash=$(sha256sum ${zip_src} | awk '{ print $1 }') + echo "\`MD5: ${md5hash}\`" + echo "\`SHA1: ${sha1hash}\`" + echo "\`SHA256: ${sha256hash}\`" +} + # Check we are within a git repo git_dir=$( git rev-parse --show-toplevel ) if [ -z "${git_dir}" ]; then @@ -27,7 +38,7 @@ fi cd ${git_dir} # Check we are in 'master' branch -# branch_name=$( git symbolic-ref -q HEAD ) +# branch_name=$( git symbolic-ref -q HEAD ) || echo "Cannot determine branch name" && exit 1 # branch_name=${branch_name##refs/heads/} # if [ "${branch_name}" != "master" ]; then # echo "Unexpected current branch '${branch_name}' - expecting 'master'" @@ -56,7 +67,7 @@ git_url=https://github.com/${git_url##*:} git_url=${git_url%%.git} # Check for EXE -exe=${project^}-${git_tag#v}.exe +exe=${project}-${git_tag#v}.exe exe_src="${WINDOWS_INSTALLER_DIR}/${exe}" if [ ! -r "${exe_src}" ]; then echo "Cannot find EXE installer at ${exe_src}" diff --git a/tools/build-zip.sh b/tools/build-zip.sh index 111aba21..47fdd373 100755 --- a/tools/build-zip.sh +++ b/tools/build-zip.sh @@ -21,13 +21,13 @@ fi cd ${git_dir} # Check we are in 'master' branch -branch_name=$( git symbolic-ref -q HEAD ) -branch_name=${branch_name##refs/heads/} -echo "Current git branch: ${branch_name}" -if [ "${branch_name}" != "master" ]; then - echo "Unexpected current branch '${branch_name}' - expecting 'master'" - exit 1 -fi +# branch_name=$( git symbolic-ref -q HEAD ) || echo "Cannot determine branch name" && exit 1 +# branch_name=${branch_name##refs/heads/} +# echo "Current git branch: ${branch_name}" +# if [ "${branch_name}" != "master" ]; then +# echo "Unexpected current branch '${branch_name}' - expecting 'master'" +# exit 1 +# fi # Determine project name project=$( perl -n -e 'if (m/(\w+)<.artifactId>/) { print $1; exit }' pom.xml $) @@ -60,7 +60,7 @@ git show HEAD:stop.sh > ${build_dir}/stop.sh printf "{\n}\n" > ${build_dir}/settings.json -touch -d ${commit_ts%%+??:??} ${build_dir} ${build_dir}/* +gtouch -d ${commit_ts%%+??:??} ${build_dir} ${build_dir}/* rm -f ${saved_pwd}/${project}.zip (cd ${build_dir}/..; 7z a -r -tzip ${saved_pwd}/${project}-${git_tag#v}.zip ${project}/)