forked from Qortal/qortal
Check auto-update can be fetched before broadcasting auto-update TX
This commit is contained in:
parent
de51de1819
commit
4565d0ddcb
@ -4,7 +4,7 @@ use POSIX;
|
|||||||
use Getopt::Std;
|
use Getopt::Std;
|
||||||
|
|
||||||
sub usage() {
|
sub usage() {
|
||||||
die("usage: $0 [-p port] dev-private-key\n");
|
die("usage: $0 [-p api-port] dev-private-key\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
my %opt;
|
my %opt;
|
||||||
@ -91,6 +91,18 @@ my $sign_data = qq|' { "privateKey": "${privkey}", "transactionBytes": "${raw_tx
|
|||||||
my $signed_tx = `curl --silent -H "accept: text/plain" -H "Content-Type: application/json" --url http://localhost:${port}/transactions/sign --data ${sign_data}`;
|
my $signed_tx = `curl --silent -H "accept: text/plain" -H "Content-Type: application/json" --url http://localhost:${port}/transactions/sign --data ${sign_data}`;
|
||||||
printf "\nSigned transaction:\n%s\n", $signed_tx;
|
printf "\nSigned transaction:\n%s\n", $signed_tx;
|
||||||
|
|
||||||
|
# Check we can actually fetch update
|
||||||
|
my $origin = `git remote get-url origin`;
|
||||||
|
die("Unable to get github url for 'origin'?\n") unless $origin && $origin =~ m/:(.*)\.git$/;
|
||||||
|
my $repo = $1;
|
||||||
|
my $update_url = "https://github.com/${repo}/raw/${commit_hash}/${project}.update";
|
||||||
|
|
||||||
|
my $fetch_result = `curl --silent -o /dev/null --location --range 0-1 --head --write-out '%{http_code}' --url ${update_url}`;
|
||||||
|
if ($fetch_result ne '200') {
|
||||||
|
die("\nUnable to fetch update from ${update_url}\n");
|
||||||
|
}
|
||||||
|
printf "\nUpdate fetchable from ${update_url}\n";
|
||||||
|
|
||||||
# Flush STDOUT after every output
|
# Flush STDOUT after every output
|
||||||
$| = 1;
|
$| = 1;
|
||||||
print "\n";
|
print "\n";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user