Update regex 'update-gitea.pl'

Corrected regex to properly get version number. Removed commented out code that wont be used.
This commit is contained in:
Tracey Clark 2019-03-15 16:40:57 -05:00
commit 52a764c8df

View file

@ -42,7 +42,7 @@ $VAR1 = {
my $gitea_bin = '/home/gitea/bin/gitea'; my $gitea_bin = '/home/gitea/bin/gitea';
my $gitea_current_version_string = `$gitea_bin --version`; my $gitea_current_version_string = `$gitea_bin --version`;
my $gitea_current_version; my $gitea_current_version;
if ( $gitea_current_version_string =~ m/ion\ (\w+)\ b/ ) { if ( $gitea_current_version_string =~ m/ion\ (\d+\.\d+\.\d*)\s+b/ ) {
$gitea_current_version = $1; $gitea_current_version = $1;
} }
printf("The version of gitea that is running is \"$gitea_current_version\"\n"); printf("The version of gitea that is running is \"$gitea_current_version\"\n");
@ -68,8 +68,8 @@ my $bz = new IO::Compress::Bzip2 $temp_out
# need to do in OO way # need to do in OO way
# https://metacpan.org/pod/IO::Compress::Bzip2 # https://metacpan.org/pod/IO::Compress::Bzip2
print $bz $gitea_bin; # This writes the filename as string to the bz #print $bz $gitea_bin; # This writes the filename as string to the bz
$bz->close(); #$bz->close();
my $baseURL = q{https://github.com/go-gitea/gitea/}; my $baseURL = q{https://github.com/go-gitea/gitea/};
my $latestURL = q{https://api.github.com/repos/go-gitea/gitea/releases/latest}; my $latestURL = q{https://api.github.com/repos/go-gitea/gitea/releases/latest};
@ -77,7 +77,6 @@ my $latestURL = q{https://api.github.com/repos/go-gitea/gitea/releases/latest};
# https://hubpages.com/technology/Use-Perl-to-access-REST-API # https://hubpages.com/technology/Use-Perl-to-access-REST-API
# Spin up the browser object (via LWP::UserAgent) # Spin up the browser object (via LWP::UserAgent)
my $ua = LWP::UserAgent->new( my $ua = LWP::UserAgent->new(
#ssl_opts => { verify_hostname => 0 }, # not worried about SSL certs
cookie_jar => {}, # keep cookies in RAM but not persistent between sessions cookie_jar => {}, # keep cookies in RAM but not persistent between sessions
); );