texlive[63571] Master/tlpkg/installer/install-menu-text.pl:

commits+karl at tug.org commits+karl at tug.org
Mon Jun 13 03:11:20 CEST 2022


Revision: 63571
          http://tug.org/svn/texlive?view=revision&revision=63571
Author:   karl
Date:     2022-06-13 03:11:19 +0200 (Mon, 13 Jun 2022)
Log Message:
-----------
install-tl (GetOptions): new options -no-installation, no-interaction,
  -debug-setup-vars, -paper; also -texdir and other directory trees.
(set_var_from_alternatives, set_standard_var): generalize method for
  setting the dir values. Expand tildes.
(update_default_{scheme,paper}): new fns so scheme and paper size options
  are set before we go into the menus.
(check_env): don't complain about INFOPATH or MANPATH; mention
  TEXLIVE_INSTALL_ENV_NOCHECK.

Document new options; give a few examples.

TLUtils.pm (get_user_home, expand_tilde): new fns.
install-menu-text.pl: call them.

Modified Paths:
--------------
    trunk/Master/install-tl
    trunk/Master/tlpkg/TeXLive/TLUtils.pm
    trunk/Master/tlpkg/dev/profiles/TLbookpub.pro
    trunk/Master/tlpkg/installer/install-menu-text.pl

Property Changed:
----------------
    trunk/Master/tlpkg/dev/profiles/TLbookpub.pro

Modified: trunk/Master/install-tl
===================================================================
--- trunk/Master/install-tl	2022-06-12 23:54:07 UTC (rev 63570)
+++ trunk/Master/install-tl	2022-06-13 01:11:19 UTC (rev 63571)
@@ -296,6 +296,12 @@
 my $opt_warn_checksums = 1;
 my $opt_font;
 my $opt_continue = 1;
+my $opt_installation = 1;
+my $opt_interaction = 1;
+my $opt_paper = "";
+my $opt_texdir = "";
+my $opt_texuserdir = "";
+my %pathopts;
 # unusual cases:
 $::opt_select_repository = 0;
 our $opt_in_place = 0;
@@ -303,6 +309,7 @@
 my $opt_verify_downloads;
 # debug options
 my $opt_debug_fakenet = 0;
+my $opt_debug_setup_vars = 0;
 
 # show all options even those not relevant for that arch
 $::opt_all_options = 0;
@@ -374,6 +381,7 @@
            "custom-bin=s"                => \$opt_custom_bin,
            "debug-translation"           => \$::debug_translation,
            "debug-fakenet"               => \$opt_debug_fakenet,
+           "debug-setup-vars"            => \$opt_debug_setup_vars,
            "fancyselector",
            "force-platform|force-arch=s" => \$opt_force_arch,
            "gui:s"                       => \$opt_gui,
@@ -383,7 +391,10 @@
            "location|url|repository|repos|repo=s" => \$opt_location,
            "no-cls",                    # $::opt_no_cls in install-menu-text-pl
            "no-gui"                      => \$opt_no_gui,
+           "installation!",              => \$opt_installation,
+           "interaction!",               => \$opt_interaction,
            "non-admin"                   => \$opt_nonadmin,
+           "paper=s"                     => \$opt_paper,
            "persistent-downloads!"       => \$opt_persistent_downloads,
            "portable"                    => \$opt_portable,
            "print-platform|print-arch"   => \$opt_print_arch,
@@ -390,6 +401,14 @@
            "profile=s"                   => \$opt_profile,
            "scheme=s"                    => \$opt_scheme,
            "select-repository"           => \$::opt_select_repository,
+           "texdir=s"                    => \$opt_texdir,
+           "texmfconfig=s"               => \$pathopts{'texmfconfig'},
+           "texmfhome=s"                 => \$pathopts{'texmfhome'},
+           "texmflocal=s"                => \$pathopts{'texmflocal'},
+           "texmfsysconfig=s"            => \$pathopts{'texmfsysconfig'},
+           "texmfsysvar=s"               => \$pathopts{'texmfsysvar'},
+           "texmfvar=s"                  => \$pathopts{'texmfvar'},
+           "texuserdir=s"                => \$opt_texuserdir,
            "font=s"                      => \$opt_font,
            "tcl",                       # handled by wrapper
            "verify-downloads!"           => \$opt_verify_downloads,
@@ -466,15 +485,23 @@
 
 # some option checks
 
-die "$0: Options custom-bin and in-place are incompatible.\n"
+die "$0: Incompatible options: custom-bin and in-place.\n"
   if ($opt_in_place && $opt_custom_bin);
 
-die "$0: Options profile and in-place are incompatible.\n"
+die "$0: Incompatible options: in-place and profile ($opt_profile).\n"
   if ($opt_in_place && $opt_profile);
 
-die "$0: Options init-from-profile and in-place are incompatible.\n"
+die "$0: Incompatible options init-from-profile and in-place.\n"
   if ($opt_in_place && $opt_init_from_profile);
 
+die "$0: Incompatible options: texuserdir ($opt_texuserdir) and "
+    . "any of texmfhome, texmfconfig, texmfvar ("
+    . "$pathopts{'texmfhome'}, $pathopts{'texmfvar'}, $pathopts{'texmfconfig'}"
+    . ").\n"
+  if ($opt_texuserdir && 
+       ($pathopts{'texmfhome'} || $pathopts{'texmfvar'}
+        || $pathopts{'texmfconfig'}));
+
 if ($#ARGV >= 0) {
   die "$0: Extra arguments `@ARGV'; try --help if you need it.\n";
 }
@@ -610,7 +637,7 @@
 }
 
 

-if ($opt_profile eq "") {
+if ($opt_profile eq "" && $opt_interaction) {
   if ($opt_init_from_profile) {
     read_profile("$opt_init_from_profile", seed => 1);
   }
@@ -617,8 +644,8 @@
   # do the normal interactive installation.
   #
   # here we could load different menu systems. Currently several things
-  # are "our" so that the menu implementation can use it. The $tlpdb, the
-  # %var, and all the @collection*
+  # are "our" so that the menu implementation can use it: The $tlpdb, the
+  # %var, and all the @collection*.
   # install-menu-*.pl have to assign a code ref to $::run_menu which is
   # run, and should change ONLY stuff in %vars
   # The allowed keys in %vars should be specified somewhere ...
@@ -687,7 +714,7 @@
   if (!do_remote_init()) {
     die ("Exiting installation.\n");
   }
-  read_profile($opt_profile);
+  read_profile($opt_profile) if ($opt_profile ne "");
 }
 
 my $varsdump = "";
@@ -704,6 +731,11 @@
 install_warnlines_hook(); # collect warnings in @::WARNLINES
 info("Installing to: $vars{TEXDIR}\n");
 
+if (!$opt_installation) {
+  print STDERR "Not doing installation due to --no-installation, terminating here.\n";
+  exit 0;
+}
+
 $::env_warns = "";
 create_welcome();
 my $status = 1;
@@ -742,8 +774,8 @@
 to complete the installation.
 
 However, if the problem was a failure to download (by far the
-most common cause), you need to ensure that your network connection
-is working first.
+most common cause), check that you can connect to the chosen mirror
+in a browser; you may need to specify a mirror explicitly.
 ******************************************************************
 
 EOF
@@ -806,7 +838,6 @@
   return load_tlpdb();
 } # only_load_remote
 
-
 sub do_remote_init {
   if (!only_load_remote(@_)) {
     tlwarn("$0: Could not load TeX Live Database from $location, goodbye.\n");
@@ -906,6 +937,11 @@
   # size information
   $vars{'free_size'} = TeXLive::TLUtils::diskfree($vars{'TEXDIR'});
 
+  update_default_scheme();
+  update_default_paper();
+} # final_remote_init
+
+sub update_default_scheme {
   # initialize the scheme from the command line value, if given.
   if ($opt_scheme) {
     # add the scheme- prefix if they didn't give it.
@@ -917,9 +953,34 @@
       tlwarn("Scheme $opt_scheme not defined, ignoring it.\n");
     }
   }
-} # final_remote_init
+} # update_default_scheme
 
+sub update_default_paper {
+  # initialize default paper size from the command line or envvar value,
+  # if either is given.
+  my $env_paper = $ENV{"TEXLIVE_INSTALL_PAPER"};
+  if ($opt_paper) {
+    if (defined $env_paper && $env_paper ne $opt_paper) {
+      tlwarn("$0: paper selected via both envvar TEXLIVE_INSTALL_PAPER and\n");
+      tlwarn("$0:   cmdline arg --paper, preferring the latter: $opt_paper\n");
+    }
+    if ($opt_paper eq "letter") { $vars{'instopt_letter'} = 1; }
+    elsif ($opt_paper eq "a4")  { $vars{'instopt_letter'} = 0; }
+    else {
+      tlwarn("$0: cmdline option --paper value must be letter or a4, not: "
+             . "$opt_paper (ignoring)\n");
+    }
+  } elsif ($env_paper) {
+    if ($env_paper eq "letter") { $vars{'instopt_letter'} = 1; } 
+    elsif ($env_paper eq "a4") { ; } # do nothing
+    else {
+      tlwarn("$0: TEXLIVE_INSTALL_PAPER value must be letter or a4, not: "
+             . "$env_paper (ignoring)\n");
+    }
+  }
+} # update_default_paper
 
+

 sub do_installation {
   if (win32()) {
     non_admin() if !$vars{'tlpdbopt_w32_multi_user'};
@@ -934,6 +995,11 @@
       && $vars{'n_collections_selected'} <= 0) {
     tldie("$0: Nothing selected, nothing to install, exiting!\n");
   }
+  # expand ~ in various variables just to be sure
+  for my $v (qw/TEXDIR TEXMFLOCAL TEXMFSYSVAR TEXMFSYSCONFIG TEXMFHOME
+                TEXMFVAR TEXMFCONFIG/) {
+    $vars{$v} = TeXLive::TLUtils::expand_tilde($vars{$v}) if ($vars{$v});
+  }
   # maybe_make_ro tests for admin, local drive and NTFS before proceeding.
   # making the root read-only automatically locks everything below it.
   # do TEXDIR now, before it loses its final slash
@@ -946,11 +1012,14 @@
   # -1 is returned if df not available or some other error
   if ($diskfree != -1) {
     my $reserve = 100;
-    if ( $diskfree + $reserve < $vars{'total_size'}) {
+    if ($diskfree < $reserve + $vars{'total_size'}) {
+      my $msg = "($diskfree free < $reserve reserve "
+                . "+ installed $vars{total_size})";
       if ($ENV{'TEXLIVE_INSTALL_NO_DISKCHECK'}) {
-        tlwarn("Insufficient disk space, but continuing anyway.");
+        tlwarn("$0: Insufficient disk space\n$msg\n"
+          ." but continuing anyway per envvar TEXLIVE_INSTALL_NO_DISKCHECK\n");
       } else {
-        die("DISK SPACE INSUFFICIENT!");
+        tldie("$0: DISK SPACE INSUFFICIENT!\n$msg\nAborting installation.\n");
       }
     }
   }
@@ -1186,7 +1255,6 @@
     tlwarn("Old configuration file $TEXMFLOCAL/web2c/fmtutil-local.cnf found.\n");
     tlwarn("fmtutil now reads *all* fmtutil.cnf files, so probably the easiest way\nis to rename the above file to $TEXMFLOCAL/web2c/fmtutil.cnf\n");
   }
-    
 
   info("writing updmap.cfg to $TEXDIR/texmf-dist/web2c/updmap.cfg\n");
   TeXLive::TLUtils::create_updmap ($usedtlpdb,
@@ -1218,20 +1286,12 @@
   }
 
   # now work through the options if specified at all
-  my $env_paper = $ENV{"TEXLIVE_INSTALL_PAPER"};
-  if (defined $env_paper && $env_paper eq "letter") {
-    $vars{'instopt_letter'} = 1;
-  } elsif (defined $env_paper && $env_paper eq "a4") {
-    ; # do nothing
-  } elsif ($env_paper) {
-    tlwarn("$0: TEXLIVE_INSTALL_PAPER value must be letter or a4, not: "
-           . "$env_paper (ignoring)\n");
-  }
+
   # letter instead of a4
   if ($vars{'instopt_letter'}) {
     # set paper size, but do not execute any post actions, which in this
     # case would be mktexlsr and fmtutil-sys -all; clearly premature
-    # here in the installer.
+    # here at this point in the installer.
     info("setting default paper size to letter:\n");
     $errcount += run_postinst_cmd("tlmgr --no-execute-actions paper letter");
   }
@@ -1388,7 +1448,6 @@
   return $ret;
 } # do_path_adjustments
 
-
 # we have to adjust the texmf.cnf file to the paths set in the configuration!
 sub do_texmf_cnf {
   open(TMF,"<$vars{'TEXDIR'}/texmf-dist/web2c/texmf.cnf")
@@ -1542,6 +1601,18 @@
   close(TMFLUA) || warn "close($TMFLUA) failed: $!";
 } # do_texmf_cnf
 
+# Determine which platforms are supported.
+sub set_platforms_supported {
+  my @binaries = $tlpdb->available_architectures;
+  for my $binary (@binaries) {
+    unless (defined $vars{"binary_$binary"}) {
+      $vars{"binary_$binary"}=0;
+    }
+  }
+  for my $key (keys %vars) {
+    ++$vars{'n_systems_available'} if ($key=~/^binary/);
+  }
+} # set_platforms_supported
 
 sub dump_vars {
   my $filename=shift;
@@ -1559,20 +1630,7 @@
   debug("\n%vars dumped to '$filename'.\n");
 } # dump_vars
 
