diff options
Diffstat (limited to 'Master')
-rwxr-xr-x | Master/bin/win32/tlaunch.exe | bin | 114176 -> 114688 bytes | |||
-rwxr-xr-x | Master/install-tl | 476 | ||||
-rw-r--r-- | Master/tlpkg/installer/install-menu-perltk.pl | 778 | ||||
-rw-r--r-- | Master/tlpkg/installer/install-menu-text.pl | 125 | ||||
-rw-r--r-- | Master/tlpkg/installer/install-menu-wizard.pl | 133 | ||||
-rw-r--r-- | Master/tlpkg/installer/tracked-install.pl | 141 |
6 files changed, 946 insertions, 707 deletions
diff --git a/Master/bin/win32/tlaunch.exe b/Master/bin/win32/tlaunch.exe Binary files differindex 1aa7910b2d3..589da750271 100755 --- a/Master/bin/win32/tlaunch.exe +++ b/Master/bin/win32/tlaunch.exe 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 diff --git a/Master/tlpkg/installer/install-menu-perltk.pl b/Master/tlpkg/installer/install-menu-perltk.pl index 230a6db0451..af465638057 100644 --- a/Master/tlpkg/installer/install-menu-perltk.pl +++ b/Master/tlpkg/installer/install-menu-perltk.pl @@ -22,8 +22,8 @@ require Tk; require Tk::Dialog; require Tk::DialogBox; require Tk::PNG; -require Tk::ROText; -require Tk::ProgressBar; +#require Tk::ROText; +#require Tk::ProgressBar; require Tk::BrowseEntry; if ($::alternative_selector) { @@ -52,6 +52,7 @@ our %TRANS; require("TeXLive/trans.pl"); load_translations(); +# @fileassocdesc also defined in install-tl $::fileassocdesc[0] = __("None"); $::fileassocdesc[1] = __("Only new"); $::fileassocdesc[2] = __("All"); @@ -59,6 +60,14 @@ $::fileassocdesc[2] = __("All"); $::letterdesc[0] = __('A4'); $::letterdesc[1] = __('letter'); +$::deskintdesc[0] = __("No shortcuts"); +$::deskintdesc[1] = __("TeX Live menu"); +if (win32() && is_vista()) { $::deskintdesc[2] = __("Launcher entry"); } + +# generic option strings: +$::yesno[0] = __('No'); +$::yesno[1] = __('Yes'); + my $mw; my $subframe; my $mainwindow; @@ -116,19 +125,19 @@ $::run_menu = \&run_menu_perltk; # From here on only function definitions # ################################################################## -sub setup_perltk_local_vars { - $portableyesno = ( $vars{'portable'} ? __("Yes") : __("No") ); +sub setup_perltk_local_strings { + $portableyesno = $::yesno[$vars{'portable'}]; $letteryesno = $::letterdesc[$vars{'option_letter'}]; - $fmtyesno = ( $vars{'option_fmt'} ? __("Yes") : __("No") ); - $srcyesno = ( $vars{'option_src'} ? __("Yes") : __("No") ); - $deskintyesno = ( $vars{'option_desktop_integration'} ? __("Yes") : __("No") ); - $pathadjyesno = ( $vars{'option_path'} ? __("Yes") : __("No") ); + $fmtyesno = $::yesno[$vars{'option_fmt'}]; + $srcyesno = $::yesno[$vars{'option_src'}]; + $deskintyesno = $::deskintdesc[$vars{'option_desktop_integration'}]; + $pathadjyesno = $::yesno[$vars{'option_path'}]; $fileassocyesno = $::fileassocdesc[$vars{'option_file_assocs'}]; - $editoryesno = ( $vars{'collection-texworks'} ? __("Yes") : __("No") ); - $adminallyesno = ( $vars{'option_w32_multi_user'} ? __("Yes") : __("No") ); - $docyesno = ( $vars{'option_doc'} ? __("Yes") : __("No") ); - $restrictedyesno = ( $vars{'option_write18_restricted'} ? __("Yes") : __("No") ); - $adjustrepoyesno = ( $vars{'option_adjustrepo'} ? __("Yes") : __("No") ); + $editoryesno = $::yesno[$vars{'collection-texworks'}]; + $adminallyesno = $::yesno[$vars{'option_w32_multi_user'}]; + $docyesno = $::yesno[$vars{'option_doc'}]; + $restrictedyesno = $::yesno[$vars{'option_write18_restricted'}]; + $adjustrepoyesno = $::yesno[$vars{'option_adjustrepo'}]; } sub menu_abort { @@ -136,43 +145,9 @@ sub menu_abort { $mainwindow->destroy; } -sub setup_hooks_perltk { - @::info_hook = (); - push @::info_hook, - sub { - return unless defined $mainwindow; - update_status(join(" ",@_)); - $mainwindow->update; - }; - push @::warn_hook, - sub { - return unless defined $mainwindow ; - update_status(join(" ",@_)); - $mainwindow->update; - }; - @::install_packages_hook = (); - push @::install_packages_hook, \&update_progressbar; - push @::install_packages_hook, - sub { - return unless defined $mainwindow; - return unless defined $::sww; - $mainwindow->update; - $::sww->update; - }; -} - -sub update_status { - my ($p) = @_; - return unless defined $::progressw; - $::progressw->insert("end", "$p"); - $::progressw->see("end"); -} -sub update_progressbar { - my ($n,$total) = @_; - return unless defined $::progress; - if (defined($n) && defined($total)) { - $::progress->value(int($n*100/$total)); - } +sub menu_do_it { + $return = $MENU_INSTALL; + $mainwindow->destroy; } sub disable_buttons { @@ -194,46 +169,46 @@ sub change_button_state { $collection_toggle_button->configure(-state => $what); $portable_toggle_button->configure(-state => $what); $texdir_toggle_button->configure(-state => $what); - $texdir_toggle_button->configure(-state => $what); $paper_toggle_button->configure(-state => $what); $write_eighteen_toggle_button->configure(-state => $what); $format_toggle_button->configure(-state => $what); $adjustrepo_toggle_button->configure(-state => $what); $pathbutton->configure(-state => $what); - $doc_files_toggle_button->configure(-state => $what) if defined($doc_files_toggle_button); - $src_files_toggle_button->configure(-state => $what) if defined($src_files_toggle_button); - $texworks_toggle_button->configure(-state => $what) if defined($texworks_toggle_button); + $doc_files_toggle_button->configure(-state => $what) + if defined($doc_files_toggle_button); + $src_files_toggle_button->configure(-state => $what) + if defined($src_files_toggle_button); + $texworks_toggle_button->configure(-state => $what) + if defined($texworks_toggle_button); } sub run_menu_perltk { if ($::opt_select_repository) { } else { do_remote_init(); - setup_perltk_local_vars(); + setup_perltk_local_strings(); calc_depends(); } $mainwindow = Tk::MainWindow->new; $mainwindow->protocol('WM_DELETE_WINDOW' => \&menu_abort); - setup_hooks_perltk(); # Taco once reported for 2010 that using these scrolled pane # on Windows just died # with the proliferation of netbooks and a new perl installed # let us try to go back to using scrolled pane on both unix and windows - #if (!win32()) { - require Tk::Pane; - $subframe = $mainwindow->Scrolled("Frame", -scrollbars => "oe"); - #} else { - # $subframe = $mainwindow->Frame; - #} + require Tk::Pane; + $subframe = $mainwindow->Scrolled("Frame", -scrollbars => "oe"); $mw = $subframe->Frame; # image frame on the left my $fl = $mw->Frame(-background => "#0078b8"); my $img = $fl->Photo(-format => 'png', -file => "$::installerdir/tlpkg/installer/texlive.png"); - $fl->Label(-image => $img, -background => "#0078b8")->pack(-expand => 1, -fill => "y"); - $fl->Label(-text => "v$::installerrevision/$::menurevision", -background => "#0078b8")->pack; + $fl->Label(-image => $img, -background => "#0078b8") + ->pack(-expand => 1, -fill => "y"); + $fl->Label( + -text => "v$::installerrevision/$::menurevision", + -background => "#0078b8")->pack; # data frame on the right my $fr = $mw->Frame; @@ -242,7 +217,9 @@ sub run_menu_perltk { my $row = 1; - $fr->Label(-text => __("TeX Live %s Installation", $TeXLive::TLConfig::ReleaseYear))->grid(-row => $row, -column => 1, -columnspan => 3); + $fr->Label( + -text => __("TeX Live %s Installation", $TeXLive::TLConfig::ReleaseYear)) + ->grid(-row => $row, -column => 1, -columnspan => 3); if ($::opt_select_repository) { $row++; @@ -266,29 +243,36 @@ sub run_menu_perltk { } } push @mirror_list, __("NETWORK REPOSITORIES"); - push @mirror_list, " " . __("Default remote repository") . ": http://mirror.ctan.org"; + push @mirror_list, + " " . __("Default remote repository") . ": http://mirror.ctan.org"; push @mirror_list, @netlst; push @mirror_list, TeXLive::TLUtils::create_mirror_list(); my $mirror_entry; - $fr->Label(-text => __('Select repository'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $fr->BrowseEntry(-state => 'readonly', - -listheight => 12, - -listwidth => 400, - -width => 35, - -autolistwidth => 1, - -choices => \@mirror_list, - -browsecmd => - sub { - if ($mirror_entry !~ m/^ /) { - $mirror_entry = ""; - } elsif ($mirror_entry =~ m!(http|ftp)://!) { - $mirror_entry = TeXLive::TLUtils::extract_mirror_entry($mirror_entry); - } else { - $mirror_entry =~ s/^\s*//; - # $mirror_entry = TeXLive::TLUtils::extract_mirror_entry($mirror_entry); - } - }, - -variable => \$mirror_entry)->grid(-row => $row, -column => 2, -sticky => 'w'); + $fr->Label( + -text => __('Select repository'), + -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->BrowseEntry( + -state => 'readonly', + -listheight => 12, + -listwidth => 400, + -width => 35, + -autolistwidth => 1, + -choices => \@mirror_list, + -browsecmd => + sub { + if ($mirror_entry !~ m/^ /) { + $mirror_entry = ""; + } elsif ($mirror_entry =~ m!(http|ftp)://!) { + $mirror_entry = + TeXLive::TLUtils::extract_mirror_entry($mirror_entry); + } else { + $mirror_entry =~ s/^\s*//; + # $mirror_entry = + # TeXLive::TLUtils::extract_mirror_entry($mirror_entry); + } + }, + -variable => \$mirror_entry) + ->grid(-row => $row, -column => 2, -sticky => 'w'); $load_remote_button = $fr->Button(-text => __("Load"), -command => sub { $::init_remote_needed = 1; @@ -302,17 +286,20 @@ sub run_menu_perltk { -buttons => [ __("Ok") ])->Show; $mirror_entry = ""; } elsif (!do_version_agree()) { - $fr->Dialog(-title => __("Warning"), - -text => __('The TeX Live versions of the local installation and the repository being accessed are not compatible: + $fr->Dialog( + -title => __("Warning"), + -text => __( + 'The TeX Live versions of the local installation and the repository being accessed are not compatible: local: %s repository: %s -Please select a different mirror.', $TeXLive::TLConfig::ReleaseYear, $texlive_release), +Please select a different mirror.', + $TeXLive::TLConfig::ReleaseYear, $texlive_release), -buttons => [ __("Ok") ])->Show; $mirror_entry = ""; } else { $load_remote_button->configure(-state => 'disable'); final_remote_init($mfull); - setup_perltk_local_vars(); + setup_perltk_local_strings(); calc_depends(); menu_update_texts(); enable_buttons(); @@ -322,34 +309,46 @@ Please select a different mirror.', $TeXLive::TLConfig::ReleaseYear, $texlive_re if (!$vars{'in_place'}) { $row++; - $fr->Label(-text => "------- " . __("Basic Information") . " -------")->grid(-row => $row, -column => 1, -columnspan => 3); + $fr->Label(-text => "------- " . __("Basic Information") . " -------") + ->grid(-row => $row, -column => 1, -columnspan => 3); # binary system line if (!win32()) { $row++; - $fr->Label(-text => __('Binary system(s)'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-text => __('Binary system(s)'), -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); $bintextbutton = $fr->Label(-anchor => 'w'); $bintextbutton->grid(-row => $row, -column => 2, -padx => "2m"); - $bin_toggle_button = $fr->Button(-text => __("Change"), -command => sub { menu_select_binsystems(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $bin_toggle_button = $fr->Button( + -text => __("Change"), -command => sub { menu_select_binsystems(); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); } $row++; # scheme line - $fr->Label(-text => __('Selected scheme'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-text => __('Selected scheme'), -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); $schemebutton = $fr->Label(-anchor => 'w'); $schemebutton->grid(-row => $row, -column => 2, -padx => "2m"); - $scheme_toggle_button = $fr->Button(-text => __("Change"), -command => sub { menu_select_scheme(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $scheme_toggle_button = $fr->Button( + -text => __("Change"), -command => sub { menu_select_scheme(); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); $row++; # further customization - $fr->Label(-text => "------- " . __("Further Customization") . " -------")->grid(-row => $row, -column => 1,-columnspan => 3); + $fr->Label(-text => "------- " . __("Further Customization") . " -------") + ->grid(-row => $row, -column => 1,-columnspan => 3); $row++; # collection line - $fr->Label(-text => __('Installation collections'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $collection_toggle_button = $fr->Button(-text => __("Change"), -command => sub { menu_select_standard_collections(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $fr->Label(-text => __('Installation collections'), -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); + $collection_toggle_button = $fr->Button( + -text => __("Change"), + -command => sub { menu_select_standard_collections(); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); $row++; $collectionstext = $fr->Label(); @@ -358,139 +357,255 @@ Please select a different mirror.', $TeXLive::TLConfig::ReleaseYear, $texlive_re $row++; # further customization - $fr->Label(-text => "------- " . __("Directory setup") . " -------")->grid(-row => $row, -column => 1, -columnspan => 3); + $fr->Label(-text => "------- " . __("Directory setup") . " -------") + ->grid(-row => $row, -column => 1, -columnspan => 3); $row++; - $fr->Label(-text => __('Portable setup'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $fr->Label(-anchor => 'w', -textvariable => \$portableyesno)->grid(-row => $row, -column => 2, -padx => "2m"); - $portable_toggle_button = $fr->Button(-text => __("Toggle"), -command => sub { toggle_portable(); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $fr->Label(-text => __('Portable setup'), -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-anchor => 'w', -textvariable => \$portableyesno) + ->grid(-row => $row, -column => 2, -padx => "2m"); + $portable_toggle_button = $fr->Button( + -text => __("Toggle"), + -command => sub { toggle_portable(); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); $row++; # texdir line - $fr->Label(-text => __('TEXDIR (the main TeX directory)'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $texdirtext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Label(-text => __('TEXDIR (the main TeX directory)'), -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); + $texdirtext = $fr->Label(-anchor => 'w') + ->grid(-row => $row, -column => 2, -padx => "2m"); if (!$vars{'in_place'}) { if ($::alternative_selector) { - $texdir_toggle_button = $fr->Button(-text => __("Change"), -command => sub { menu_edit_texdir("TEXDIR"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $texdir_toggle_button = $fr->Button( + -text => __("Change"), -command => sub { menu_edit_texdir("TEXDIR"); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); } else { - $texdir_toggle_button = $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXDIR"); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $texdir_toggle_button = $fr->Button( + -text => __("Change"), + -command => sub { menu_edit_vars_value("TEXDIR"); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); } } $row++; # texmflocal line - $fr->Label(-text => __('TEXMFLOCAL (directory for site-wide local files)'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $texmflocaltext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); - $tmflocalbutton = $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXMFLOCAL"); }); - $tmflocalbutton -> grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $fr->Label( + -text => __('TEXMFLOCAL (directory for site-wide local files)'), + -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); + $texmflocaltext = $fr->Label(-anchor => 'w') + ->grid(-row => $row, -column => 2, -padx => "2m"); + $tmflocalbutton = $fr->Button( + -text => __("Change"), + -command => sub { menu_edit_vars_value("TEXMFLOCAL"); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); $row++; # texmfsysvar line - $fr->Label(-text => __('TEXMFSYSVAR (directory for autogenerated data)'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $texmfsysvartext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); - $tmfsysvarbutton = $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXMFSYSVAR"); }); - $tmfsysvarbutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $fr->Label( + -text => __('TEXMFSYSVAR (directory for autogenerated data)'), + -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); + $texmfsysvartext = $fr->Label(-anchor => 'w') + ->grid(-row => $row, -column => 2, -padx => "2m"); + $tmfsysvarbutton = $fr->Button( + -text => __("Change"), + -command => sub { menu_edit_vars_value("TEXMFSYSVAR"); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); $row++; # texmfsysconfig line - $fr->Label(-text => __('TEXMFSYSCONFIG (directory for local config)'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $texmfsysconfigtext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); - $tmfsysconfigbutton = $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXMFSYSCONFIG"); }); - $tmfsysconfigbutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $fr->Label( + -text => __('TEXMFSYSCONFIG (directory for local config)'), -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); + $texmfsysconfigtext = $fr->Label(-anchor => 'w') + ->grid(-row => $row, -column => 2, -padx => "2m"); + $tmfsysconfigbutton = $fr->Button( + -text => __("Change"), + -command => sub { menu_edit_vars_value("TEXMFSYSCONFIG"); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); $row++; # texmfhome line - $fr->Label(-text => __('TEXMFHOME (directory for user-specific files)'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $texmfhometext = $fr->Label(-anchor => 'w')->grid(-row => $row, -column => 2, -padx => "2m"); - $tmfhomebutton = $fr->Button(-text => __("Change"), -command => sub { menu_edit_vars_value("TEXMFHOME"); }); - $tmfhomebutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $fr->Label( + -text => __('TEXMFHOME (directory for user-specific files)'), + -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); + $texmfhometext = $fr->Label(-anchor => 'w') + ->grid(-row => $row, -column => 2, -padx => "2m"); + $tmfhomebutton = $fr->Button( + -text => __("Change"), + -command => sub { menu_edit_vars_value("TEXMFHOME"); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); if ($vars{'portable'}) { - for my $b ($tmflocalbutton, $tmfsysvarbutton, $tmfsysconfigbutton, $tmfhomebutton) { + for my $b ( + $tmflocalbutton, $tmfsysvarbutton, $tmfsysconfigbutton, $tmfhomebutton) { $b->configure(-state => 'disabled') } } $row++; # Options - $fr->Label(-text => "------- " . __("Options") . " -------")->grid(-row => $row, -column => 1, -columnspan => 3); + $fr->Label(-text => "------- " . __("Options") . " -------") + ->grid(-row => $row, -column => 1, -columnspan => 3); $row++; # optpaper - $fr->Label(-text => __('Default paper size'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $fr->Label(-anchor => 'w', -textvariable => \$letteryesno)->grid(-row => $row, -column => 2, -padx => "2m"); - $paper_toggle_button = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_letter'}, \$letteryesno, \@::letterdesc); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $fr->Label(-text => __('Default paper size'), -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-anchor => 'w', -textvariable => \$letteryesno) + ->grid(-row => $row, -column => 2, -padx => "2m"); + $paper_toggle_button = $fr->Button( + -text => __("Toggle"), + -command => sub { + toggle_and_set_opt_variable( + \$vars{'option_letter'}, \$letteryesno, \@::letterdesc); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); $row++; - $fr->Label(-text => __('Allow execution of restricted list of programs via \write18'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $fr->Label(-anchor => 'w', -textvariable => \$restrictedyesno)->grid(-row => $row, -column => 2, -padx => "2m"); - $write_eighteen_toggle_button = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_write18_restricted'}, \$restrictedyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $fr->Label( + -text => __('Allow execution of restricted list of programs via \write18'), + -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-anchor => 'w', -textvariable => \$restrictedyesno) + ->grid(-row => $row, -column => 2, -padx => "2m"); + $write_eighteen_toggle_button = $fr->Button( + -text => __("Toggle"), + -command => sub { + toggle_and_set_opt_variable( + \$vars{'option_write18_restricted'}, + \$restrictedyesno); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); $row++; - $fr->Label(-text => __('Create all format files'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $fr->Label(-anchor => 'w', -textvariable => \$fmtyesno)->grid(-row => $row, -column => 2, -padx => "2m"); - $format_toggle_button = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_fmt'}, \$fmtyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $fr->Label( + -text => __('Create all format files'), -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-anchor => 'w', -textvariable => \$fmtyesno) + ->grid(-row => $row, -column => 2, -padx => "2m"); + $format_toggle_button = $fr->Button( + -text => __("Toggle"), + -command => sub { + toggle_and_set_opt_variable(\$vars{'option_fmt'}, \$fmtyesno); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); if ($vars{'doc_splitting_supported'} and !$vars{'in_place'}) { $row++; - $fr->Label(-text => __('Install font/macro doc tree'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $fr->Label(-anchor => 'w', -textvariable => \$docyesno)->grid(-row => $row, -column => 2, -padx => "2m"); - $doc_files_toggle_button = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_doc'}, \$docyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $fr->Label(-text => __('Install font/macro doc tree'), -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-anchor => 'w', -textvariable => \$docyesno) + ->grid(-row => $row, -column => 2, -padx => "2m"); + $doc_files_toggle_button = $fr->Button( + -text => __("Toggle"), + -command => sub { + toggle_and_set_opt_variable(\$vars{'option_doc'}, \$docyesno); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); } if ($vars{'src_splitting_supported'} and !$vars{'in_place'}) { $row++; - $fr->Label(-text => __('Install font/macro source tree'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $fr->Label(-anchor => 'w', -textvariable => \$srcyesno)->grid(-row => $row, -column => 2, -padx => "2m"); - $src_files_toggle_button = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_src'}, \$srcyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $fr->Label(-text => __('Install font/macro source tree'), -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-anchor => 'w', -textvariable => \$srcyesno) + ->grid(-row => $row, -column => 2, -padx => "2m"); + $src_files_toggle_button = $fr->Button( + -text => __("Toggle"), + -command => sub { + toggle_and_set_opt_variable(\$vars{'option_src'}, \$srcyesno); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); } $row++; - $fr->Label(-text => (win32()) ? __('Adjust PATH setting in registry') : - __('Create symlinks in system directories'), - -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $fr->Label(-anchor => 'w', -textvariable => \$pathadjyesno)->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Label( + -text => (win32()) ? __('Adjust PATH setting in registry') : + __('Create symlinks in system directories'), + -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-anchor => 'w', -textvariable => \$pathadjyesno) + ->grid(-row => $row, -column => 2, -padx => "2m"); if (unix()) { - $pathbutton = $fr->Button(-text => __("Change"), -command => sub { menu_select_symlink(); }); + $pathbutton = $fr->Button( + -text => __("Change"), -command => sub { menu_select_symlink(); }); } else { - $pathbutton = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_path'}, \$pathadjyesno); }); + $pathbutton = $fr->Button( + -text => __("Toggle"), + -command => sub { + toggle_and_set_opt_variable(\$vars{'option_path'}, \$pathadjyesno); }); } $pathbutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); if ($::opt_all_options || win32()) { $row++; - $fr->Label(-text => __('Add menu shortcuts'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $fr->Label(-anchor => 'w', -textvariable => \$deskintyesno)->grid(-row => $row, -column => 2, -padx => "2m"); - $deskintbutton = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_desktop_integration'}, \$deskintyesno); }); - $deskintbutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $fr->Label(-text => __('Add menu shortcuts'), -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-anchor => 'w', -textvariable => \$deskintyesno) + ->grid(-row => $row, -column => 2, -padx => "2m"); + $deskintbutton = $fr->Button( + -text => __("Change"), + -command => sub { + toggle_and_set_opt_variable( + \$vars{'option_desktop_integration'}, + \$deskintyesno, \@::deskintdesc); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); $row++; - $fr->Label(-text => __('Change file associations'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $fr->Label(-anchor => 'w', -textvariable => \$fileassocyesno)->grid(-row => $row, -column => 2, -padx => "2m"); - $assocbutton = $fr->Button(-text => __("Change"), -command => sub { menu_edit_file_assocs(); }); - $assocbutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $fr->Label(-text => __('Change file associations'), -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-anchor => 'w', -textvariable => \$fileassocyesno) + ->grid(-row => $row, -column => 2, -padx => "2m"); + $assocbutton = $fr->Button( + -text => __("Change"), + -command => sub { + toggle_and_set_opt_variable( + \$vars{'option_file_assocs'}, \$fileassocyesno, \@::fileassocdesc); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); if ($::opt_all_options || admin()) { $row++; - $fr->Label(-text => __('Installation for all users'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $fr->Label(-anchor => 'w', -textvariable => \$adminallyesno)->grid(-row => $row, -column => 2, -padx => "2m"); - $adminbutton = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_w32_multi_user'}, \$adminallyesno); }); - $adminbutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $fr->Label(-text => __('Installation for all users'), -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-anchor => 'w', -textvariable => \$adminallyesno) + ->grid(-row => $row, -column => 2, -padx => "2m"); + $adminbutton = $fr->Button( + -text => __("Toggle"), + -command => sub { + toggle_and_set_opt_variable( + \$vars{'option_w32_multi_user'}, \$adminallyesno); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); } $row++; - $fr->Label(-text => __('Install TeXworks front end'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $fr->Label(-anchor => 'w', -textvariable => \$editoryesno)->grid(-row => $row, -column => 2, -padx => "2m"); + $fr->Label(-text => __('Install TeXworks front end'), -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-anchor => 'w', -textvariable => \$editoryesno) + ->grid(-row => $row, -column => 2, -padx => "2m"); if (!$vars{'in_place'}) { - $texworks_toggle_button = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'collection-texworks'}, \$editoryesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $texworks_toggle_button = $fr->Button( + -text => __("Toggle"), + -command => sub { + toggle_and_set_opt_variable( + \$vars{'collection-texworks'}, \$editoryesno); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); } } if ($media ne 'NET') { $row++; - $fr->Label(-text => __('After installation, get package updates from CTAN'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w'); - $fr->Label(-anchor => 'w', -textvariable => \$adjustrepoyesno)->grid(-row => $row, -column => 2, -padx => "2m"); - $adjustrepo_toggle_button = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_adjustrepo'}, \$adjustrepoyesno); })->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); + $fr->Label( + -text => __('After installation, get package updates from CTAN'), + -anchor => 'w') + ->grid(-row => $row, -column => 1, -sticky => 'w'); + $fr->Label(-anchor => 'w', -textvariable => \$adjustrepoyesno) + ->grid(-row => $row, -column => 2, -padx => "2m"); + $adjustrepo_toggle_button = $fr->Button( + -text => __("Toggle"), + -command => sub { + toggle_and_set_opt_variable( + \$vars{'option_adjustrepo'}, \$adjustrepoyesno); }) + ->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m"); } if ($vars{'portable'}) { @@ -516,17 +631,17 @@ Licensed under the GNU General Public License version 2 or higher In case of problems, please contact: texlive\@tug.org" )->pack(-ipadx => "2m", -ipady => "2m"); $sw->Show; - })->pack(-side => 'left', -padx => "2m", -pady => "2m"); - + })->pack(-side => 'left', -padx => "2m", -pady => "2m"); + $installbutton = $f3->Button( -text => __("Install TeX Live"), - -command => sub { installation_window(); }); - $installbutton->pack(-side => 'left', -padx => "2m", -pady => "2m")->focus(); + -command => \&menu_do_it + )->pack(-side => 'left', -padx => "2m", -pady => "2m")->focus(); my $quitbutton = $f3->Button( -text => __("Quit"), - -command => \&menu_abort, + -command => \&menu_abort )->pack(-side => 'right', -padx => "2m", -pady => "2m"); $mw->bind('<Escape>', [ $quitbutton, 'Invoke' ]); #my $wizardbutton = $f3->Button( @@ -550,7 +665,8 @@ In case of problems, please contact: texlive\@tug.org" my $rh = $mw->reqheight; my $rw = $mw->reqwidth; my $maxheight = $mainwindow->screenheight() - 20; - debug("Requested height: $rh, requested width: $rw, max height: $maxheight\n"); + debug( + "Requested height: $rh, requested width: $rw, max height: $maxheight\n"); if ($rh > $maxheight) { $rh = $maxheight; $rw += 20; # for the scrollbar = = @@ -561,20 +677,18 @@ In case of problems, please contact: texlive\@tug.org" $mainwindow->geometry("=${rw}x${rh}"); #$mw->pack(-expand => 1, -fill => "both"); - pre_warn($mainwindow) if win32(); + if (win32() && pre_warn($mainwindow)) { return $MENU_ABORT; } Tk::MainLoop(); return($return); } -sub pre_warn() { +sub pre_warn { my $parent = shift; require TeXLive::TLWinGoo; - my $pre_warning = $parent->Toplevel(); - $pre_warning->title( - __("TeX Live %s Installation", $TeXLive::TLConfig::ReleaseYear)); - my $wrn = __('Best to disable your virus scanner during installation.'); - + my ($b_quit, $b_cont) = (__('Quit'), __('Continue')); + my $wrn = __( + 'In case of trouble, try disabling your virus scanner during installation.'); if (!admin()) { $wrn .= "\n\n". __("The installer does not have adminstrative permissions;\nso can only install for current user."); @@ -583,62 +697,12 @@ sub pre_warn() { __("Right-click install-tl-advanced and select \"run as administrator\"\n if you want to install for all users."); } } - $pre_warning->Label(-textvariable=>\$wrn, -justify=>'left')->pack(); - my $sf = $pre_warning->Frame; - $sf->Button(-text=>__('Quit'), -command=>sub{exit()})->pack(-side=>'left'); - $sf->Button(-text=>__('Continue'), -command=>sub{ - $parent->deiconify(); - $parent->raise; - $pre_warning->withdraw(); - })->pack(-side=>'right'); - $sf->pack(-fill => 'x'); -} - -sub installation_window { - # create a progress bar window - $::sww = $mainwindow->Toplevel(-title => __("Installation process"), - -width => 400); - $::sww->transient($mainwindow); - $::sww->grab(); - $::sww->Label(-text => __("Installation process"))->pack; - $::progressw = $::sww->Scrolled("ROText", -scrollbars => "e", -height => 16); - $::progressw->pack(-expand => 1, -fill => "both"); - my $percent_done = 0; - $::progress = $::sww->ProgressBar(-variable => \$percent_done, - -width => 20, -length => 400, -from => 0, -to => 100, -blocks => 10, - -colors => [ 0, '#0078b8' ]); - $::progress->pack(-fill => "x"); - my $f = $::sww->Frame; - my $b = $f->Button(-text => __("Cancel"), - -command => sub { $::sww->destroy; $mainwindow->destroy; - do_cleanup(); exit(1); } - )->pack(-pady => "2m"); - $b->focus(); - $f->pack; - do_installation(); - $return = $MENU_ALREADYDONE; - my $t = __("See %s/index.html for links to documentation.\nThe TeX Live web site (http://tug.org/texlive/) contains any updates and corrections. 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 groups is available on the web at http://tug.org/usergroups.html.", $::vars{'TEXDIR'}); - if (!win32()) { - $t .= "\n\n" . __("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'}); - } - if (@::WARNLINES) { - $t .= "\n\n" . __("There were some warnings during the installation process.\nHere is the list of warning messages:") . "\n"; - $t .= join('', @::WARNLINES); - $t =~ s/\n\z//; - } - - $t .= "\n\n" . __("Welcome to TeX Live!"); - #$t =~ s/\\n/\n/g; - $::progressw->insert("end", "\n"); - my $linechar = $::progressw->index("end"); - $::progressw->markSet("finaltext", $linechar); - $::progressw->markGravity("finaltext", "left"); - $::progressw->insert("end", "\n$t"); - $::progressw->see("end"); - $::progressw->tagAdd("centered", $linechar, "end"); - $::progressw->tagConfigure("centered", -justify => "center"); - $b->configure(-text => __("Finish"), - -command => sub { $mainwindow->destroy; }); + my $ans = $parent->Dialog( + -title => __("TeX Live %s Installation", $TeXLive::TLConfig::ReleaseYear), + -text => $wrn, + -default_button => $b_cont, + -buttons => [$b_quit, $b_cont])->Show(); + return $ans eq $b_quit; } # this sub will not be called if $vars{'in_place'} @@ -681,19 +745,31 @@ sub menu_edit_texdir { my $sw = $mainwindow->Toplevel(-title => __("Change variable value")); $sw->transient($mainwindow); $sw->grab(); - $sw->Label(-text => __("Enter path for %s (use ~ for %s)", $key, $hint_var))->pack(-padx => "2m", -pady => "2m"); + $sw->Label(-text => __("Enter path for %s (use ~ for %s)", $key, $hint_var)) + ->pack(-padx => "2m", -pady => "2m"); $entry = $sw->Entry(-width => 60)->pack(-padx => "2m", -pady => "2m"); my $f = $sw->Frame; - my $c1 = $f->Checkbutton(-text => 'Add "texlive"', -variable => \$addtexlive, + my $c1 = $f->Checkbutton( + -text => 'Add "texlive"', + -variable => \$addtexlive, -command => \&update_label); - my $c2 = $f->Checkbutton(-text => "Add \"$texlive_release\"", -variable => \$addyear, + my $c2 = $f->Checkbutton( + -text => "Add \"$texlive_release\"", -variable => \$addyear, -command => \&update_label); - my $foo = $sw->Scrolled("DirTree", -scrollbars => "osoe", - -browsecmd => sub { my ($d) = @_; $currsel = $d; update_label(); }, - -directory => "$currsel"); + my $foo = $sw->Scrolled( + "DirTree", -scrollbars => "osoe", + -browsecmd => sub { my ($d) = @_; $currsel = $d; update_label(); }, + -directory => "$currsel"); my $ff = $sw->Frame; - my $ok = $ff->Button(-text => __("Ok"), -command => sub { $val = $entry->get; callback_edit_directories($key,$val); $sw->destroy; }); - my $cancel = $ff->Button(-text => __("Cancel"), -command => sub { $sw->destroy; }); + my $ok = $ff->Button( + -text => __("Ok"), + -command => sub { + $val = $entry->get; + callback_edit_directories($key,$val); + $sw->destroy; }); + my $cancel = $ff->Button( + -text => __("Cancel"), + -command => sub { $sw->destroy; }); update_label(); $c1->pack(-side => "left", -padx => "2m", -pady => "2m"); $c2->pack(-side => "right", -padx => "2m", -pady => "2m"); @@ -719,56 +795,28 @@ sub menu_edit_vars_value { } else { $hint_var = win32() ? '%USERPROFILE%' : '$HOME'; } - $sw->Label(-text => __("Enter path for %s (use ~ for %s)", $key, $hint_var))->pack(-padx => "2m", -pady => "2m"); + $sw->Label(-text => __("Enter path for %s (use ~ for %s)", $key, $hint_var)) + ->pack(-padx => "2m", -pady => "2m"); my $entry = $sw->Entry(-text => native_slashify($val), -width => 60); $entry->pack(-padx => "2m", -pady => "2m")->focus(); my $f = $sw->Frame; - my $okbutton = $f->Button(-text => __("Ok"), - -command => sub { $val = forward_slashify($entry->get); callback_edit_directories($key,$val) ; $sw->destroy })->pack(-side => 'left', -padx => "2m", -pady => "2m"); - my $cancelbutton = $f->Button(-text => __("Cancel"), - -command => sub { $sw->destroy })->pack(-side => 'right', -padx => "2m", -pady => "2m"); + my $okbutton = $f->Button( + -text => __("Ok"), + -command => sub { + $val = forward_slashify($entry->get); + callback_edit_directories($key,$val) ; + $sw->destroy }) + ->pack(-side => 'left', -padx => "2m", -pady => "2m"); + my $cancelbutton = $f->Button( + -text => __("Cancel"), + -command => sub { $sw->destroy }) + ->pack(-side => 'right', -padx => "2m", -pady => "2m"); $f->pack(-expand => 'x'); # bindings $sw->bind('<Return>' => [ $okbutton, 'Invoke']); $sw->bind('<Escape>' => [ $cancelbutton, 'Invoke']); } -sub menu_edit_file_assocs { - my $sw = $mainwindow->Toplevel(-title => __('Change file associations')); - $sw->transient($mainwindow); - $sw->grab(); - my $key = 'option_file_assocs'; - my $var = $::fileassocdesc[$vars{$key}]; - $sw->Label(-text => __("Change file associations"))->pack(-padx => "2m", -pady => "2m"); - my $opt = $sw->BrowseEntry(-autolistwidth => 1, - -variable => \$var); - for my $i (0..2) { - $opt->insert("end", $::fileassocdesc[$i]); - } - - $opt->pack(-padx => "2m", -pady => "2m")->focus(); - my $f = $sw->Frame; - my $okbutton = $f->Button(-text => __("Ok"), - -command => sub { - my $idx; - if ($var eq $::fileassocdesc[0]) { - $idx = 0; - } elsif ($var eq $::fileassocdesc[1]) { - $idx = 1; - } elsif ($var eq $::fileassocdesc[2]) { - $idx = 2; - } else { - die "How that could happen!\n"; - } - $vars{$key} = $idx; - $fileassocyesno = $::fileassocdesc[$idx]; - $sw->destroy; })->pack(-side => "left", -padx => "2m", -pady => "2m"); - my $cancelbutton = $f->Button(-text => __("Cancel"), -command => sub { $sw->destroy; })->pack(-side => "left", -padx => "2m", -pady => "2m"); - $f->pack; - $sw->bind('<Return>', [ $okbutton, 'Invoke' ]); - $sw->bind('<Escape>', [ $cancelbutton, 'Invoke' ]); -} - sub menu_select_scheme { my $sw = $mainwindow->Toplevel(-title => __('Selected scheme')); @@ -785,7 +833,8 @@ sub menu_select_scheme { my @scheme_order = schemes_ordered_for_presentation(); push @scheme_order, "scheme-custom"; my $selected = $vars{'selected_scheme'}; - $sw->Label(-text => __("Selected scheme"))->pack(-padx => "2m", -pady => "2m"); + $sw->Label(-text => __("Selected scheme")) + ->pack(-padx => "2m", -pady => "2m"); my $f2 = $sw->Frame; foreach my $scheme (@scheme_order) { my $desc; @@ -796,19 +845,24 @@ sub menu_select_scheme { $desc = __("custom selection of collections"); } my $b; - $b = $f2->Radiobutton(-variable => \$selected, -value => $scheme, + $b = $f2->Radiobutton( + -variable => \$selected, -value => $scheme, -text => __($desc), - -justify => 'left', -wraplength => 500)->pack(-anchor => 'w', -pady => "1m"); + -justify => 'left', -wraplength => 500) + ->pack(-anchor => 'w', -pady => "1m"); if ($selected eq $scheme) { $b->focus(); } } $f2->pack; my $f3 = $sw->Frame; - my $okbutton = $f3->Button(-text => __("Ok"), - -command => sub { callback_select_scheme($selected) ; $sw->destroy })->pack(-side => 'left', -padx => "2m", -pady => "2m"); - my $cancelbutton = $f3->Button(-text => __("Cancel"), - -command => sub { $sw->destroy })->pack(-side => 'left', -padx => "2m", -pady => "2m"); + my $okbutton = $f3->Button( + -text => __("Ok"), + -command => sub { callback_select_scheme($selected) ; $sw->destroy }) + ->pack(-side => 'left', -padx => "2m", -pady => "2m"); + my $cancelbutton = $f3->Button( + -text => __("Cancel"), -command => sub { $sw->destroy }) + ->pack(-side => 'left', -padx => "2m", -pady => "2m"); $f3->pack(-expand => 'x'); $sw->bind('<Return>' => [ $okbutton, 'Invoke']); $sw->bind('<Escape>' => [ $cancelbutton, 'Invoke']); @@ -825,18 +879,25 @@ sub menu_select_standard_collections { my $f2 = $fb->Frame; my $f3 = $fb->Frame; my %lvars = %vars; - $sw->Label(-text => __("Select the collections to be installed"))->pack(-padx => "2m", -pady => "2m"); + $sw->Label(-text => __("Select the collections to be installed")) + ->pack(-padx => "2m", -pady => "2m"); my $onethirdcol = $#collections_std / 3; my $twothirdcol = 2 * $onethirdcol; my $i = 0; foreach my $coll (sort @collections_std) { my $tlpobj = $tlpdb->get_package("$coll"); if ($i < $onethirdcol) { - $f1->Checkbutton(-variable => \$lvars{$coll}, -text => __($tlpobj->shortdesc))->pack(-anchor => 'w'); + $f1->Checkbutton( + -variable => \$lvars{$coll}, -text => __($tlpobj->shortdesc)) + ->pack(-anchor => 'w'); } elsif ($i < $twothirdcol) { - $f2->Checkbutton(-variable => \$lvars{$coll}, -text => __($tlpobj->shortdesc))->pack(-anchor => 'w'); + $f2->Checkbutton( + -variable => \$lvars{$coll}, -text => __($tlpobj->shortdesc)) + ->pack(-anchor => 'w'); } else { - $f3->Checkbutton(-variable => \$lvars{$coll}, -text => __($tlpobj->shortdesc))->pack(-anchor => 'w'); + $f3->Checkbutton( + -variable => \$lvars{$coll}, -text => __($tlpobj->shortdesc)) + ->pack(-anchor => 'w'); } $i++; } @@ -845,10 +906,14 @@ sub menu_select_standard_collections { $f3->pack(-side => 'left', -padx => "2m", -pady => "2m"); $fb->pack(-padx => "2m", -pady => "2m"); $fc->pack(-side => 'left', -expand => 'x', -padx => "2m", -pady => "2m"); - $fc->Button(-text => __("Select All"), - -command => sub { select_collections(\%lvars, @collections_std) })->pack(-side => 'left', -padx => "2m", -pady => "2m")->focus(); - $fc->Button(-text => __("Deselect All"), - -command => sub { deselect_collections(\%lvars, @collections_std) })->pack(-side => 'right', -padx => "2m", -pady => "2m"); + $fc->Button( + -text => __("Select All"), + -command => sub { select_collections(\%lvars, @collections_std) }) + ->pack(-side => 'left', -padx => "2m", -pady => "2m")->focus(); + $fc->Button( + -text => __("Deselect All"), + -command => sub { deselect_collections(\%lvars, @collections_std) }) + ->pack(-side => 'right', -padx => "2m", -pady => "2m"); $fd->pack(-side => 'left', -expand => 'x', -padx => "2m", -pady => "2m"); my $okbutton = $fd->Button(-text => __("Ok"), -command => sub { @@ -866,8 +931,9 @@ sub menu_select_standard_collections { } $sw->destroy; })->pack(-side => 'left', -padx => "2m", -pady => "2m"); - my $cancelbutton = $fd->Button(-text => __("Cancel"), - -command => sub { $sw->destroy })->pack(-side => 'right', -padx => "2m", -pady => "2m"); + my $cancelbutton = $fd->Button( + -text => __("Cancel"), -command => sub { $sw->destroy }) + ->pack(-side => 'right', -padx => "2m", -pady => "2m"); $sw->bind('<Return>' => [ $okbutton, 'Invoke']); $sw->bind('<Escape>' => [ $cancelbutton, 'Invoke']); } @@ -905,15 +971,15 @@ sub menu_select_symlink { $vars{'option_path'} = $osym; toggle_and_set_opt_variable(\$vars{'option_path'}, \$pathadjyesno); } - my $sw = $mainwindow->Toplevel(-title => __('Create symlinks in system directories')); + my $sw = $mainwindow->Toplevel( + -title => __('Create symlinks in system directories')); $sw->transient($mainwindow); $sw->grab(); - $sw->Checkbutton(-variable => \$osym, - -text => __("create symlinks in standard directories"), - -command => sub { set_unset_buttons(); } )->grid(-column => 1, - -row => 1, - -columnspan => 2, - -padx => "2m"); + $sw->Checkbutton( + -variable => \$osym, + -text => __("create symlinks in standard directories"), + -command => sub { set_unset_buttons(); } ) + ->grid(-column => 1, -row => 1, -columnspan => 2, -padx => "2m"); $binlab = $sw->Label(-text => __("binaries to")); $binb = $sw->Entry(-textvariable => \$lbin); $manlab = $sw->Label(-text => __("manpages to")); @@ -928,8 +994,9 @@ sub menu_select_symlink { $infob->grid(-row => 4, -column => 2, -sticky => "ew", -padx => "2m"); set_unset_buttons(); my $f2 = $sw->Frame; $f2->grid(-column => 1, -columnspan => 2, -row => 5); - my $okbutton = $f2->Button(-text => __("Ok"), - -command => sub { return_callback(); $sw->destroy })->pack(-side => 'left'); + my $okbutton = $f2->Button( + -text => __("Ok"), -command => sub { return_callback(); $sw->destroy }) + ->pack(-side => 'left'); my $cancelbutton = $f2->Button(-text => __("Cancel"), -command => sub { $sw->destroy })->pack(-side => 'right'); $sw->bind('<Return>' => [ $okbutton, 'Invoke']); @@ -959,10 +1026,14 @@ sub menu_select_binsystems { $f2l->pack(-side => 'left'); $f2->pack(-padx => "2m", -pady => "2m"); my $f3 = $sw->Frame; - my $okbutton = $f3->Button(-text => __("Ok"), - -command => sub { callback_select_systems() ; $sw->destroy })->pack(-side => 'left', -padx => "2m", -pady => "2m"); - my $cancelbutton = $f3->Button(-text => __("Cancel"), - -command => sub { $sw->destroy })->pack(-side => 'right', -padx => "2m", -pady => "2m"); + my $okbutton = $f3->Button( + -text => __("Ok"), + -command => sub { callback_select_systems() ; $sw->destroy }) + ->pack(-side => 'left', -padx => "2m", -pady => "2m"); + my $cancelbutton = $f3->Button( + -text => __("Cancel"), + -command => sub { $sw->destroy }) + ->pack(-side => 'right', -padx => "2m", -pady => "2m"); $f3->pack(-expand => 'x'); $sw->bind('<Return>' => [ $okbutton, 'Invoke']); $sw->bind('<Escape>' => [ $cancelbutton, 'Invoke']); @@ -974,9 +1045,10 @@ sub check_on_removal { if (!$vars{"binary_$a"} && $a eq $vars{'this_platform'}) { # removal not supported $vars{"binary_$a"} = 1; - $arch_frame->Dialog(-title => __("Warning"), - -text => __("Removals of the main platform not possible!"), - -buttons => [ __("Ok") ])->Show; + $arch_frame->Dialog( + -title => __("Warning"), + -text => __("Removals of the main platform not possible!"), + -buttons => [ __("Ok") ])->Show; } } @@ -1007,7 +1079,10 @@ sub menu_set_binbutton_text { } menu_set_text($bintextbutton, $selsys); } else { - menu_set_text($bintextbutton, __("%s out of %s", $vars{'n_systems_selected'}, $vars{'n_systems_available'})); + menu_set_text( + $bintextbutton, __( + "%s out of %s", $vars{'n_systems_selected'}, + $vars{'n_systems_available'})); } } } @@ -1020,32 +1095,51 @@ sub menu_set_collections_text { sub menu_set_pathes_text { if (TeXLive::TLUtils::texdir_check($vars{'TEXDIR'})) { - menu_set_text($texdirtext, native_slashify($vars{'TEXDIR'}), -foreground => "black"); + menu_set_text( + $texdirtext, native_slashify($vars{'TEXDIR'}), + -foreground => "black"); } else { - menu_set_text($texdirtext, __("(default not allowed or not writable - please change!)"), -foreground => "red"); + menu_set_text( + $texdirtext, + __("(default not allowed or not writable - please change!)"), + -foreground => "red"); } menu_set_text($texmflocaltext, native_slashify($vars{'TEXMFLOCAL'})); if ((-w $vars{'TEXMFSYSVAR'}) || (-w dirname($vars{'TEXMFSYSVAR'}))) { - menu_set_text($texmfsysvartext, native_slashify($vars{'TEXMFSYSVAR'}), -foreground => "black"); + menu_set_text( + $texmfsysvartext, native_slashify($vars{'TEXMFSYSVAR'}), + -foreground => "black"); } elsif ("$vars{'TEXMFSYSVAR'}" =~ m;^$vars{'TEXDIR'};) { if (TeXLive::TLUtils::texdir_check($vars{'TEXDIR'})) { - menu_set_text($texmfsysvartext, native_slashify($vars{'TEXMFSYSVAR'}), -foreground => "black"); + menu_set_text( + $texmfsysvartext, native_slashify($vars{'TEXMFSYSVAR'}), + -foreground => "black"); } else { - menu_set_text($texmfsysvartext, __("(please change TEXDIR first!)"), -foreground => "red"); + menu_set_text( + $texmfsysvartext, __("(please change TEXDIR first!)"), + -foreground => "red"); } } else { - menu_set_text($texmfsysvartext, __("(default not writable - please change!)")); + menu_set_text( + $texmfsysvartext, __("(default not writable - please change!)")); } if ((-w $vars{'TEXMFSYSCONFIG'}) || (-w dirname($vars{'TEXMFSYSCONFIG'}))) { - menu_set_text($texmfsysconfigtext, native_slashify($vars{'TEXMFSYSCONFIG'}), -foreground => "black"); + menu_set_text( + $texmfsysconfigtext, native_slashify($vars{'TEXMFSYSCONFIG'}), + -foreground => "black"); } elsif ("$vars{'TEXMFSYSCONFIG'}" =~ m;^$vars{'TEXDIR'};) { if (TeXLive::TLUtils::texdir_check($vars{'TEXDIR'})) { - menu_set_text($texmfsysconfigtext, native_slashify($vars{'TEXMFSYSCONFIG'}), -foreground => "black"); + menu_set_text( + $texmfsysconfigtext, native_slashify($vars{'TEXMFSYSCONFIG'}), + -foreground => "black"); } else { - menu_set_text($texmfsysconfigtext, __("(please change TEXDIR first!)"), -foreground => "red"); + menu_set_text( + $texmfsysconfigtext, __("(please change TEXDIR first!)"), + -foreground => "red"); } } else { - menu_set_text($texmfsysconfigtext, __("(default not writable - please change!)")); + menu_set_text( + $texmfsysconfigtext, __("(default not writable - please change!)")); } menu_set_text($texmfhometext, native_slashify($vars{'TEXMFHOME'})); } @@ -1128,11 +1222,11 @@ sub callback_edit_var() { menu_update_texts(); } -sub dump_vars_stdout { - foreach my $k (keys %vars) { - print "DEBUG: vars{$k} = $vars{$k}\n"; - } -} +#sub dump_vars_stdout { +# foreach my $k (keys %vars) { +# print "DEBUG: vars{$k} = $vars{$k}\n"; +# } +#} sub toggle_portable { my $td = $vars{'TEXDIR'}; @@ -1141,8 +1235,9 @@ sub toggle_portable { $vars{'portable'} = 0; $portableyesno = __('No'); # enable some buttons - for $b ($tmflocalbutton, $tmfsysvarbutton, $tmfsysconfigbutton, $tmfhomebutton) { - $b->configure(-state => 'normal'); + for $b ( + $tmflocalbutton, $tmfsysvarbutton, $tmfsysconfigbutton, $tmfhomebutton) { + $b->configure(-state => 'normal'); } for $b ($pathbutton, $deskintbutton, $assocbutton, $adminbutton) { $b->configure(-state => 'normal') if $b; @@ -1151,8 +1246,9 @@ sub toggle_portable { $vars{'portable'} = 1; $portableyesno = __('Yes'); # disable some buttons. These should get a name first. - for $b ($tmflocalbutton, $tmfsysvarbutton, $tmfsysconfigbutton, $tmfhomebutton) { - $b->configure(-state => 'disabled'); + for $b ( + $tmflocalbutton, $tmfsysvarbutton, $tmfsysconfigbutton, $tmfhomebutton) { + $b->configure(-state => 'disabled'); } $vars{'option_path'} = 0; $vars{'option_desktop_integration'} = 0; @@ -1169,18 +1265,24 @@ sub toggle_portable { set_texlive_default_dirs(); # this sub tests for portable and in_place $mw -> messageBox( -title => __('Warning'), - -message => __("Portable option changed;\nDirectories have been reinitialized"), + -message => + __("Portable option changed;\nDirectories have been reinitialized"), -type => 'OK', -icon => 'warning'); menu_set_pathes_text(); # same for some options } sub toggle_and_set_opt_variable { + # $varsref: the variable to be changed + # $toggleref: the string representation of the value of $varsref; + # $choicesref: array ref of possible values for $toggleref my ($varsref, $toggleref, $choicesref) = @_; - my ($no, $yes) = $choicesref ? @$choicesref : (__('No'), __('Yes')); - $$toggleref = ($$toggleref eq $yes) ? $no : $yes; - $$varsref = 0; - $$varsref = 1 if ($$toggleref eq $yes); + $choicesref = \@::yesno unless defined $choicesref; + + my $n_opts = @$choicesref; + $$varsref += 1; + $$varsref = 0 if $$varsref >= $n_opts; + $$toggleref = $$choicesref[$$varsref]; calc_depends(); menu_update_texts(); } diff --git a/Master/tlpkg/installer/install-menu-text.pl b/Master/tlpkg/installer/install-menu-text.pl index 2571420daaa..3b7f192b5cd 100644 --- a/Master/tlpkg/installer/install-menu-text.pl +++ b/Master/tlpkg/installer/install-menu-text.pl @@ -32,10 +32,14 @@ my $ptoggle_alert = "\n". " !! Portable option changed;\n" . " !! Directories have been reinitialized!\n"; -# issue welcome message on end of installation -push @::end_install_hook, - sub { if (win32()) { print TeXLive::TLUtils::welcome(); } - else { print TeXLive::TLUtils::welcome_paths(); } }; +# @fileassocdesc also defined in install-tl +$::fileassocdesc[0] = "None"; +$::fileassocdesc[1] = "Only new"; +$::fileassocdesc[2] = "All"; + +$::deskintdesc[0] = "None"; +$::deskintdesc[1] = "Menu shortcuts"; +if (win32() && is_vista()) { $::deskintdesc[2] = "Launcher"; } sub clear_screen { return 0 if ($::opt_no_cls); @@ -47,9 +51,21 @@ sub string_to_list { return split(//, $string); } -sub button { +sub button { # for main menu: 1 char + my $val=shift; + my $vals=shift; # array ref to descriptions of possible values + if (defined $vals) { + return "[$val]"; + } else { # just yes/no + return ($val)? '[X]':'[ ]'; + } +} + +sub obutton { # for options menu: more chars allowed my $val=shift; - return ($val)? '[X]':'[ ]'; + my $vals=shift; # array ref to descriptions of possible values + $vals = [' ', 'x'] unless defined $vals; + return "[$$vals[$val]]"; } sub hbar { @@ -58,7 +74,11 @@ sub hbar { sub toggle { my $var=shift; - $vars{$var} = ($vars{$var} ? 0 : 1); + my $vals=shift; # array ref to descriptions of possible values + $vals = [' ', 'x'] unless defined $vals; + my $n_vals = @$vals; + $vars{$var} += 1; + $vars{$var} = 0 unless $vars{$var} < $n_vals; } sub menu_head { @@ -736,16 +756,17 @@ sub help_menu { sub options_menu { - my $b_path=button($vars{'option_path'}); - my $b_doc=button($vars{'option_doc'}); - my $b_src=button($vars{'option_src'}); - my $b_fmt=button($vars{'option_fmt'}); - my $b_letter=button($vars{'option_letter'}); - my $b_adjustrepo=button($vars{'option_adjustrepo'}); - my $b_deskint=button($vars{'option_desktop_integration'}); - my $b_admin=button($vars{'option_w32_multi_user'}); - my $b_addoneditor=button($vars{'collection-texworks'}); - my $b_restricted=button($vars{'option_write18_restricted'}); + my $b_path=obutton($vars{'option_path'}); + my $b_doc=obutton($vars{'option_doc'}); + my $b_src=obutton($vars{'option_src'}); + my $b_fmt=obutton($vars{'option_fmt'}); + my $b_letter=obutton($vars{'option_letter'}); + my $b_adjustrepo=obutton($vars{'option_adjustrepo'}); + my $b_deskint=obutton( + $vars{'option_desktop_integration'}, \@::deskintdesc); + my $b_admin=obutton($vars{'option_w32_multi_user'}); + my $b_addoneditor=obutton($vars{'collection-texworks'}); + my $b_restricted=obutton($vars{'option_write18_restricted'}); my $sys_bin=$vars{'option_sys_bin'}; my $sys_man=$vars{'option_sys_man'}; @@ -791,9 +812,11 @@ EOF EOF ; } - if (win32() || $::opt_all_options) { - print " <M> create Start menu shortcuts: $b_deskint\n"; - print " <N> update file associations: [$::fileassocdesc[$vars{'option_file_assocs'}]]\n"; + if ((win32() && !$vars{'portable'}) || $::opt_all_options) { + print " <M> Start menu shortcuts / launcher: ".obutton( + $vars{'option_desktop_integration'}, \@::deskintdesc)."\n"; + print " <N> update file associations: ".obutton( + $vars{'option_file_assocs'}, \@::fileassocdesc)."\n"; if ($::opt_all_options || TeXLive::TLWinGoo::admin()) { # if we are admin we allow normal user installation, too print " <U> make installation available to all users: $b_admin\n"; @@ -851,34 +874,42 @@ EOF } } - # option_desktop_integration, option_file_assocs - - if (win32() || $::opt_all_options) { - if ("\u$answer" eq 'M' and !$vars{'portable'}) { - toggle 'option_desktop_integration'; - return $command{'self'}; +# # option_desktop_integration, option_file_assocs +# +# if (win32() || $::opt_all_options) { +# if ("\u$answer" eq 'M' and !$vars{'portable'}) { +# toggle 'option_desktop_integration'; +# return $command{'self'}; +# +# } elsif ("\u$answer" eq 'N' and !$vars{'portable'}) { +# print "New value for file_assocs:\n"; +# print " 0 -- don't tweak the file associations\n"; +# print " 1 -- only add new file associations, don't overwrite old ones\n"; +# print " 2 -- always create file associations to TeX Live programs\n"; +# print "New value for file_assocs [$vars{'option_file_assocs'}]: "; +# chomp (my $a = <STDIN>); +# if ($a eq "0" || $a eq "1" || $a eq "2") { +# $vars{'option_file_assocs'} = $a; +# } +# return $command{'self'}; +# +# } elsif ("\u$answer" eq 'U' and !$vars{'portable'}) { +# toggle 'option_w32_multi_user'; +# return $command{'self'}; +# } +# } - } elsif ("\u$answer" eq 'N' and !$vars{'portable'}) { - print "New value for file_assocs:\n"; - print " 0 -- don't tweak the file associations\n"; - print " 1 -- only add new file associations, don't overwrite old ones\n"; - print " 2 -- always create file associations to TeX Live programs\n"; - print "New value for file_assocs [$vars{'option_file_assocs'}]: "; - chomp (my $a = <STDIN>); - if ($a eq "0" || $a eq "1" || $a eq "2") { - $vars{'option_file_assocs'} = $a; - } - return $command{'self'}; + # other options - } elsif ("\u$answer" eq 'U' and !$vars{'portable'}) { - toggle 'option_w32_multi_user'; - return $command{'self'}; - } - } + if (("\u$answer" eq 'M') && !$vars{'portable'}) { + toggle ('option_desktop_integration', \@::deskintdesc); + return $command{'self'}; - # other options + } elsif (("\u$answer" eq 'N') && !$vars{'portable'}) { + toggle ('option_file_assocs', \@::fileassocdesc); + return $command{'self'}; - if ("\u$answer" eq 'P') { + } elsif ("\u$answer" eq 'P') { toggle 'option_letter'; return $command{'self'}; @@ -953,7 +984,10 @@ sub main_menu { my $b_src=button($vars{'option_src'}); my $b_fmt=button($vars{'option_fmt'}); my $b_letter=button($vars{'option_letter'}); - my $b_deskint=button($vars{'option_desktop_integration'}); + my $b_deskint=button($vars{'option_desktop_integration'}, \@::deskintdesc); + if (win32()) { + my $b_fileassoc=button($vars{'option_file_assocs'}, \@::fileassocdesc); + } my $b_admin=button($vars{'option_w32_multi_user'}); my $b_addoneditor=button($vars{'collection-texworks'}); my $b_restricted=button($vars{'option_write18_restricted'}); @@ -1094,7 +1128,6 @@ EOF return $command{'self'}; } } - # needs a terminal 1 for require to succeed! 1; diff --git a/Master/tlpkg/installer/install-menu-wizard.pl b/Master/tlpkg/installer/install-menu-wizard.pl index 44738c815b1..7f92dd35d6c 100644 --- a/Master/tlpkg/installer/install-menu-wizard.pl +++ b/Master/tlpkg/installer/install-menu-wizard.pl @@ -68,8 +68,8 @@ require Tk::BrowseEntry; require Tk::Dialog; require Tk::DialogBox; require Tk::PNG; -require Tk::ROText; -require Tk::ProgressBar; +#require Tk::ROText; +#require Tk::ProgressBar; require Tk::Font; use utf8; @@ -119,44 +119,12 @@ sub menu_abort { $mw->destroy; } -sub setup_hooks_wizard { - @::info_hook = (); - push @::info_hook, - sub { - return unless defined($mw); - wizard_update_status(join(" ",@_)); - $mw->update; - }; - push @::warn_hook, - sub { - return unless defined($mw); - wizard_update_status(join(" ",@_)); - $mw->update; - }; - @::install_packages_hook = (); - push @::install_packages_hook, \&wizard_update_progressbar; - push @::install_packages_hook, sub { $mw->update; }; -} - -sub wizard_update_status { - my ($p) = @_; - return unless defined($::progressw); - $::progressw->insert("end", "$p"); - $::progressw->see("end"); -} -sub wizard_update_progressbar { - my ($n,$total) = @_; - if (defined($n) && defined($total)) { - $::progress->value(int($n*100/$total)); - } -} - ################# WELCOME SCREEN ###################################### sub run_menu_wizard { $mw = Tk::MainWindow->new(-width => $MWIDTH, -height => $MHEIGHT); $mw->protocol('WM_DELETE_WINDOW' => \&menu_abort); - setup_hooks_wizard(); + #setup_hooks_wizard(); my $img = $mw->Photo(-format => 'png', -file => "$::installerdir/tlpkg/installer/texlive.png"); $mw->Label(-image => $img, -background => "#0078b8")->place(-x => 0, -y => 0); @@ -172,7 +140,7 @@ sub run_menu_wizard { $tit->place(-x => 0, -y => 0); - $counter = $ftitle->Label(-text => "1/5"); + $counter = $ftitle->Label(-text => "1/4"); $counter->place(-x => $INNERWIDTH, -y => 0, -anchor => "ne"); $fmain = $mw->Frame(-height => $INNERHEIGHT, -width => $INNERWIDTH); @@ -201,12 +169,12 @@ sub reset_start { for ($fmain->children) { $_->destroy; } - $counter->configure(-text => "1/5"); + $counter->configure(-text => "1/4"); $prv->placeForget; my $inf = $fmain->Label( -text => __("Welcome to the installation of TeX Live %s\nhttp://tug.org/texlive\n\nThis wizard will guide you through the installation.", $TeXLive::TLConfig::ReleaseYear) - . ( (win32()) ? "\n\n" . __("Best to disable your virus scanner during installation.") : "" ) + . ( (win32()) ? "\n\n" . __("In case of trouble, try to disable your virus scanner during installation.") : "" ) . "\n\n" . __("For an advanced, customizable installation, please consult\nthe web pages or installation guide.") . "\n" @@ -246,7 +214,7 @@ sub ask_mirror { for ($fmain->children) { $_->destroy; } - $counter->configure(-text => "1-1/5"); + $counter->configure(-text => "1-1/4"); my @mirror_list; my @netlst; @@ -314,7 +282,7 @@ sub ask_mirror_hierarchical { for ($fmain->children) { $_->destroy; } - $counter->configure(-text => "1-1/5"); + $counter->configure(-text => "1-1/4"); our $mirrors; require("installer/mirrors.pl"); @@ -405,7 +373,7 @@ sub load_remote_screen { for ($fmain->children) { $_->destroy; } - $counter->configure(-text => "1-2/5"); + $counter->configure(-text => "1-2/4"); if ($::init_remote_needed) { my $labela = $fmain->Label(-text => __('Please wait while the repository database is loaded.'))->place(-x => 0, -y => 50); @@ -448,7 +416,7 @@ sub ask_path { $_->destroy; } - $counter->configure(-text => "2/5"); + $counter->configure(-text => "2/4"); $dest = $vars{'TEXDIR'}; $dest_display = native_slashify($dest); @@ -583,7 +551,7 @@ sub ask_options { for ($fmain->children) { $_->destroy; } - $counter->configure(-text => "3/5"); + $counter->configure(-text => "3/4"); my $inf = $fmain->Label(-text => __("This screen allows you to configure some options"), -justify => "left"); $inf->place(-x => 0, -y => 20); @@ -629,7 +597,7 @@ sub ask_go { for ($fmain->children) { $_->destroy; } - $counter->configure(-text => "4/5"); + $counter->configure(-text => "4/4"); my $inf = $fmain->Label(-justify => "left", -text => __("We are ready to install TeX Live %s.\nThe following settings will be used.\nIf you want to change something please go back,\notherwise press the \"Install\" button.", $TeXLive::TLConfig::ReleaseYear)); @@ -656,85 +624,12 @@ sub ask_go { $nxt->configure(-text => __('Install'), - -command => \&wizard_installation_window); + -command => sub { $return = $MENU_INSTALL; $mw->destroy; }); +# -command => \&wizard_installation_window); $prv->configure(-text => __('< Back'), -command => \&ask_options); $can->place(-x => $LEFT, -y => ($MHEIGHT - $BOTTOM), -anchor => "sw"); } -sub wizard_installation_window { - for ($fmain->children) { - $_->destroy; - } - $counter->configure(-text => "5/5"); - # create a progress bar window - # compute the height of the Text by the given font - - $::progressw = $fmain->Scrolled("ROText", -scrollbars => "e", - -wrap => "word"); - - # we want to have the progressbar about 20px wide, so compute how - # many lines of the current font do fit into the remaining area - my $lines = int( ($INNERHEIGHT - 20) / $lineskip); - # it seems that on Windows the computation is not right, the - # progress bar overwrites the last line of the text widget - # remove one line here - $lines-- if win32(); - $::progressw->configure(-height => $lines); - $::progressw->place(-x => 0, -y => 0, -width => $INNERWIDTH); - - # that is necessary otherwise the progressbar gets very strange dimensions - $fmain->update; - - - my $percent_done = 0; - - # compute the remaining space in pixel for the progressbar - my $pw = $INNERHEIGHT - ($lines * $lineskip) - 5; - # make sure that the line we remove above for Windows is not re-added - # to the size of the progressbar. The 7 was found by trial and error - $pw -= ($lineskip + 7) if win32(); - $::progress = $fmain->ProgressBar(-variable => \$percent_done, - -width => $pw, -length => $INNERWIDTH, - -from => 0, -to => 110, -blocks => 10, - -colors => [ 0, '#0078b8' ]); - $::progress->place(-x => 0, -y => $INNERHEIGHT, -anchor => "sw"); - - # - # change the buttons so that the Prev disappears, the Next becomes - # Cancel, and the Cancel button disappears - $prv->placeForget; - $nxt->placeForget; - #$can->configure(-text => __('Cancel'), - # -command => sub { $return = $MENU_ABORT; $mw->destroy; }); - calc_depends(); - do_installation(); - $::progress->value(110); - $return = $MENU_ALREADYDONE; - my $t = __("See %s/index.html for links to documentation.\nThe TeX Live web site (http://tug.org/texlive/) contains any updates and corrections. 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 groups is available on the web at http://tug.org/usergroups.html.", $::vars{'TEXDIR'}); - if (!win32()) { - $t .= "\n\n" . __("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'}); - } - if (@::WARNLINES) { - $t .= "\n\n" . __("There were some warnings during the installation process.\nHere is the list of warning messages:") . "\n"; - $t .= join('', @::WARNLINES); - $t =~ s/\n\z//; - } - $t .= "\n\n" . __('Welcome to TeX Live!'); - #$t =~ s/\\n/\n/g; - my $linechar = $::progressw->index("end"); - $::progressw->markSet("finaltext", $linechar); - $::progressw->markGravity("finaltext", "left"); - $::progressw->insert("end", "\n$t"); - $::progressw->see("end"); - $::progressw->tagAdd("centered", $linechar, "end"); - $::progressw->tagConfigure("centered", -justify => "center"); - my $rb = $MWIDTH - $RIGHT; - $nxt->configure(-text => __('Finish'), - -command => sub { $mw->destroy; }); - $nxt->place(-x => ($MWIDTH - $RIGHT) , - -y => ($MHEIGHT - $BOTTOM), -anchor => "se")->focus(); -} - ################### END OF MODULE RETURN 1 FOR REQUIRE ########### 1; diff --git a/Master/tlpkg/installer/tracked-install.pl b/Master/tlpkg/installer/tracked-install.pl new file mode 100644 index 00000000000..bdc12e3f041 --- /dev/null +++ b/Master/tlpkg/installer/tracked-install.pl @@ -0,0 +1,141 @@ +#!/usr/bin/env perl +# $Id: install-menu-perltk.pl 41176 2016-05-16 00:42:28Z preining $ +# +# Copyright 2008-2014 Norbert Preining +# Copyright 2008 Reinhard Kotucha +# This file is licensed under the GNU General Public License version 2 +# or any later version. +# +# TODO: +# - make the fancy selector the default, at least on unix +# - for w32 find out the necessary files for the fancy selector and move +# them to the installer perl package + +use strict; +$^W = 1; + +my $svnrev = '$Revision: 41176 $'; +$svnrev =~ m/: ([0-9]+) /; +$::menurevision = $1; + +require Tk; +require Tk::ROText; +require Tk::ProgressBar; + +use utf8; +no utf8; + +sub installer_tracker { + my $ret; + # create a progress bar window + $::sww = Tk::MainWindow->new; + $::sww->Label(-text => __("Installation process"))->pack; + #warn "Debug!! Creating text window"; + $::progressw = $::sww->Scrolled("ROText", -scrollbars => "e", -height => 18); + #warn "Debug!! Created text window"; + $::progressw->pack(-expand => 1, -fill => "both"); + #warn "Debug!! Placed text window"; + my $percent_done = 0; + $::progress = $::sww->ProgressBar(-variable => \$percent_done, + -width => 20, -length => 400, -from => 0, -to => 100, -blocks => 10, + -colors => [ 0, '#0078b8' ]); + $::progress->pack(-fill => "x"); + #my $f = $::sww->Frame; + my $b = $::sww->Button( + -text => __("Cancel"), + -command => sub { + do_cleanup(); $::sww->destroy; + # POSIX::exit prevents Tk error message 'Tk::Error: ("after" script)' + POSIX::exit(1); + })->pack(-pady => "2m"); + $b->focus(); + # $f->pack; + setup_hooks_perltk(); + + $ret = do_installation(); + + if (@::WARNLINES) { + foreach my $t (@::WARNLINES) { + update_status ($t); + } + } + if ($::env_warns) { + update_status($::env_warns); + } + $::progressw->tagConfigure('centered', -justify => 'center'); + # basic welcome message + foreach my $t (@::welcome_arr) { + my $s = shift @$t; + $::progressw->insert("end", __($s, @$t)."\n", 'centered'); + } + $::progressw->insert("end", "\n"); + # additional info + if ($::LOGFILENAME) { + $::progressw->insert ("end", "Logfile: $::LOGFILENAME"); + } else { + # do_cleanup sets $::LOGFILENAME to "" + #if no logfile could be written + $::progressw->insert ("end", + "Cannot create logfile $::vars{'TEXDIR'}/install-tl.log: $!"); + } + if (@::WARNLINES or $::env_vars or !$::LOGFILENAME) { + $::progressw->insert("end", "\n"); + $::progressw->insert("end", __("Scroll back to inspect warnings")); + } + $::progressw->insert("end", "\n"); + my $linechar = $::progressw->index("end"); + $::progressw->see("end"); + $::progressw->tagAdd("centered", $linechar, "end"); + $::progressw->tagConfigure("centered", -justify => "center"); + $b->configure( + -text => __("Finish"), + -command => sub { + $::sww->destroy; return $ret; + }); + + Tk::MainLoop(); + return $ret; +} # installer_tracker + +#sub tracked_installation { +# # undo binding, since this should run only once +# my $b = shift; +# $b->bind('<Map>' => ''); +# $ret = do_installation(); +# $::sww->destroy; +#} + +sub setup_hooks_perltk { + @::info_hook = (); + push @::info_hook, + sub { + update_status(join(" ",@_)); + $::sww->update; + }; + push @::warn_hook, + sub { + return unless defined $::sww ; + update_status(join(" ",@_)); + }; + @::install_packages_hook = (); + push @::install_packages_hook, \&update_progressbar; + push @::install_packages_hook, + sub { + return unless defined $::sww; + $::sww->update; + }; +} + +sub update_status { + my ($p) = @_; + return unless defined $::progressw; + $::progressw->insert("end", "$p"); + $::progressw->see("end"); +} +sub update_progressbar { + my ($n,$total) = @_; + return unless defined $::progress; + if (defined($n) && defined($total)) { + $::progress->value(int($n*100/$total)); + } +} |