1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2024-11-28 10:24:20 +01:00

Add generation of mmsource-latest download.

This commit is contained in:
Nicholas Hastings 2017-04-30 19:27:15 -04:00
parent dc371b63cb
commit e2594008c0

View File

@ -3,6 +3,7 @@
use strict;
use Cwd;
use File::Basename;
use File::Temp qw/ tempfile :seekable/;
use Net::FTP;
my ($ftp_file, $ftp_host, $ftp_user, $ftp_pass, $ftp_path, $tag);
@ -70,6 +71,20 @@ else
system("zip -r $filename addons");
}
my ($tmpfh, $tmpfile) = tempfile();
print $tmpfh $filename;
$tmpfh->seek( 0, SEEK_END );
my $latest = "mmsource-latest-";
if ($^O eq "darwin") {
$latest .= "mac";
}
elsif ($^O =~ /MSWin/) {
$latest .= "windows";
}
else {
$latest .= $^O;
}
my ($major,$minor) = ($version =~ /^(\d+)\.(\d+)/);
$ftp_path .= "/$major.$minor";
@ -90,6 +105,8 @@ if ($ftp_path ne '')
$ftp->binary();
$ftp->put($filename)
or die "Cannot drop file $filename ($ftp_path): " . $ftp->message . "\n";
$ftp->put($tmpfile, $latest)
or die "Cannot drop file $latest ($ftp_path): " . $ftp->message . "\n";
$ftp->close();