-
-# Determine which platforms are supported.
-sub set_platforms_supported {
-  my @binaries = $tlpdb->available_architectures;
-  for my $binary (@binaries) {
-    unless (defined $vars{"binary_$binary"}) {
-      $vars{"binary_$binary"}=0;
-    }
-  }
-  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
 #                                  $tex_prefix/2010     => $TEXDIR
@@ -1584,34 +1642,59 @@
 #   TEXLIVE_INSTALL_TEXMFCONFIG    ~/.texlive2010/texmf-config
 
 sub set_var_from_alternatives {
-  my ($whatref, @alternatives) = @_;
+  my ($what, $whatref, @alternatives) = @_;
+  my @alt_text;
+  for my $i (@alternatives) {
+    push @alt_text, ($i ? $i : "undef")
+  }
   my $final;
   while (@alternatives) {
     my $el = pop @alternatives;
     $final = $el if ($el);
   }
+  debug("setting $what to $final from @alt_text\n");
   $$whatref = $final;
 }
 
 sub set_standard_var {
-  my ($what, $envstr, $default) = @_;
+  my ($what, $envstr, $cmdlinestr, $default) = @_;
   # warn if a value was set from both the profile and
   # via env var
   my $envvar = getenv($envstr);
-  if ($vars{$what} && $envvar && $vars{$what} ne $envvar) {
+  my $cmdlinevar = $pathopts{$cmdlinestr};
+  my %nrdefs;
+  $nrdefs{$vars{$what}} = 1 if ($vars{$what});
+  $nrdefs{$envvar} = 1 if ($envvar);
+  $nrdefs{$cmdlinevar} = 1 if ($cmdlinevar);
+  # texmfhome/texmfvar/texmfconfig have actually been set by
+  # via $opt_texuserdir/....
+  # So warn about this
+  my $actual_cmdline_str = $cmdlinestr;
+  my $actual_cmdline_var = $cmdlinevar;
+  if ($opt_texuserdir) {
+    if ($cmdlinestr eq "texmfhome" || $cmdlinestr eq "texmfvar" || $cmdlinestr eq "texmfconfig") {
+      $actual_cmdline_str = "opt_texuserdir";
+      $actual_cmdline_var = $opt_texuserdir;
+    }
+  }
+  if (scalar keys %nrdefs > 1) {
+    # multiple conflicting definitions, fail!
     tlwarn("Trying to define $what via conflicting settings:\n");
-    tlwarn("  from envvar $envvar = $envvar($envstr)\n");
-    tlwarn("  from profile = $vars{$what}\n");
-    tlwarn("  Preferring the profile value!\n");
-    $envvar = undef;
+    tlwarn("  from envvar $envstr = $envvar\n") if ($envvar);
+    tlwarn("  from profile = $vars{$what}\n") if ($vars{$what});
+    tlwarn("  from command line argument $actual_cmdline_str = $actual_cmdline_var\n") if ($actual_cmdline_var);
+    tlwarn("  Preferring the last value from above!\n");
+    # actual preference order is given via the below call
   }
-  # default for most variables is in increasing priority
+  # default for most variables, in increasing priority
   # - some default
+  # - environment variable
   # - setting from profile saved already in $vars{$what}
-  # - environment variable
-  set_var_from_alternatives( \$vars{$what},
+  # - command line
+  set_var_from_alternatives( $what, \$vars{$what},
+    $cmdlinevar,
+    $vars{$what},
     $envvar,
-    $vars{$what},
     $default);
 }
 
@@ -1619,42 +1702,75 @@
   my $homedir = (platform() =~ m/darwin/) ? "~/Library" : "~";
   my $yyyy = $TeXLive::TLConfig::ReleaseYear;
   #
+  # We already checked that either $opt_texuserdir xor at least one of the
+  # directory options (texmfhome, texmfvar, texmfconfig) is set. In case
+  # $opt_texuserdir is set, assign the respective values to texmfhome etc.
+  if ($opt_texuserdir) {
+    $pathopts{'texmfhome'} = "$opt_texuserdir/texmf";
+    $pathopts{'texmfvar'} = "$opt_texuserdir/texmf-var";
+    $pathopts{'texmfconfig'} = "$opt_texuserdir/texmf-config";
+  }
+  #
+  # Sources of target directory settings in priority order:
+  # - env variable TEXLIVE_INSTALL_PREFIX
+  #   will be used with YYYY (in portable case without)
+  # - --texdir cmd line option
+  #   will be used as is, similar to profile setting
+  # - profile setting
+  #
+  # first compare whether profile setting and cmd line agree if both given
+  if ($opt_texdir && $vars{'TEXDIR'}) {
+    if ($opt_texdir ne $vars{'TEXDIR'}) {
+      tlwarn("Conflicting settings for installation path given:\n");
+      tlwarn("  from profile TEXDIR = $vars{'TEXDIR'}\n");
+      tlwarn("  from command line option --texdir = $opt_texdir\n");
+      tlwarn("  Preferring the command line value!\n");
+      # actual setting of preference is done below in the
+      #   set_var_from_alternatives( \$vars{'TEXDIR'},
+      # call, where the order determines the preference!
+    }
+  }
   my $tlprefixenv = getenv('TEXLIVE_INSTALL_PREFIX');
-  if ($tlprefixenv && $vars{'TEXDIR'}) {
+  if ($tlprefixenv && ($opt_texdir || $vars{'TEXDIR'})) {
     # NOTE we cannot compare these two values because the one might
     # contain the YYYY part (TEXDIR) while the other is the one without.
     tlwarn("Trying to set up basic path using two incompatible methods:\n");
     tlwarn("  from envvar TEXLIVE_INSTALL_PREFIX = $tlprefixenv\n");
-    tlwarn("  from profile TEXDIR = $vars{'TEXDIR'}\n");
-    tlwarn("  Preferring the profile value!\n");
+    tlwarn("  from profile TEXDIR = $vars{'TEXDIR'}\n") if ($vars{'TEXDIR'});
+    tlwarn("  from command line option --texdir = $opt_texdir\n") if ($opt_texdir);
+    tlwarn("  Preferring the later value!\n");
     $tlprefixenv = undef;
   }
   # first set $tex_prefix
   my $tex_prefix;
-  set_var_from_alternatives( \$tex_prefix,
+  set_var_from_alternatives( "TEX_PREFIX", \$tex_prefix,
     ($opt_in_place ? abs_path($::installerdir) : undef),
     $tlprefixenv,
     (win32() ? getenv('SystemDrive') . '/texlive' : '/usr/local/texlive'));
-  set_var_from_alternatives( \$vars{'TEXDIR'},
+  set_var_from_alternatives( "TEXDIR", \$vars{'TEXDIR'},
+    $opt_texdir,
     $vars{'TEXDIR'},
     ($vars{'instopt_portable'} || $opt_in_place)
       ? $tex_prefix : "$tex_prefix/$texlive_release");
   set_standard_var('TEXMFSYSVAR', 'TEXLIVE_INSTALL_TEXMFSYSVAR',
-    $vars{'TEXDIR'} . '/texmf-var');
+                   'texmfsysvar', "$vars{'TEXDIR'}/texmf-var");
+  #
   set_standard_var('TEXMFSYSCONFIG', 'TEXLIVE_INSTALL_TEXMFSYSCONFIG',
-    $vars{'TEXDIR'} . '/texmf-config');
+                   'texmfsysconfig', "$vars{'TEXDIR'}/texmf-config");
+  #
   set_standard_var('TEXMFLOCAL', 'TEXLIVE_INSTALL_TEXMFLOCAL',
-    "$tex_prefix/texmf-local");
+                   'texmflocal', "$vars{'TEXDIR'}/texmf-local");
+  #
   set_standard_var('TEXMFHOME', 'TEXLIVE_INSTALL_TEXMFHOME',
-    "$homedir/texmf");
-  set_standard_var('TEXMFVAR', 'TEXLIVE_INSTALL_TEXMFVAR',
-    (platform() =~ m/darwin/)
-      ? "$homedir/texlive/$yyyy/texmf-var"
-      : "$homedir/.texlive$yyyy/texmf-var");
-  set_standard_var('TEXMFCONFIG', 'TEXLIVE_INSTALL_TEXMFCONFIG',
-    (platform() =~ m/darwin/)
-      ? "$homedir/texlive/$yyyy/texmf-config"
-      : "$homedir/.texlive$yyyy/texmf-config");
+                   'texmfhome', "$homedir/texmf");
+  #
+  set_standard_var('TEXMFVAR', 'TEXLIVE_INSTALL_TEXMFVAR', 'texmfvar',
+    (platform() =~ m/darwin/) ? "$homedir/texlive/$yyyy/texmf-var"
+                              : "$homedir/.texlive$yyyy/texmf-var");
+  #
+  set_standard_var('TEXMFCONFIG', 'TEXLIVE_INSTALL_TEXMFCONFIG', 'texmfconfig',
+    (platform() =~ m/darwin/) ? "$homedir/texlive/$yyyy/texmf-config"
+                              : "$homedir/.texlive$yyyy/texmf-config");
 
   # for portable installation we want everything in one directory
   if ($vars{'instopt_portable'}) {
@@ -1662,12 +1778,21 @@
     $vars{'TEXMFVAR'}    = "\$TEXMFSYSVAR";
     $vars{'TEXMFCONFIG'} = "\$TEXMFSYSCONFIG";
   }
+
+  if ($opt_debug_setup_vars) {
+    print "DV:final values from setup of paths:\n";
+    for my $i (qw/TEXDIR TEXMFSYSVAR TEXMFSYSCONFIG TEXMFHOME TEXMFVAR
+                  TEXMFCONFIG TEXMFLOCAL/) {
+      print "$i = $vars{$i}\n";
+    }
+  }
 } # set_texlive_default_dirs
 
+

 sub calc_depends {
   # we have to reset the install hash EVERY TIME otherwise everything will
   # always be installed since the default is scheme-full which selects
-  # all packages and never deselects it
+  # all packages and never deselects.
   %install=();
   my $p;
   my $a;
@@ -1708,12 +1833,6 @@
     }
   }
 
