diff --git a/tools/approve-auto-update.sh b/tools/approve-auto-update.sh index 3f783ed6..232fc099 100755 --- a/tools/approve-auto-update.sh +++ b/tools/approve-auto-update.sh @@ -1,8 +1,13 @@ #!/usr/bin/env bash +port=12391 +if [ $# -gt 0 -a "$1" = "-t" ]; then + port=62391 +fi + printf "Searching for auto-update transactions to approve...\n"; -tx=$( curl --silent --url "http://localhost:12391/arbitrary/search?txGroupId=1&service=1&confirmationStatus=CONFIRMED&limit=1&reverse=true" ); +tx=$( curl --silent --url "http://localhost:${port}/arbitrary/search?txGroupId=1&service=1&confirmationStatus=CONFIRMED&limit=1&reverse=true" ); if fgrep --silent '"approvalStatus":"PENDING"' <<< "${tx}"; then true else @@ -24,7 +29,7 @@ read -s privkey printf "\n" # Convert to public key -pubkey=$( curl --silent --url "http://localhost:12391/utils/publickey" --data @- <<< "${privkey}" ); +pubkey=$( curl --silent --url "http://localhost:${port}/utils/publickey" --data @- <<< "${privkey}" ); if egrep -v --silent '^\w{44,46}$' <<< "${pubkey}"; then printf "Invalid response from API - was your private key correct?\n%s\n" "${pubkey}" exit @@ -32,11 +37,11 @@ fi printf "Your public key: %s\n" ${pubkey} # Convert to address -address=$( curl --silent --url "http://localhost:12391/addresses/convert/${pubkey}" ); +address=$( curl --silent --url "http://localhost:${port}/addresses/convert/${pubkey}" ); printf "Your address: %s\n" ${address} # Grab last reference -lastref=$( curl --silent --url "http://localhost:12391/addresses/lastreference/{$address}" ); +lastref=$( curl --silent --url "http://localhost:${port}/addresses/lastreference/{$address}" ); printf "Your last reference: %s\n" ${lastref} # Build GROUP_APPROVAL transaction @@ -54,7 +59,7 @@ tx_json=$( cat < 0; seconds--)); do done printf "\rBroadcasting signed GROUP_APPROVAL transaction... \n" -result=$( curl --silent --url "http://localhost:12391/transactions/process" --data @- <<< "${signed_tx}" ) +result=$( curl --silent --url "http://localhost:${port}/transactions/process" --data @- <<< "${signed_tx}" ) printf "API response:\n%s\n" "${result}" diff --git a/tools/publish-auto-update.pl b/tools/publish-auto-update.pl index 6599baac..e9092e83 100755 --- a/tools/publish-auto-update.pl +++ b/tools/publish-auto-update.pl @@ -33,13 +33,17 @@ while () { } close(POM); -# short-form commit hash on 'master' branch +# determine git branch +my $branch_name = ` git symbolic-ref -q HEAD ` +$branch_name =~ s|^refs/heads/||; # ${branch_name##refs/heads/} + +# short-form commit hash on base branch (non-auto-update) my $commit_hash = `git show --no-patch --format=%h`; die("Can't find commit hash\n") if ! defined $commit_hash; chomp $commit_hash; -printf "Commit hash on 'master' branch: %s\n", $commit_hash; +printf "Commit hash on '%s' branch: %s\n", $branch_name, $commit_hash; -# build timestamp / commit timestamp on 'master' branch +# build timestamp / commit timestamp on base branch my $timestamp = `git show --no-patch --format=%ct`; die("Can't determine commit timestamp\n") if ! defined $timestamp; $timestamp *= 1000; # Convert to milliseconds @@ -133,4 +137,4 @@ chomp $result; die("Transaction wasn't accepted:\n$result\n") unless $result eq 'true'; my $decoded_tx = `curl --silent -H "Content-Type: application/json" --url http://localhost:${port}/transactions/decode --data ${signed_tx}`; -printf "\nTransaction accepted:\n$decoded_tx\n"; \ No newline at end of file +printf "\nTransaction accepted:\n$decoded_tx\n";