source: main/trunk/gs-release-builder/upload-to-www-internal-windows.pl@ 36535

Last change on this file since 36535 was 36535, checked in by kjdon, 20 months ago

updating this to use 7Zip, as system tar and release-kits gnu tar didn't work properly on new windows build machine

File size: 2.1 KB
Line 
1#!C:\greenstone\gs-release-builder\packages\strawberry-perl-5.18\perl\bin\perl.exe -w
2
3use strict;
4use File::Copy;
5
6# The following is GNU tar, and I found on the windows machine build machine it wasn't preserving capitalisation
7#my $tar = "\"C:\\greenstone\\gs-release-builder\\release-kits\\bin\\tar.exe\" -c ";
8# the following uses tar from C:\Windows\System32\tar.exe - this tar cannot output to standard out
9# my $tar = "tar -c ";
10# the following uses 7Zip and seems to work.
11# a (create), -ttar (type of archive = tar) -an (disable archive_name field - otherwise it will try to use one of the input files as the field name) -so (output to stdout)
12my $tar = "\"C:\\Program Files\\7-Zip\\7z\" a -an -ttar -so ";
13
14#my $set = `set`;
15#print $set;
16#print "\n";
17my $main_snapshot_dir = "C:\\greenstone\\gs-release-builder\\snapshots\\";
18my $keys_dir = "C:\\greenstone\\gs-release-builder\\keys\\";
19
20my @snap_dirs = ("gs2-caveat", "gs3-caveat"); # diffcoll?
21#my $private_key_file = $keys_dir . "kjdon-linux-labs.ppk";
22#die "Couldn't find jumphost key file $private_key_file\n" unless -e $private_key_file; - don't need to use the jumphost now
23foreach my $dir (@snap_dirs) {
24 opendir (DIR, "$main_snapshot_dir$dir") || next;
25 print "Attempting to upload snapshots and logs for $dir\n";
26 my @contents = readdir(DIR); close DIR;
27 foreach my $from (@contents) {
28 if ($from =~ /^from/) { # look for the 'from-2022-03-23'
29 my $new_dir = "$main_snapshot_dir$dir\\$from\\uploads";
30 if (!-d $new_dir) {
31 print "directory $new_dir doesn't exist, skipping\n";
32 next;
33 }
34 # copy ($private_key_file, $new_dir);
35# my $command = "cd $new_dir && $tar rk* Greenstone* | plink -proxycmd \"plink -i kjdon-linux-labs.ppk kjdon\@linux-labs.cms.waikato.ac.nz -nc %host:%port\" -T -i ".$keys_dir."upload-caveat-ed25519.ppk nzdl-gsorg\@www-internal.greenstone.org";
36 my $command = "cd $new_dir && $tar rk* Greenstone* | plink -T -i ".$keys_dir."upload-caveat-ed25519.ppk nzdl-gsorg\@www-internal.greenstone.org";
37 print "About to run: $command\n";
38 STDOUT->flush();
39 system($command);
40 }
41 }
42}
43print "finished\n";
Note: See TracBrowser for help on using the repository browser.