-  #
-  # work through the addon settings in the %vars hash
-  #if ($vars{'addon_editor'}) {
-  #  $install{"texworks"} = 1;
-  #}
-
   # if programs for arch=win32 are installed we also have to install
   # tlperl.win32 which provides the "hidden" perl that will be used
   # to run all the perl scripts.
@@ -1733,7 +1852,7 @@
 
     # collect the already selected packages
     my @pre_selected = keys %install;
-    debug("initial number of installations: $#pre_selected\n");
+    debug("calc_depends: number of packages to install: $#pre_selected\n");
 
     # loop over all the pre_selected and add them
     foreach $p (@pre_selected) {
@@ -1764,7 +1883,7 @@
 
     # check for newly selected packages
     my @post_selected = keys %install;
-    debug("number of post installations: $#post_selected\n");
+    debug("calc_depends:   after resolution, #packages: $#post_selected\n");
 
     # set repeat condition
     if ($#pre_selected != $#post_selected) {
@@ -1772,7 +1891,7 @@
     }
   }
 
-  # now do the size computation
+  # after loop, now do the size computation.
   my $size = 0;
   foreach $p (keys %install) {
     my $tlpobj = $tlpdb->get_package($p);
@@ -2140,6 +2259,9 @@
       }
     }
   }
+  # Cmdline argument --scheme should override scheme selection in the profile
+  update_selected_scheme_from_cmdline();
+
   # if at least one collection has been defined return here
   return if $coldefined;
   # since no collections have been defined in the profile, we
@@ -2451,6 +2573,7 @@
   my $s = shift;
   # set the selected scheme to $s
   $vars{'selected_scheme'} = $s;
+  debug("setting selected scheme: $s\n");
   # if we are working on scheme-custom simply return
   return if ($s eq "scheme-custom");
   # remove the selection of all collections
@@ -2489,7 +2612,7 @@
   my %schemes_shown;
   for my $s ($tlpdb->schemes) { $schemes_shown{$s} = 0 ; }
   # first try the size-name-schemes in decreasing order
-  for my $sn (qw/full medium small basic minimal/) {
+  for my $sn (qw/full medium small basic minimal infraonly/) {
     if (defined($schemes_shown{"scheme-$sn"})) {
       push @scheme_order, "scheme-$sn";
       $schemes_shown{"scheme-$sn"} = 1;
@@ -2601,6 +2724,8 @@
                         |ARGS
                         |GENDOCS_TEMPLATE_DIR
                         |INSTROOT
+                        |INFOPATH
+                        |MANPATH
                         |PATH
                         |PERL5LIB
                         |SHELLOPTS
@@ -2618,7 +2743,9 @@
  (case-independent).  If you're doing anything but adding personal
  directories to the system paths, they may well cause trouble somewhere
  while running TeX.  If you encounter problems, try unsetting them.
- Please ignore spurious matches unrelated to TeX.
+ 
+ Please ignore spurious matches unrelated to TeX. (To omit this check,
+ set the environment variable TEXLIVE_INSTALL_ENV_NOCHECK.)
 
 $::env_warns ----------------------------------------------------------------------
 EOF
@@ -2709,7 +2836,9 @@
 The basic idea of TeX Live installation is for you to choose one of the
 top-level I<schemes>, each of which is defined as a different set of
 I<collections> and I<packages>, where a collection is a set of packages,
-and a package is what contains actual files.
+and a package is what contains actual files. Each package is in exactly
+one collection, while schemes can contain any combination of packages
+and collections.
 
 Within the installer, you can choose a scheme, and further customize the
 set of collections to install, but not the set of the packages.  To work
@@ -2728,9 +2857,47 @@
 The most up-to-date version of this installer documentation is on the
 Internet at L<https://tug.org/texlive/doc/install-tl.html>.
 
+For step-by-step instructions, see
+L<https://tug.org/texlive/quickinstall.html>.
+
 For the full documentation of TeX Live, see
 L<https://tug.org/texlive/doc>.
 
+=head1 EXAMPLES
+
+With no options, C<install-tl> drops you into an interactive menu where
+essentially all default settings can be changed. 
+
+With options, you can initialize the settings in various ways, or
+perform the installation without interaction.
+
+=over 4
+
+=item C<install-tl --paper=letter>
+
+Initialize paper size setting. The only values allowed are C<letter> and
+(the default) C<a4>.
+
+=item C<install-tl --scheme> I<scheme>
+
+Initialize the installation scheme; the default is C<full>.  For a list
+of schemes, see the interactive C<S> menu.
+
+=item C<install-tl --no-interaction>
+
+Perform the installation immediately after parsing options, without
+entering the interactive menu.
+
+=item C<install-tl --profile> I<texlive.profile>
+
+Install, without interaction, according to the given TL profile file;
+see L</PROFILES> below. To initialize from the profile and then enter the
+interactive menu, add C<--init-from-profile>.
+
+=back
+
+Full documentation follows.
+
 =head1 OPTIONS
 
 As usual, all options can be specified in any order, and with either a
@@ -2763,10 +2930,10 @@
 
 =back
 
-The default GUI requires Tcl/Tk. This is standard on Macs (although it
-is considered deprecated since Catalina) and is often already installed
-on GNU/Linux, or can be easily installed through a distro package
-manager. For Windows, TeX Live provides a Tcl/Tk runtime.
+The default GUI requires Tcl/Tk. This was standard on Macs, but has been
+removed in the latest macOS releases. It's often already installed on
+GNU/Linux, or can be easily installed through a distro package manager.
+For Windows, TeX Live provides a Tcl/Tk runtime.
 
 =item B<-no-gui>
 
@@ -2841,6 +3008,11 @@
 Pretend we're doing a network install, for the sole purpose of testing
 broken downloads via moving package files aside in a tlnet mirror.
 
+=item B<-debug-setup-vars>
+
+Print final values of directory variables; for more debugging
+information on how they were set, also specify C<-v>.
+
 =item B<-debug-translation>
 
 In the former Perl/Tk GUI modes, this option reported any missing,
@@ -2907,6 +3079,16 @@
 reinstallation will succeed later. If this option is specified, and the
 retry fails, the installer aborts.
 
+=item B<-no-installation>
+
+Do not perform any installation. This is for debugging the
+initialization and setup routines without touching the disk.
+
+=item B<-no-interaction>
+
+Do not enter the interactive menu, just perform the installation after
+initialization and option parsing.
+
 =item B<-no-persistent-downloads>
 
 =item B<-persistent-downloads>
@@ -2933,6 +3115,12 @@
 
 For Windows only: configure for the current user, not for all users.
 
+=item B<-paper> C<a4>B<|>C<letter>
+
+Set the default paper size for all TeX Live programs, as specified.
+The default is C<a4>. The paper size can be set after installation with
+the C<tlmgr paper> command.
+
 =item B<-portable>
 
 Install for portable use, e.g., on a USB stick.  Also selectable from
@@ -2969,6 +3157,58 @@
 Include verbose debugging messages; repeat for maximum debugging: C<-v
 -v>.  (Further repeats are accepted but ignored.)
 
+=item B<-texdir> I<dir>
+
+Specify the system installation directory; the default is
+C</usr/local/texlive/YYYY> for release YYYY. Specifying this option also
+causes the C<TEXMFLOCAL>, C<TEXMFSYSCONFIG>, and C<TEXMFSYSVAR>
+directories to be set as subdirectories, so they don't have to be set
+individually.
+
+For more on the several directory trees set up by default, see the main
+TeX Live documentation at L<https://tug.org/texlive/doc>.
+
+=item B<-texuserdir> I<dir>
+
+Specify the user installation directory; the default is
+C<~/.texliveYYYY> (except on Macs, where there is no leading dot).
+Specifying this also causes the C<TEXMFHOME>, C<TEXMFCONFIG>, and
+C<TEXMFVAR> directories to be set as subdirectories.
+
+=item B<-texmflocal> I<dir>
+
+Specify the C<TEXMFLOCAL> directory; the default is
+C</usr/local/texlive/texmf-local>, that is, one level up from the main
+installation. This is so locally-installed packages can be easily used
+across releases, which is usually desirable. Specifying the C<-texdir>
+option changes this, putting C<TEXMFLOCAL> under the main tree, on the
+theory that you want to use some setup different than the default. The
+C<-texmflocal> option can be used to specify an explicit directory for it.
+
+Anything installed here must follow the TeX directory structure (TDS),
+e.g., C<TEXMFHOME/tex/latex/mypkg/mypkg.sty>. See the TDS reference at
+L<https://tug.org/tds>.
+
+=item B<-texmfhome> I<dir>
+
+Specify the C<TEXMFHOME> directory; the default is C<~/texmf>, except on
+Macs, where it is C<~/Library/texmf>. Analogously to C<TEXMFLOCAL>, the
+C<-texuserdir> option changes this default.
+
+Also as with C<TEXMFLOCAL>, anything installed here must follow the TDS.
+
+=item B<-texmfsysconfig> I<dir>
+
+=item B<-texmfsysvar> I<dir>
+
+Specify the C<TEXMFSYSCONFIG> and C<TEXMFSYSVAR> system directories.
+
+=item B<-texmfconfig> I<dir>
+
+=item B<-texmfvar> I<dir>
+
+Specify the C<TEXMFCONFIG> and C<TEXMFVAR> user directories.
+
 =item B<-version>, B<--version>
 
 Output version information and exit.  If C<-v> is also given, the
@@ -3065,8 +3305,15 @@
 
 =item C<instopt_portable> (default 0)
 
-Install for portable use, e.g., on a USB stick.
+Install for portable use, e.g., on a USB stick, without touching the
+host system. Specifically, this forces the user directories
+C<TEXMFHOME>, C<TEXMFCONFIG>, C<TEXMFVAR> to be identical to the system
+directories C<TEXMFLOCAL>, C<TEXMFSYSCONFIG>, C<TEXMFSYSVAR>,
+respectively (regardless of other options and environment variable.)
 
+In addition, on Windows, it disables the desktop integration, path
+adjustment, and file associations actions usually performed.
+
 =item C<instopt_write18_restricted> (default 1)
 
 Enable C<\write18> for a restricted set of programs.
@@ -3112,15 +3359,6 @@
 For more details on all of the above options, consult the TeX Live
 installation manual, linked from L<https://tug.org/texlive/doc>.
 
-=head1 SPACE CONSTRAINTS
-
-If a POSIX-compliant C<df> program (supporting C<-P>) is available, the
-installer will check the available disk space in the selected
-installation location, and will abort installation if there is
-insufficient disk space, plus a margin of 100MB. In case this check is
-invalid for your filesystem, setting the environment variable
-C<TEXLIVE_INSTALL_NO_DISKCHECK> to 1 will disable it.
-
 =head1 ENVIRONMENT VARIABLES
 
 For ease in scripting and debugging, C<install-tl> looks for the
@@ -3151,7 +3389,12 @@
 
 =item C<TEXLIVE_INSTALL_NO_DISKCHECK>
 
-Omit free disk space check.
+If set to 1, omit free disk space check. By default, if a
+POSIX-compliant C<df> program (supporting C<-P>) is available, the
+installer checks for available disk space in the selected installation
+location, and will abort installation if there is insufficient disk
+space, plus a margin of 100MB. An equivalent check is made on Windows
+(not involving C<df>).
 
 =item C<TEXLIVE_INSTALL_NO_RESUME>
 
@@ -3186,9 +3429,9 @@
 to C</usr/local/texlive>. All the defaults can be seen by running the
 installer interactively and then typing C<D> for the directory menu.
 
-To override the so-called C<TEXDIR>, which defaults to the release
-directory within that prefix, e.g., C</usr/local/texlive/2020>, use a
-profile file (q.v.).
+The various command line options for specifying directories override
+these environment variables; since specifying both is usually
+accidental, a warning is given if the values are different.
 
 =item C<NOPERLDOC>
 

Modified: trunk/Master/tlpkg/TeXLive/TLUtils.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLUtils.pm	2022-06-12 23:54:07 UTC (rev 63570)
+++ trunk/Master/tlpkg/TeXLive/TLUtils.pm	2022-06-13 01:11:19 UTC (rev 63571)
@@ -43,6 +43,8 @@
   TeXLive::TLUtils::run_cmd($cmd [, @envvars ]);
   TeXLive::TLUtils::system_pipe($prog, $infile, $outfile, $removeIn, @args);
   TeXLive::TLUtils::diskfree($path);
+  TeXLive::TLUtils::get_user_home();
+  TeXLive::TLUtils::expand_tilde($str);
 
 =head2 File utilities
 
@@ -234,6 +236,8 @@
     &run_cmd
     &system_pipe
     &diskfree
+    &get_user_home
+    &expand_tilde
     &announce_execute_actions
     &add_symlinks
     &remove_symlinks
@@ -868,7 +872,7 @@
   }
   $td .= "/" if ($td !~ m!/$!);
   return (-1) if (! -e $td);
-  debug("Checking for free diskspace in $td\n");
+  debug("checking diskfree() in $td\n");
   ($output, $retval) = run_cmd("df -P \"$td\"", POSIXLY_CORRECT => 1);
   if ($retval == 0) {
     # Output format should be this:
@@ -876,16 +880,47 @@
     # /dev/sdb3       6099908248 3590818104 2406881416      60% /home
     my ($h,$l) = split(/\n/, $output);
     my ($fs, $nrb, $used, $avail, @rest) = split(' ', $l);
-    debug("disk space: used=$used (512-block), avail=$avail (512-block)\n");
+    debug("diskfree: used=$used (512-block), avail=$avail (512-block)\n");
     # $avail is in 512-byte blocks, so we need to divide by 2*1024 to
     # obtain Mb. Require that at least 100M remain free.
     return (int($avail / 2048));
   } else {
-    # error in running df -P out of whatever reason
+    # error in running df -P for whatever reason
     return (-1);
   }
 }
 
+=item C<get_user_home()>
+
+Returns the current user's home directory (C<$HOME> on Unix,
+C<$USERPROFILE> on Windows, and C<~> if none of the two are
+set. Save in package variable C<$user_home_dir> after computing.
+
+=cut
+
+# only search for home directory once, and save expansion here
+my $user_home_dir;
+
+sub get_user_home {
+  return $user_home_dir if ($user_home_dir);
+  $user_home_dir = getenv (win32() ? 'USERPROFILE' : 'HOME') || '~';
+  return $user_home_dir;
+}
+
+=item C<expand_tilde($str)>
+
+Expands initial C<~> with the user's home directory in C<$str> if
+available, else leave C<~> in place.
+
+=cut
+
+sub expand_tilde {
+  my $str = shift;
+  my $h = get_user_home();
+  $str =~ s/^~/$h/;
+  return $str;
+}
+
 =back
 
 =head2 File utilities

Modified: trunk/Master/tlpkg/dev/profiles/TLbookpub.pro
===================================================================
--- trunk/Master/tlpkg/dev/profiles/TLbookpub.pro	2022-06-12 23:54:07 UTC (rev 63570)
+++ trunk/Master/tlpkg/dev/profiles/TLbookpub.pro	2022-06-13 01:11:19 UTC (rev 63571)
@@ -1,4 +1,4 @@
-# $Id: TLbasic.pro 59636 2021-06-19 15:12:23Z karl $
+# $Id$
 selected_scheme scheme-bookpub
 TEXDIR /tmp/ki
 TEXMFCONFIG /tmp/ki/user/conf
@@ -9,7 +9,7 @@
 TEXMFSYSVAR /tmp/ki/sys/var
 binary_x86_64-linux 1
 option_desktop_integration 0
-option_doc 1
+option_doc 0
 option_file_assocs 0
 option_fmt 1
 option_letter 0


Property changes on: trunk/Master/tlpkg/dev/profiles/TLbookpub.pro
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision
\ No newline at end of property
Modified: trunk/Master/tlpkg/installer/install-menu-text.pl
===================================================================
--- trunk/Master/tlpkg/installer/install-menu-text.pl	2022-06-12 23:54:07 UTC (rev 63570)
+++ trunk/Master/tlpkg/installer/install-menu-text.pl	2022-06-13 01:11:19 UTC (rev 63571)
@@ -623,10 +623,7 @@
   $answer =~ s!\\!/!g if win32();  # switch to forward slashes
 
   if (!$noexpansion) {
-    my $home = getenv('HOME');
-    $home = getenv('USERPROFILE') if win32();
-    $home ||= '~';
-    $answer =~ s/^~/$home/;          # $home expansion
+    $answer = TeXLive::TLUtils::expand_tilde($answer);
   }
 
   if ($answer !~ m/^~/) {
@@ -723,7 +720,7 @@
 
   clear_screen;
 
-  my @text=html2text "$installer_help";
+  my @text=html2text ($installer_help);
   my $lines=(@text);
   my $overlap=3;
   my $lps=32; # lines per screen - overlap
@@ -844,9 +841,7 @@
 
   if (unix()) {
     if (("\u$answer" eq 'L') and !$vars{'instopt_portable'}) {
-      my $home = getenv('HOME');
-      $home = getenv('USERPROFILE') if (win32());
-      $home ||= '~';
+      my $home = TeXLive::TLUtils::get_user_home();
       toggle 'instopt_adjustpath';
       if ($vars{'instopt_adjustpath'}) {
         print "New value for binary directory [$sys_bin]: ";
@@ -874,9 +869,7 @@
     }
   } else {
     if (("\u$answer" eq 'L') and !$vars{'instopt_portable'}) {
-      my $home = getenv('HOME');
-      $home = getenv('USERPROFILE') if (win32());
-      $home ||= '~';
+      my $home = TeXLive::TLUtils::get_user_home;
       toggle 'instopt_adjustpath';
       return $command{'self'};
     }



More information about the tex-live-commits mailing list.