Corrected file name and download logic to fix bug preventing installation
This commit is contained in:
parent
37196bd060
commit
ecb3f531dd
1 changed files with 12 additions and 8 deletions
|
|
@ -18,7 +18,7 @@ use strict;
|
|||
use warnings;
|
||||
use LWP::UserAgent;
|
||||
use IO::Compress::Bzip2 qw(bzip2 $Bzip2Error);
|
||||
use Data::Dumper;
|
||||
use File::Basename;
|
||||
use JSON;
|
||||
use Sort::Versions;
|
||||
use Getopt::Long qw(GetOptions);
|
||||
|
|
@ -72,10 +72,12 @@ my $latest_release_hash = decode_json( $resp->content )
|
|||
or die "[DIE]: Unable to parse the version data! Output is:\n $resp";
|
||||
|
||||
my $orig_tag = $latest_release_hash->{tag_name};
|
||||
print "!!! ORIG TAG is $orig_tag\n";
|
||||
my $tag = $orig_tag;
|
||||
substr( $tag, 0, 1, '' );
|
||||
print("Latest upstream version: $tag\n");
|
||||
my $release_id = $latest_release_hash->{id}; # Works
|
||||
printf( YELLOW
|
||||
"[INFO] Latest upstream version: $tag\n Release ID $release_id\n", RESET);
|
||||
my $unz_filename = 'gitea-' . $tag . $filetype;
|
||||
#ex: gitea-1.7.6-linux-amd64
|
||||
my $download_dir = '/home/gitea/bin/';
|
||||
|
|
@ -94,9 +96,9 @@ if ( versioncmp( $gitea_current_version, $tag ) == -1 ) {
|
|||
|
||||
my $download_url = get_download_url( $download_filename, $release_id );
|
||||
print("Downloading the compressed binary\n");
|
||||
print("Download URL we got from the sub is $download_url\n");
|
||||
`wget -P $gitea_bin_dir $download_url`;
|
||||
my $xz_file = $gitea_bin_dir . $download_filename;
|
||||
print("[INFO] Download URL we got from the sub is $download_url\n");
|
||||
`wget -P $download_dir $download_url`;
|
||||
my $xz_file = $download_dir . $download_filename;
|
||||
|
||||
if ( defined $info ) {
|
||||
print YELLOW "[INFO] xz file is $xz_file\n", RESET;
|
||||
|
|
@ -277,14 +279,16 @@ sub build_download_url {
|
|||
|
||||
sub install_bin {
|
||||
my $filename = shift;
|
||||
print("Unpacking the downloaded file, setting owner and permissions\n");
|
||||
print("Unpacking the downloaded file \"$download_dir$filename\", setting owner and permissions\n");
|
||||
my $unpacked_filename = basename($filename, ".xz");
|
||||
print "Unpacked filename is $unpacked_filename\n";
|
||||
|
||||
# Copy the downloaded binary to gitea and chmod it 750
|
||||
# Doing this with a filthy system call because the perl library
|
||||
# for xz manipulation is a memory hog and buggy besides
|
||||
system("xz -d --keep $download_dir . $filename");
|
||||
system("xz -d --keep $download_dir" . "/" . "$filename");
|
||||
system("systemctl stop gitea");
|
||||
system("cp $download_dir/$unz_filename $gitea_bin");
|
||||
system("cp $download_dir$unpacked_filename $gitea_bin");
|
||||
system("chown gitea.gitea $gitea_bin");
|
||||
system("chmod 750 $gitea_bin");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue