Initial commit on forgejo

This commit is contained in:
Tracey Clark 2023-09-11 19:52:45 -05:00
commit 26b7ba2ea6
3 changed files with 473 additions and 0 deletions

44
backup-gitea-bin.pl Executable file
View file

@ -0,0 +1,44 @@
#!/usr/bin/perl
# backup_gitea_bin.pl
# Author: Tracey Clark
# Created: 2019-06-20
# You must have a mail transport agent installed to run this script
use strict;
use warnings;
### TEST CODE ###
my $gitea_bin='/home/tracey/tmp/testbin';
my $gitea_current_version='1';
my %binary_file = (
input => $gitea_bin,
version => $gitea_current_version,
);
my ( %opts ) = %binary_file;
my $input = $opts{input};
my $version = $opts{version};
my $gitea_bin_backup = '/home/tracey/tmp/testbin.' . $gitea_current_version . '.bz2';
### TEST CODE ###
# my ( %opts ) = %{shift()};
# my $input = $opts{input};
# my $version = $opts{version};
printf("Backing up the current binary\n");
printf("Input in backup_bin script 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";
# }
# HEREHERE how to specify output file??
my $bzip_status = system("/bin/bzip2 -k $input");
if (($bzip_status >>=8) != 0) {
die "Failed to run bzip2";
}