diff options
author | Siep Kroonenberg <siepo@cybercomm.nl> | 2017-04-15 08:22:51 +0000 |
---|---|---|
committer | Siep Kroonenberg <siepo@cybercomm.nl> | 2017-04-15 08:22:51 +0000 |
commit | 2b467244921da9f75590f1ca21e3f6d1eae09471 (patch) | |
tree | 5551f25d5aaf35942ba0da8be9cd32d32cabf88c /Master/install-tl | |
parent | ade96bccf43fcbd9bdf05e4943942bf59dc3c488 (diff) |
Reworked installer and tlaunch option
git-svn-id: svn://tug.org/texlive/trunk@43805 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/install-tl')
-rwxr-xr-x | Master/install-tl | 476 |
1 files changed, 272 insertions, 204 deletions
diff --git a/Master/install-tl b/Master/install-tl index 238a5e12341..f7dac723073 100755 --- a/Master/install-tl +++ b/Master/install-tl @@ -45,6 +45,7 @@ BEGIN { use Cwd 'abs_path'; use Getopt::Long qw(:config no_autoabbrev); use Pod::Usage; +use POSIX (); use TeXLive::TLUtils qw(platform platform_desc sort_archs which getenv win32 unix info log debug tlwarn ddebug tldie @@ -78,7 +79,6 @@ if (win32) { &unregister_file_type &broadcast_env &update_assocs - &add_desktop_shortcut &add_menu_shortcut &remove_desktop_shortcut &remove_menu_shortcut @@ -195,7 +195,8 @@ $::fileassocdesc[2] = "All"; if (-r "installation.profile") { 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 + "Do you want to continue with the exact same settings as before (y/N): "; my $answer = <STDIN>; if ($answer =~ m/^y(es)?$/i) { $opt_profile = "installation.profile"; @@ -314,7 +315,8 @@ if ($opt_profile) { # for now, not allowed if in_place info("Automated TeX Live installation using profile: $opt_profile\n"); } else { $opt_profile = ""; - info("Profile $opt_profile not readable, continuing in interactive mode.\n"); + info( + "Profile $opt_profile not readable, continuing in interactive mode.\n"); } } @@ -410,7 +412,6 @@ if (($opt_gui ne "text") && !$opt_no_gui && ($opt_profile eq "")) { } } -# if (defined($opt_force_arch)) { tlwarn("Overriding platform to $opt_force_arch\n"); $::_platform_ = $opt_force_arch; @@ -470,6 +471,7 @@ if ($opt_location) { } } +# find wget, tar, xzdec if (!setup_programs ("$::installerdir/tlpkg/installer", "$::_platform_")) { tldie("$0: Goodbye.\n"); } @@ -530,22 +532,20 @@ if ($opt_profile eq "") { if (-r $tlpdboldpath && $dn ne $install_tl_root) { debug ("found old installation in $dn\n"); push @runargs, "-old-installation-found=$dn"; + # only the text-mode menu will pay attention! } } } my $ret = &{$::run_menu}(@runargs); if ($ret == $MENU_QUIT) { - do_cleanup(); + do_cleanup(); # log, profile, temp files flushlog(); exit(1); } elsif ($ret == $MENU_ABORT) { - # omit do_cleanup(). + # here, omit do_cleanup() flushlog(); exit(2); - } elsif ($ret == $MENU_ALREADYDONE) { - debug("run_menu has already done the work ... cleaning up.\n"); - $finished = 1; } if (!$finished && ($ret != $MENU_INSTALL)) { tlwarn("Unknown return value of run_menu: $ret\n"); @@ -564,27 +564,39 @@ foreach my $key (sort keys %vars) { } log("Settings:\n" . $varsdump); -my $errcount = 0; -if (!$finished) { - # do the actual installation - # w32: first, remove trailing slash from texdir[w] - # in case it is the root of a drive - $vars{'TEXDIR'} =~ s![/\\]$!!; - sanitise_options(); - info("Installing to: $vars{TEXDIR}\n"); - $errcount = do_installation(); -} - -do_cleanup(); - -my $status = 0; -if ($errcount > 0) { - $status = 1; - warn "$0: errors in installation reported above,\n"; - warn "$0: exiting with bad status.\n"; +sanitise_options(); +install_warnlines_hook(); # collect warnings in @::WARNLINES +info("Installing to: $vars{TEXDIR}\n"); + +$::env_warns = ""; +check_env() unless $ENV{"TEXLIVE_INSTALL_ENV_NOCHECK"}; +create_welcome(); +my $status = 1; +if ($opt_gui eq 'text' or + !(-r "$::installerdir/tlpkg/installer/tracked-install.pl")) { + $status = do_installation(); + if (@::WARNLINES) { + foreach my $t (@::WARNLINES) { print STDERR $t; } + } + if ($::env_warns) { print STDERR $::env_warns; } + foreach my $t (@::welcome_arr) { + printf STDERR sprintf (shift @$t, @$t); + print STDERR "\n"; + } + do_cleanup(); # sets $::LOGFILENAME if not already defined + if ($LOGFILENAME) { + print STDERR "Logfile: $::LOGFILENAME\n"; + } else { + # do_cleanup sets $::LOGFILENAME to "" + #if no logfile could be written + print STDERR + "Cannot create logfile $vars{'TEXDIR'}/install-tl.log: $!\n"; + } +} else { + require("installer/tracked-install.pl"); + $status = installer_tracker(); } -exit($status); - +exit $status; ################################################################### @@ -637,7 +649,7 @@ sub only_load_remote { } } return load_tlpdb(); -} +} # only_load_remote sub do_remote_init { @@ -660,7 +672,7 @@ END_MISMATCH } final_remote_init(); return 1; -} +} # do_remote_init sub do_version_agree { $texlive_release = $tlpdb->config_release; @@ -681,7 +693,7 @@ sub do_version_agree { } else { return 1; } -} +} # do_version_agree sub final_remote_init { info("Installing TeX Live $TeXLive::TLConfig::ReleaseYear from: $location" . @@ -714,7 +726,8 @@ sub final_remote_init { if ($opt_in_place and ($media ne "local_uncompressed")) { print "TeX Live not local or not decompressed; 'in_place' option not applicable\n"; $opt_in_place = 0; - } elsif ($opt_in_place and (!TeXLive::TLUtils::texdir_check($::installerdir))) { + } elsif ( + $opt_in_place and (!TeXLive::TLUtils::texdir_check($::installerdir))) { print "Installer dir not writable; 'in_place' option not applicable\n"; $opt_in_place = 0; } @@ -747,27 +760,33 @@ sub final_remote_init { tlwarn("Scheme $opt_scheme not defined, ignoring it.\n"); } } -} +} # final_remote_init sub do_installation { - install_warnlines_hook(); if (win32()) { non_admin() if !$vars{'option_w32_multi_user'}; } + if ($vars{'portable'}) { + $vars{'option_desktop_integration'} = 0; + $vars{'option_menu_integration'} = 0; + $vars{'option_file_assocs'} = 0; + $vars{'option_path'} = 0; + $vars{'option_w32_multi_user'} = 0; + } if ($vars{'selected_scheme'} ne "scheme-infraonly" && $vars{'n_collections_selected'} <= 0) { tlwarn("Nothing selected, nothing to install, exiting!\n"); exit 1; } # maybe_make_ro tests for admin, local drive and NTFS before proceeding. - # setting the root read-only automatically locks everything below it. - # do TEXDIR now, before removing final slash + # making the root read-only automatically locks everything below it. + # do TEXDIR now, before it loses its final slash mkdirhier "$vars{'TEXDIR'}"; if (win32()) { TeXLive::TLWinGoo::maybe_make_ro ($vars{'TEXDIR'}); } - # remove final slash from TEXDIR even if it is the root of a drive + # now remove final slash from TEXDIR even if it is the root of a drive $vars{'TEXDIR'} =~ s!/$!!; # do the actual installation make_var_skeleton "$vars{'TEXMFSYSVAR'}"; @@ -796,7 +815,7 @@ sub do_installation { && ! -e "$vars{TEXDIR}/release-texlive.txt") { copy("$::installerdir/release-texlive.txt", "$vars{TEXDIR}/"); } - + calc_depends(); save_options_into_tlpdb(); # we need to do that dir, since we use the TLPDB->install_package which @@ -841,17 +860,30 @@ sub do_installation { $localtlpdb->add_tlpobj($tlpobj); $localtlpdb->save unless $vars{'in_place'}; - + my $errcount = do_postinst_stuff(); - if (win32() || $vars{'portable'}) { - print welcome(); - } else { - print welcome_paths(); + + #tlwarn("!!! Dummy test warning\n"); + #tlwarn("!!! Another test warning\n"); + #$errcount += 2; + + # check environment for possibly tex-related strings: + check_env(); + # log, profile, temp files: + do_cleanup(); + + create_welcome(); + if (@::WARNLINES) { + unshift @::WARNLINES, ("\nSummary of warnings:\n"); } - print warnings_summary(); - - return $errcount; -} + my $status = 0; + if ($errcount > 0) { + $status = 1; + warn "\n$0: errors in installation reported above\n"; + } + + return $status; +} # do_installation sub run_postinst_cmd { my ($cmd) = @_; @@ -867,7 +899,7 @@ sub run_postinst_cmd { } return $ret; -} +} # run_postinst_cmd # @@ -911,7 +943,7 @@ sub do_postinst_stuff { TEXMFVAR TEXMFCONFIG TEXMFHOME TEXMFCACHE); if (defined($ENV{'TEXMFCNF'})) { - print "WARNING: environment variable TEXMFCNF is set. + tlwarn "WARNING: environment variable TEXMFCNF is set. You should know what you are doing. We will unset it for the post-install actions, but all further operations might be disturbed.\n\n"; @@ -957,12 +989,6 @@ operations might be disturbed.\n\n"; debug("Effective TEXMFCNF: " . `kpsewhich -expand-path=\$TEXMFCNF` ."\n"); } - if (win32() and !$vars{'portable'} and !$vars{'in_place'}) { - create_uninstaller($vars{'TEXDIR'}); - # TODO: custom uninstaller for in_place - # (re-)initialize batchfile for uninstalling shortcuts - } - # Step 4: run the programs my $errcount = 0; @@ -1026,9 +1052,29 @@ operations might be disturbed.\n\n"; $errcount += run_postinst_cmd("tlmgr --no-execute-actions paper letter"); } + # option settings in launcher.ini + if (win32() && !$vars{'portable'}) { + if ($vars{'option_file_assocs'} != 1 || !$vars{'option_path'}) { + # create higher priority tlaunch.ini with adjusted settings + # whether or not launcher mode (desktop integration 2) + # was selected + rewrite_tlaunch_ini(); + } + } + # now rerun mktexlsr for updmap-sys and tlmgr paper letter updates. $errcount += wsystem("re-running", "mktexlsr", $TEXMFSYSVAR,$TEXMFSYSCONFIG); + if (win32() and !$vars{'portable'} and !$vars{'in_place'}) { + if ($vars{'option_desktop_integration'} != 2) { + create_uninstaller($vars{'TEXDIR'}); + } else { + $errcount += wsystem ( + 'Running','tlaunch.exe', + admin() ? 'admin_inst_silent' : 'user_inst_silent'); + } + } + # luatex/context setup. if (exists($install{"context"}) && $install{"context"} == 1 && !exists $ENV{"TEXLIVE_INSTALL_NO_CONTEXT_CACHE"}) { @@ -1051,18 +1097,19 @@ operations might be disturbed.\n\n"; # on Unix set symlinks # for portable, this option should be unset # it should not be necessary to test separately for portable - do_path_adjustments() if $vars{'option_path'}; + do_path_adjustments() if + $vars{'option_path'} and $vars{option_desktop_integration} != 2; # now do the system integration: # on unix this means setting up symlinks - # on w32 this means adding to path, settting registry values + # on w32 this means settting registry values # on both, we run the postaction directives of the tlpdb # no need to test for portable or in_place: # the menus (or profile?) should have set the required options $errcount += do_tlpdb_postactions(); return $errcount; -} +} # do_postinst_stuff # Run the post installation code in the postaction tlpsrc entries. @@ -1073,20 +1120,67 @@ sub do_tlpdb_postactions { # option settings already reflect portable- and in_place options. my $usedtlpdb = $vars{'in_place'} ? $tlpdb : $localtlpdb; - + my $ret = 0; # n. of errors + foreach my $package ($usedtlpdb->list_packages) { - TeXLive::TLUtils::do_postaction("install", - $usedtlpdb->get_package($package), - $vars{'option_file_assocs'}, - $vars{'option_menu_integration'}, - $vars{'option_desktop_integration'}, - $vars{'option_post_code'}); + # !!! alert: parameter 4 is menu shortcuts, parameter 5 does nothing !!! + if ($vars{'option_desktop_integration'}==2) { + # skip creation of shortcuts and file associations + if (!TeXLive::TLUtils::do_postaction( + "install", $usedtlpdb->get_package($package), + 0, 0, 0, $vars{'option_post_code'})) { $ret += 1; } + } else { + # create shortcuts and file associations + # according to corresponding options + if (!TeXLive::TLUtils::do_postaction( + "install", $usedtlpdb->get_package($package), + $vars{'option_file_assocs'}, + $vars{'option_desktop_integration'}, 0, + $vars{'option_post_code'})) { $ret += 1; } + } } + # windows: alert the system about changed file associations if (win32) { TeXLive::TLWinGoo::update_assocs(); } info ("finished with package-specific postactions\n"); - - return 0; # xxxx errcount -} + return $ret; +} # do_tlpdb_postactions + +sub rewrite_tlaunch_ini { + # create a higher-priority copy of tlaunch.ini in TEXMFSYSVAR + # with appropriate settings in the General section + my $ret = 0; # n. of errors + + chomp( my $tmfmain = `kpsewhich -var-value=TEXMFMAIN` ) ; + chomp( my $tmfsysvar = `kpsewhich -var-value=TEXMFSYSVAR` ) ; + if (open IN, "$tmfmain/web2c/tlaunch.ini") { + my $eolsave = $/; + undef $/; + my $ini = <IN>; + close IN; + # remove general section, if any + $ini =~ s/\r\n/\n/g; + $ini =~ s/\[general[^\[]*//si; + mkdirhier("$tmfsysvar/web2c"); + if (open OUT, ">", "$tmfsysvar/web2c/tlaunch.ini") { + my @fts = ('none', 'new', 'overwrite'); + $\ = "\n"; + print OUT $ini; + print OUT "[General]"; + print OUT "FILETYPES=$fts[$vars{'option_file_assocs'}]"; + print OUT "SEARCHPATH=$vars{'option_path'}\n"; + close OUT; + `mktexlsr $tmfsysvar`; + } else { + $ret += 1; + tlwarn("Cannot write modified tlaunch.ini\n"); + } + $/ = $eolsave; + } else { + $ret += 1; + tlwarn("Cannot open tlaunch.ini for reading\n"); + } + return $ret; +} # rewrite_tlaunch_ini sub do_path_adjustments { info ("running path adjustment actions\n"); @@ -1100,7 +1194,7 @@ sub do_path_adjustments { $vars{'option_sys_info'}); } info ("finished with path adjustment actions\n"); -} +} # do_path_adjustments # we have to adjust the texmf.cnf file to the paths set in the configuration! @@ -1247,7 +1341,7 @@ EOF } print TMFLUA "}\n"; close(TMFLUA) || warn "close($TMFLUA) failed: $!"; -} +} # do_texmf_cnf sub dump_vars { @@ -1264,7 +1358,7 @@ sub dump_vars { } close VARS if (!ref($filename)); debug("\n%vars dumped to '$filename'.\n"); -} +} # dump_vars # Determine which platforms are supported. @@ -1278,7 +1372,7 @@ sub set_platforms_supported { for my $key (keys %vars) { ++$vars{'n_systems_available'} if ($key=~/^binary/); } -} +} # set_platforms_supported # Environment variables and default values on UNIX: # TEXLIVE_INSTALL_PREFIX /usr/local/texlive => $tex_prefix @@ -1340,7 +1434,7 @@ sub set_texlive_default_dirs { $vars{'TEXMFVAR'} = "\$TEXMFSYSVAR"; $vars{'TEXMFCONFIG'} = "\$TEXMFSYSCONFIG"; } -} +} # set_texlive_default_dirs sub calc_depends { # we have to reset the install hash EVERY TIME otherwise everything will @@ -1468,12 +1562,13 @@ sub calc_depends { } $vars{'total_size'} = sprintf "%d", ($size * $TeXLive::TLConfig::BlockSize)/1024**2; -} +} # calc_depends sub load_tlpdb { my $master = $location; info("Loading $master/$TeXLive::TLConfig::InfraLocation/$TeXLive::TLConfig::DatabaseName\n"); - $tlpdb = TeXLive::TLPDB->new(root => $master, 'verify' => $opt_verify_downloads); + $tlpdb = TeXLive::TLPDB->new( + root => $master, 'verify' => $opt_verify_downloads); if (!defined($tlpdb)) { my $do_die = 1; # if that failed, and: @@ -1492,7 +1587,8 @@ sub load_tlpdb { # download object $::tldownload_server->enable if defined($::tldownload_server); # - $tlpdb = TeXLive::TLPDB->new(root => $master, 'verify' => $opt_verify_downloads); + $tlpdb = TeXLive::TLPDB->new( + root => $master, 'verify' => $opt_verify_downloads); if (!defined($tlpdb)) { tlwarn("Oh well, adding tlnet did not help.\n"); tlwarn(<<END_EXPLICIT_MIRROR); @@ -1523,12 +1619,13 @@ END_EXPLICIT_MIRROR $vars{'option_autobackup'} = $tlpdb->option("autobackup"); $vars{'option_backupdir'} = $tlpdb->option("backupdir"); $vars{'option_letter'} = defined($tlpdb->option("paper")) - && ($tlpdb->option("paper") eq "letter" ? 1 : 0); + && ($tlpdb->option("paper") eq "letter" ? 1 : 0); + # below, we really mean (start) menu integration. + # 2016: always menu shortcuts, never desktop shortcuts, whatever the setting + # 2017: new option value 2: launcher instead of menu. + # in portable case, shortcuts sanitized away elsewhere $vars{'option_desktop_integration'} = $tlpdb->option("desktop_integration"); $vars{'option_desktop_integration'} = 1 if win32(); - # we unconditionally set the menu integration, this will be done in all - # cases but portable use, where we sanitize it away - $vars{'option_menu_integration'} = 1; $vars{'option_path'} = $tlpdb->option("path"); $vars{'option_path'} = 0 if !defined($vars{'option_path'}); $vars{'option_path'} = 1 if win32(); @@ -1556,7 +1653,7 @@ END_EXPLICIT_MIRROR $vars{'selected_scheme'} = $default_scheme; } return 1; -} +} # load_tlpdb sub initialize_collections { foreach my $pkg ($tlpdb->list_packages) { @@ -1581,7 +1678,7 @@ sub initialize_collections { $vars{"collection-wintools"} = 1; ++$vars{'n_collections_selected'}; } -} +} # initialize_collections sub set_install_platform { my $detected_platform=platform; @@ -1619,7 +1716,7 @@ sub set_install_platform { } } return($ret); -} +} # set_install_platform sub create_profile { my $profilepath = shift; @@ -1656,7 +1753,7 @@ sub create_profile { if (!ref($profilepath)) { close PROFILE; } -} +} # create_profile sub read_profile { my $profilepath = shift; @@ -1696,16 +1793,15 @@ sub read_profile { for my $scheme_content ($scheme->depends) { $vars{"$scheme_content"}=1 if ($scheme_content=~/^collection-/); } -} +} # read_profile # helper subroutine to do sanity check of options before installation sub sanitise_options { # portable option overrides any system integration options - $vars{'option_path'} &&= !$vars{'portable'}; - $vars{'option_file_assocs'} &&= !$vars{'portable'}; - $vars{'option_desktop_integration'} &&= !$vars{'portable'}; - $vars{'option_menu_integration'} &&= !$vars{'portable'}; -} + $vars{'option_path'} = 0 if $vars{'portable'}; + $vars{'option_file_assocs'} = 0 if $vars{'portable'}; + $vars{'option_desktop_integration'} = 0 if $vars{'portable'}; +} # sanitise_options sub do_install_packages { my @what; @@ -1736,11 +1832,13 @@ sub do_install_packages { flushlog(); exit(1); } - $localtlpdb->option ("desktop_integration", $vars{'option_desktop_integration'} ? "1" : "0"); + # restore options in tlpdb + $localtlpdb->option ( + "desktop_integration", $vars{'option_desktop_integration'}); $localtlpdb->option ("file_assocs", $vars{'option_file_assocs'}); $localtlpdb->option ("post_code", $vars{'option_post_code'} ? "1" : "0"); $localtlpdb->save; -} +} # do_install_packages # for later complete removal we want to save some options and values # into the local tlpdb: @@ -1758,7 +1856,8 @@ sub save_options_into_tlpdb { $localtlpdb->option ("autobackup", $vars{'option_autobackup'}); $localtlpdb->option ("backupdir", $vars{'option_backupdir'}); $localtlpdb->option ("create_formats", $vars{'option_fmt'} ? "1" : "0"); - $localtlpdb->option ("desktop_integration", $vars{'option_desktop_integration'} ? "1" : "0"); + $localtlpdb->option ( + "desktop_integration", $vars{'option_desktop_integration'}); $localtlpdb->option ("file_assocs", $vars{'option_file_assocs'}); $localtlpdb->option ("post_code", $vars{'option_post_code'} ? "1" : "0"); $localtlpdb->option ("sys_bin", $vars{'option_sys_bin'}); @@ -1766,7 +1865,8 @@ sub save_options_into_tlpdb { $localtlpdb->option ("sys_man", $vars{'option_sys_man'}); $localtlpdb->option ("install_docfiles", $vars{'option_doc'} ? "1" : "0"); $localtlpdb->option ("install_srcfiles", $vars{'option_src'} ? "1" : "0"); - $localtlpdb->option ("w32_multi_user", $vars{'option_w32_multi_user'} ? "1" : "0"); + $localtlpdb->option ( + "w32_multi_user", $vars{'option_w32_multi_user'} ? "1" : "0"); my @archs; foreach (keys %vars) { if (m/^binary_(.*)$/ ) { @@ -1783,11 +1883,12 @@ sub save_options_into_tlpdb { } $localtlpdb->setting("available_architectures", @archs); $localtlpdb->save() unless $vars{'in_place'}; -} +} # save_options_into_tlpdb sub import_settings_from_old_tlpdb { my $dn = shift; - my $tlpdboldpath = "$dn/$TeXLive::TLConfig::InfraLocation/$TeXLive::TLConfig::DatabaseName"; + my $tlpdboldpath = + "$dn/$TeXLive::TLConfig::InfraLocation/$TeXLive::TLConfig::DatabaseName"; my $previoustlpdb; if (-r $tlpdboldpath) { # we found an old installation, so read that one in and save @@ -1901,7 +2002,6 @@ sub import_settings_from_old_tlpdb { $previoustlpdb->option_pkg("00texlive.installation", "create_formats"); $vars{'option_desktop_integration'} = 1 if win32(); - $vars{'option_menu_integration'} = 1 if win32(); $vars{'option_path'} = $previoustlpdb->option_pkg("00texlive.installation", "path"); @@ -1967,12 +2067,13 @@ sub import_settings_from_old_tlpdb { } elsif ($common_paper eq "a4") { # do nothing } else { - tlwarn("Previous installation has common paper setting of: $common_paper\n"); + tlwarn( + "Previous installation has common paper setting of: $common_paper\n"); tlwarn("After installation has finished, you will need\n"); tlwarn(" to redo this setting by running:\n"); } } -} +} # import_settings_from_old_tlpdb # do everything to select a scheme # @@ -2009,7 +2110,7 @@ sub select_scheme { } # for good measure, update the deps calc_depends(); -} +} # select_scheme # try to give a decent order of schemes, but be so general that # if we change names of schemes nothing bad happnes (like forgetting one) @@ -2029,7 +2130,7 @@ sub schemes_ordered_for_presentation { push @scheme_order, $s if !$schemes_shown{$s}; } return @scheme_order; -} +} # schemes_ordered_for_presentation sub update_numbers { $vars{'n_collections_available'}=0; @@ -2046,8 +2147,9 @@ sub update_numbers { ++$vars{'n_collections_selected'} if $vars{$key} == 1; } } -} +} # update_numbers +# to be called at exit when the installation did not complete sub flushlog { my $fh; my $logfile = "install-tl.log"; @@ -2064,25 +2166,9 @@ sub flushlog { foreach my $l (@::LOGLINES) { print $fh $l; } -} +} # flushlog sub do_cleanup { - # now open the log file and write out the log lines if needed. - # the user could have given the -logfile option in which case all the - # stuff is already dumped to it and $::LOGFILE defined. So do not - # redefine it. - if (!defined($::LOGFILE)) { - if (open(LOGF,">$vars{'TEXDIR'}/install-tl.log")) { - $::LOGFILE = \*LOGF; - foreach my $line(@::LOGLINES) { - print $::LOGFILE "$line"; - } - } else { - tlwarn("$0: Cannot create log file $vars{'TEXDIR'}/install-tl.log: $!\n" - . "Not writing out log lines.\n"); - } - } - # remove temporary files from TEXDIR/temp if (($media eq "local_compressed") or ($media eq "NET")) { debug("Remove temporary downloaded containers...\n"); @@ -2097,74 +2183,49 @@ sub do_cleanup { create_profile("$vars{'TEXDIR'}/$InfraLocation/texlive.profile"); debug("Profile written to $vars{'TEXDIR'}/$InfraLocation/texlive.profile\n"); } - # Close log file if present - close($::LOGFILE) if (defined($::LOGFILE)); - if (defined($::LOGFILENAME) and (-e $::LOGFILENAME)) { - print "Logfile: $::LOGFILENAME\n"; - } elsif (-e "$vars{'TEXDIR'}/install-tl.log") { - print "Logfile: $vars{'TEXDIR'}/install-tl.log\n"; + + # now open the log file and write out the log lines if needed. + # the user could have given the -logfile option in which case all the + # stuff is already dumped to it and $::LOGFILE defined. So do not + # redefine it. + if (!defined($::LOGFILE)) { + # no -logfile option; nothing written yet + $::LOGFILENAME = "$vars{'TEXDIR'}/install-tl.log"; + if (open(LOGF,">$::LOGFILENAME")) { + $::LOGFILE = \*LOGF; + foreach my $line(@::LOGLINES) { + print $::LOGFILE "$line"; + } } else { - print "No logfile\n"; + tlwarn("$0: Cannot create log file $::LOGFILENAME: $!\n" + . "Not writing out log lines.\n"); + } } -} - - -# Return the basic welcome message. - -sub welcome { - my $welcome = <<"EOF"; - - See - $::vars{'TEXDIR'}/index.html - for links to documentation. The TeX Live web site - contains updates and corrections: http://tug.org/texlive. - - TeX Live is a joint project of the TeX user groups around the world; - please consider supporting it by joining the group best for you. The - list of user groups is on the web at http://tug.org/usergroups.html. - - Welcome to TeX Live! - -EOF - return $welcome; -} - - -# The same welcome message as above but with hints about C<PATH>, -# C<MANPATH>, and C<INFOPATH>. - -sub welcome_paths { - my $welcome = welcome (); - - # ugly, remove welcome msg; better than repeating the whole text, though. - $welcome =~ s/\n Welcome to TeX Live!\n//; - - $welcome .= <<"EOF"; - Add $::vars{'TEXDIR'}/texmf-dist/doc/info to INFOPATH. - Add $::vars{'TEXDIR'}/texmf-dist/doc/man to MANPATH - (if not dynamically found). -EOF - - $welcome .= <<"EOF"; - - Most importantly, add $::vars{'TEXDIR'}/bin/$::vars{'this_platform'} - to your PATH for current and future sessions. -EOF - unless ($ENV{"TEXLIVE_INSTALL_ENV_NOCHECK"}) { - # check for tex-related envvars. - my $texenvs = ""; - for my $evar (sort keys %origenv) { - next if $evar =~ /^(_ - |.*PWD - |GENDOCS_TEMPLATE_DIR|PATH|SHELLOPTS - )$/x; # don't worry about these - if ("$evar $origenv{$evar}" =~ /tex/i) { # check both key and value - $texenvs .= " $evar=$origenv{$evar}\n"; - } + # Close log file if present + close($::LOGFILE) if (defined($::LOGFILE)); + if (!defined($::LOGFILENAME) and (-e "$vars{'TEXDIR'}/install-tl.log")) { + $::LOGFILENAME = "$vars{'TEXDIR'}/install-tl.log"; + } + if (!(defined($::LOGFILENAME)) or !(-e $::LOGFILENAME)) { + $::LOGFILENAME = ""; + } +} # do_cleanup + +sub check_env { + # check for tex-related envvars. + $::env_warns = ""; + for my $evar (sort keys %origenv) { + next if $evar =~ /^(_ + |.*PWD + |GENDOCS_TEMPLATE_DIR|PATH|SHELLOPTS + )$/x; # don't worry about these + if ("$evar $origenv{$evar}" =~ /tex/i) { # check both key and value + $::env_warns .= " $evar=$origenv{$evar}\n"; } - if ($texenvs) { - $welcome .= <<"EOF"; + } + if ($::env_warns) { + $::env_warns = <<"EOF"; ---------------------------------------------------------------------- The following environment variables contain the string "tex" @@ -2173,17 +2234,25 @@ EOF while running TeX. If you encounter problems, try unsetting them. Please ignore spurious matches unrelated to TeX. -$texenvs ---------------------------------------------------------------------- +$::env_warns ---------------------------------------------------------------------- EOF - } } +} - $welcome .= <<"EOF"; - - Welcome to TeX Live! -EOF - - return $welcome; + +# Create a welcome message. +# This is an array of references to anonymous arrays of parameters for +# either __ or sprintf: a localizable string, possibly with placeholders, +# followed by parameters for those placeholders, if any. + +sub create_welcome { + @::welcome_arr = (); + push @::welcome_arr, (["\nWelcome to TeX Live!\n"]); + push @::welcome_arr, [ + "See %s/index.html for links to documentation.\nThe TeX Live web site (http://tug.org/texlive/)\ncontains any updates and corrections.\n\nTeX Live is a joint project of the TeX user groups around the world;\nplease consider supporting it by joining the group best for you.\nThe list of groups is available on the web at http://tug.org/usergroups.html.\n", $::vars{'TEXDIR'}]; + if (!win32()) { + push @::welcome_arr, ["Add %s/texmf-dist/doc/man to MANPATH.\nAdd %s/texmf-dist/doc/info to INFOPATH.\nMost importantly, add %s/bin/%s\nto your PATH for current and future sessions.", $::vars{'TEXDIR'}, $::vars{'TEXDIR'}, $::vars{'TEXDIR'}, $::vars{'this_platform'}]; + } } @@ -2192,17 +2261,17 @@ sub install_warnlines_hook { push @::warn_hook, sub { push @::WARNLINES, @_; }; } -# a summary of warnings if there were any -sub warnings_summary { - return '' unless @::WARNLINES; - my $summary = <<EOF; - -Summary of warning messages during installation: -EOF - $summary .= join ("", map { " $_" } @::WARNLINES); # indent each warning - $summary .= "\n"; # extra blank line - return $summary; -} +## a summary of warnings if there were any +#sub warnings_summary { +# return '' unless @::WARNLINES; +# my $summary = <<EOF; +# +#Summary of warning messages during installation: +#EOF +# $summary .= join ("", map { " $_" } @::WARNLINES); # indent each warning +# $summary .= "\n"; # extra blank line +# return $summary; +#} @@ -2222,7 +2291,6 @@ sub deselect_collections { } } - __END__ =head1 NAME |