Moved backup routine to separate file for modularity
This commit is contained in:
parent
501e85f277
commit
13d223e2d5
2 changed files with 73 additions and 12 deletions
|
|
@ -42,7 +42,6 @@ elsif ( $gitea_current_version_string =~ m/ion\ (\d+\d+\w*)\s/ ) {
|
|||
$gitea_current_version = $1;
|
||||
printf("Current version of gitea that is installed is $1\n");
|
||||
$alphanum_ver = 1;
|
||||
print("!! Alpha num is true\n");
|
||||
}
|
||||
my %binary_file = (
|
||||
input => $gitea_bin,
|
||||
|
|
@ -64,12 +63,15 @@ printf($z $format, $string);
|
|||
close($z);
|
||||
=cut
|
||||
|
||||
# This method may not work. Check the module. Ken said doing this through system call was more reliable & performant
|
||||
my $input = $gitea_bin;
|
||||
my $temp_out = '/home/gitea/tempout.bz';
|
||||
my $bz = new IO::Compress::Bzip2 $temp_out
|
||||
or die "bzip2 failed: $Bzip2Error\n";
|
||||
|
||||
backup_bin( \%binary_file );
|
||||
#backup_bin( \%binary_file );
|
||||
backup_gitea_bin.pl( \%binary_file );
|
||||
|
||||
|
||||
my $baseURL = q{https://github.com/go-gitea/gitea/};
|
||||
my $latestURL = q{https://api.github.com/repos/go-gitea/gitea/releases/latest};
|
||||
|
|
@ -138,18 +140,33 @@ if ( $tag gt $gitea_current_version || $alphanum_ver == 1 ) {
|
|||
|
||||
##### Subroutines #####
|
||||
|
||||
sub backup_bin {
|
||||
my ( %opts ) = %{shift()};
|
||||
my $input = $opts{input};
|
||||
my $version = $opts{version};
|
||||
printf("Backing up the current binary\n");
|
||||
printf("Input in backup_bin sub is $input\n and version is $version\n");
|
||||
my $gitea_bin_backup = '/home/gitea/bin/gitea.' . $gitea_current_version . '.bz2';
|
||||
printf("Gitea bin backup will be $gitea_bin_backup\n");
|
||||
|
||||
return;
|
||||
sub check_deps {
|
||||
# Check to make sure dependencies installed on system - unit test??
|
||||
# bzip2
|
||||
}
|
||||
|
||||
# sub backup_bin {
|
||||
# my ( %opts ) = %{shift()};
|
||||
# my $input = $opts{input};
|
||||
# my $version = $opts{version};
|
||||
# printf("Backing up the current binary\n");
|
||||
# printf("Input in backup_bin sub is $input\n and version is $version\n");
|
||||
# my $gitea_bin_backup = '/home/gitea/bin/gitea.' . $gitea_current_version . '.bz2';
|
||||
# printf("Gitea bin backup will be $gitea_bin_backup\n");
|
||||
# # Do this with a system call to make a compressed copy of the current binary
|
||||
# # bzip2 -k file.txt
|
||||
# # my $status = system("vi", "fred.txt");
|
||||
# # if (($status >>=8) != 0) {
|
||||
# # die "Failed to run vi";
|
||||
# # }
|
||||
# my $bzip_status = system("bzip2 -k", "$input");
|
||||
# if (($status >>=8) != 0) {
|
||||
# die "Failed to run bzip2";
|
||||
# }
|
||||
#
|
||||
# return;
|
||||
# }
|
||||
|
||||
sub get_download_url {
|
||||
my ($dl_filename, $rel_id) = @_;
|
||||
my $dl_url;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue