diff --git a/tools/publish-release b/tools/publish-release index a3b9919ca..fd63140e6 100755 --- a/tools/publish-release +++ b/tools/publish-release @@ -78,6 +78,9 @@ done createrepo_c "$rpm_repo_dir" gpg --detach-sign --armor "$rpm_repo_dir/repodata/repomd.xml" +# Update Homebrew Formula. +tools/update-formula + cat >"$web_root_dir/install" <<-EOF #!/bin/sh set -e diff --git a/tools/update-formula b/tools/update-formula new file mode 100755 index 000000000..03b21577c --- /dev/null +++ b/tools/update-formula @@ -0,0 +1,40 @@ +#!/bin/sh + +# Update the Homebrew Formula. + +set -e +set -u + +rel_name='eturnal' +rel_vsn=$(tools/get-version) +rel_tar="$rel_name-$rel_vsn.tar.gz" +rel_dir='/home/eturnal/web/download' +formula="Formula/$rel_name.rb" +url="https://$rel_name.net/download" +myself=${0##*/} + +usage() +{ + echo >&2 "Usage: $myself" + exit 2 +} + +if ! [ -e 'rebar.config' ] || ! [ -e "tools/$myself" ] +then + echo >&2 "Please call this script from the repository's root directory." + exit 2 +elif ! [ -e "$rel_dir/$rel_tar" ] +then + echo >&2 "Cannot find $rel_tar in $rel_dir" + exit 1 +elif [ $# -ne 0 ] +then + usage +fi + +sum=$(sha256sum "$rel_dir/$rel_tar" | cut -d ' ' -f 1) + +sed -i -e "s|^\( *\)url.*|\\1url \"$url/$rel_tar\"|" \ + -e "s|^\( *\)sha256.*|\\1sha256 \"$sum\"|" "$formula" +git add "$formula" +git commit -m "Formula: update to $rel_vsn"