summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2018-06-23 07:50:44 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2018-06-23 07:50:44 +0000
commit286bfc5b6e7354b0184bbb3acc43c7eb0f472f7e (patch)
treeaba293b3508a5483fb5049a9870cf4170bdf21d1 /Master
parentfc3bfaff2afa7a9366c0983a6e14344815b27eda (diff)
Modifications for tcl installer
git-svn-id: svn://tug.org/texlive/trunk@48074 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/install-tl89
1 files changed, 69 insertions, 20 deletions
diff --git a/Master/install-tl b/Master/install-tl
index d82b32581ed..afbaed7d155 100755
--- a/Master/install-tl
+++ b/Master/install-tl
@@ -95,6 +95,15 @@ use strict;
# global list of warnings
@::WARNLINES = ();
+# debugging communication with external gui: use shared logfile
+# (assumes unix)
+sub dblog {
+ my $s = shift;
+ open(my $dbf, ">>", "/tmp/dblog");
+ print $dbf "PERL: $s\n";
+ close $dbf;
+}
+
# we play around with the environment, place to keep original
my %origenv = ();
@@ -200,15 +209,38 @@ $::fileassocdesc[0] = "None";
$::fileassocdesc[1] = "Only new";
$::fileassocdesc[2] = "All";
+# before we try to interact with the user, we need to know whether or not
+# install-tl was called from an external gui. This gui will start install-tl
+# with "-from_ext_gui" as its first command-line option.
+
+my $from_ext_gui = 0;
+if ((defined $ARGV[0]) && $ARGV[0] eq "-from_ext_gui") {
+ shift @ARGV;
+ $from_ext_gui = 1;
+
+ # do not buffer output to the frontend
+ select(STDERR);
+ $| = 1;
+ select(STDOUT);
+ $| = 1;
+
+ # ___, defined in this file, replaces the GUI translating function
+ *__ = \&::___;
+}
+
# if we find a file installation.profile we ask the user whether we should
# continue with the installation
# note, we are in the directory from which the aborted installation was run.
my %profiledata;
if (-r "installation.profile") {
+ if ($from_ext_gui) { # prepare for dialog interaction
+ print "mess_yesno\n";
+ }
my $pwd = Cwd::getcwd();
print "ABORTED TL INSTALLATION FOUND: installation.profile (in $pwd)\n";
print
"Do you want to continue with the exact same settings as before (y/N): ";
+ print "\nendmess\n" if $from_ext_gui;
my $answer = <STDIN>;
if ($answer =~ m/^y(es)?$/i) {
$opt_profile = "installation.profile";
@@ -251,6 +283,9 @@ if ($opt_gui eq "") {
if ($opt_gui eq "expert") {
$opt_gui = "perltk";
}
+if ($from_ext_gui) {
+ $opt_gui = "extl";
+}
if ($opt_help) {
# theoretically we could make a subroutine with all the same
@@ -347,8 +382,6 @@ our $tlpdb;
my $localtlpdb;
my $location;
-# $finished == 1 if the menu call already did the installation
-my $finished = 0;
@::info_hook = ();
our $media;
@@ -396,7 +429,8 @@ END_NO_CHECKSUMS
# check as soon as possible for GUI functionality to give people a chance
# to interrupt.
-if (($opt_gui ne "text") && !$opt_no_gui && ($opt_profile eq "")) {
+# not needed for extl, because in this case install-tl is invoked by external gui
+if (($opt_gui ne "extl") && ($opt_gui ne "text") && !$opt_no_gui && ($opt_profile eq "")) {
# try to load Tk.pm, but don't die if it doesn't work
eval { require Tk; };
if ($@) {
@@ -511,7 +545,6 @@ if ($opt_profile eq "") {
our $MENU_INSTALL = 0;
our $MENU_ABORT = 1;
our $MENU_QUIT = 2;
- our $MENU_ALREADYDONE = 3;
$opt_gui = "text" if ($opt_no_gui);
# finally do check for additional screens in the $opt_gui setting:
# format:
@@ -562,16 +595,30 @@ if ($opt_profile eq "") {
flushlog();
exit(2);
}
- if (!$finished && ($ret != $MENU_INSTALL)) {
+ if ($ret != $MENU_INSTALL) {
tlwarn("Unknown return value of run_menu: $ret\n");
exit(3);
+ } elsif (win32() && $from_ext_gui) {
+ create_profile($ENV{'tmpprofile'});
+ exit;
+ # the external gui will do the actual installation
+ # from a temporary batchfile using this temporary profile,
+ # this to prevent hundreds of dosboxes popping up
}
} else { # no interactive setting of options
*__ = \&::___;
if (!do_remote_init()) {
die ("Exiting installation.\n");
}
+ if (win32() && $from_ext_gui) {
+ # copy profile and let the gui restart the installation
+ TeXLive::copy("-f", $opt_profile, $ENV{'tmpprofile'});
+ exit;
+ }
read_profile($opt_profile);
+ if ($from_ext_gui) {
+ print STDOUT "startinst\n";
+ }
}
my $varsdump = "";
@@ -590,7 +637,7 @@ info("Installing to: $vars{TEXDIR}\n");
$::env_warns = "";
create_welcome();
my $status = 1;
-if ($opt_gui eq 'text' or $opt_profile ne "" or
+if ($opt_gui eq 'text' or $opt_gui eq 'extl' or $opt_profile ne "" or
!(-r "$::installerdir/tlpkg/installer/tracked-install.pl")) {
$status = do_installation();
if (@::WARNLINES) {
@@ -2296,20 +2343,22 @@ sub update_numbers {
# to be called at exit when the installation did not complete
sub flushlog {
- my $fh;
- my $logfile = "install-tl.log";
- if (open (LOG, ">$logfile")) {
- my $pwd = Cwd::getcwd();
- $logfile = "$pwd/$logfile";
- print "$0: Writing log in current directory: $logfile\n";
- $fh = \*LOG;
- } else {
- $fh = \*STDERR;
- print "$0: Could not write to $logfile, so flushing messages to stderr.\n";
- }
-
- foreach my $l (@::LOGLINES) {
- print $fh $l;
+ if (!defined($::LOGFILENAME)) {
+ my $fh;
+ my $logfile = "install-tl.log";
+ if (open (LOG, ">$logfile")) {
+ my $pwd = Cwd::getcwd();
+ $logfile = "$pwd/$logfile";
+ print "$0: Writing log in current directory: $logfile\n";
+ $fh = \*LOG;
+ } else {
+ $fh = \*STDERR;
+ print
+ "$0: Could not write to $logfile, so flushing messages to stderr.\n";
+ }
+ foreach my $l (@::LOGLINES) {
+ print $fh $l;
+ }
}
} # flushlog