--- /dev/null
+###RUN_PERL: #!/usr/bin/perl
+
+# update.pl is generated from update.1.pl.
+#
+# run update on BSTA server
+#
+# Copyright (C) 2025 Balthasar Szczepański
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+use strict;
+use utf8;
+use Encode::Locale ('decode_argv');
+use Encode ('encode', 'decode');
+
+###PERL_LIB: use lib ~/ott/bsta/lib
+use botm_common (
+ 'join_path',
+ 'read_data_file',
+ 'system_encoded'
+);
+
+binmode STDIN, ':encoding(UTF-8)';
+binmode STDOUT, ':encoding(UTF-8)';
+binmode STDERR, ':encoding(UTF-8)';
+decode_argv();
+
+my $time = time();
+srand ($time-$$);
+
+###PERL_ETC_REMOTE_PATH: ETC_REMOTE_PATH = ~/ott/bsta/etc/remote.txt
+
+my %remote;
+my $target;
+my $server;
+
+print $time." UPDATE\n";
+
+if (@ARGV < 1) {
+ print STDERR "no remote target\n";
+ print "FAIL\n";
+ exit 1;
+}
+
+$target = 'bin-'.shift(@ARGV);
+
+%remote = read_data_file(ETC_REMOTE_PATH());
+unless (
+ (exists $remote{'server'}) and
+ (exists $remote{'user' }) and
+ (exists $remote{$target })
+) {
+ print STDERR "didn't get remote target\n";
+ print "FAIL\n";
+ exit 1;
+}
+
+$server = $remote{'user'}.'@'.$remote{'server'};
+$target = $remote{$target };
+
+my $r = system_encoded('ssh', (
+ 'ssh', '-q', '-T', $server, '-t',
+ join_path('/', $target, 'update.pl').' '.join(' ', @ARGV)
+));
+
+print(($r == 0) ? "OK\n" : "FAIL\n");
# upload.pl is generated from upload.1.pl.
#
-# make data files from chapter files
+# upload frames, attachment & stuff
#
# Copyright (C) 2025 Balthasar Szczepański
#
}
foreach my $key (keys %keys) {
unless (exists $local_data{$key}) {
- push(@differences, '--> '.$key);
+ push(@differences, '--> '.$key.': '.$remote_data{$key});
next;
}
unless (exists $remote_data{$key}) {
- push(@differences, '<-- '.$key);
+ push(@differences, '<-- '.$key.': '.$local_data{$key});
next;
}
unless ($local_data{$key} eq $remote_data{$key}) {
- push(@differences, '=/= '.$key);
- push(@differences, '<== '.$local_data{$key}.' <==');
- push(@differences, '==> '.$remote_data{$key}.' ==>');
- push(@differences, '=\=');
+ push(@differences, '=/= '.$key.':');
+ push(@differences, '<== '.$local_data{$key});
+ push(@differences, '==> '.$remote_data{$key});
next;
}
}