texlive[48364] Master/install-tl: profile: accept path from profile
commits+preining at tug.org
commits+preining at tug.org
Tue Aug 7 02:39:58 CEST 2018
Revision: 48364
http://tug.org/svn/texlive?view=revision&revision=48364
Author: preining
Date: 2018-08-07 02:39:57 +0200 (Tue, 07 Aug 2018)
Log Message:
-----------
profile: accept path from profile with --init, bugs...
Modified Paths:
--------------
trunk/Master/install-tl
Modified: trunk/Master/install-tl
===================================================================
--- trunk/Master/install-tl 2018-08-07 00:23:56 UTC (rev 48363)
+++ trunk/Master/install-tl 2018-08-07 00:39:57 UTC (rev 48364)
@@ -1452,62 +1452,79 @@
# TEXLIVE_INSTALL_TEXMFVAR ~/.texlive2010/texmf-var
# TEXLIVE_INSTALL_TEXMFCONFIG ~/.texlive2010/texmf-config
-sub set_texlive_default_dirs {
- my $tex_prefix = $opt_in_place ? abs_path($::installerdir)
- : getenv('TEXLIVE_INSTALL_PREFIX');
- if (win32) {
- $tex_prefix ||= getenv('SystemDrive') . '/texlive';
- # we use SystemDrive because ProgramFiles requires admin rights
- # we don't use USERPROFILE here because that will be copied back and
- # forth on roaming profiles
- } else {
- $tex_prefix ||= '/usr/local/texlive';
+sub set_var_from_alternatives {
+ my ($whatref, @alternatives) = @_;
+ my $final;
+ while (@alternatives) {
+ my $el = pop @alternatives;
+ $final = $el if ($el);
}
- # for portable and in_place installation we want everything in one directory
- $vars{'TEXDIR'} = ($vars{'instopt_portable'} || $opt_in_place)
- ? $tex_prefix : "$tex_prefix/$texlive_release";
+ $$whatref = $final;
+}
- my $texmfsysvar = getenv('TEXLIVE_INSTALL_TEXMFSYSVAR');
- $texmfsysvar ||= $vars{'TEXDIR'} . '/texmf-var';
- $vars{'TEXMFSYSVAR'} = $texmfsysvar;
-
- my $texmfsysconfig = getenv('TEXLIVE_INSTALL_TEXMFSYSCONFIG');
- $texmfsysconfig ||= $vars{'TEXDIR'} . '/texmf-config';
- $vars{'TEXMFSYSCONFIG'}=$texmfsysconfig;
-
- my $texmflocal = getenv('TEXLIVE_INSTALL_TEXMFLOCAL');
- $texmflocal ||= "$tex_prefix/texmf-local";
- $vars{'TEXMFLOCAL'} = $texmflocal;
-
- $vars{'TEXDIR'} = $opt_in_place
- ? abs_path($::installerdir) : $vars{'TEXDIR'};
-
- my $texmfhome = getenv('TEXLIVE_INSTALL_TEXMFHOME');
- if (platform() =~ m/darwin/) {
- $texmfhome ||= "~/Library";
- } else {
- $texmfhome ||= "~";
+sub set_standard_var {
+ my ($what, $envstr, $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) {
+ tlwarn("Trying to define $what via conflicting settings\n");
+ tlwarn(" from profile: " . $vars{$what} . "\n");
+ tlwarn(" from envvar: $envvar ($envstr)\n");
+ tlwarn("Preferring the profile variable!\n");
+ $envvar = undef;
}
- $vars{'TEXMFHOME'} = "$texmfhome/texmf";
+ # default for most variables is in increasing priority
+ # - some default
+ # - setting from profile saved already in $vars{$what}
+ # - environment variable
+ set_var_from_alternatives( \$vars{$what},
+ $envvar,
+ $vars{$what},
+ $default);
+}
- # use the $texmfhome value just computed for these.
+sub set_texlive_default_dirs {
+ my $homedir = (platform() =~ m/darwin/) ? "~/Library" : "~";
my $yyyy = $TeXLive::TLConfig::ReleaseYear;
- my $texmfvar = getenv('TEXLIVE_INSTALL_TEXMFVAR');
- if (platform() =~ m/darwin/) {
- $texmfvar ||= "$texmfhome/texlive/$yyyy/texmf-var";
- } else {
- $texmfvar ||= "$texmfhome/.texlive$yyyy/texmf-var";
+ #
+ my $tlprefixenv = getenv('TEXLIVE_INSTALL_PREFIX');
+ if ($tlprefixenv && $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 setup basic path using two incompatible methods\n");
+ tlwarn(" from profile: " . $vars{'TEXDIR'} . "\n");
+ tlwarn(" from envvar: $tlprefixenv ('TEXLIVE_INSTALL_PREFIX')\n");
+ tlwarn("Preferring the profile variable!\n");
+ $tlprefixenv = undef;
}
- $vars{'TEXMFVAR'} = $texmfvar;
+ # first set $tex_prefix
+ my $tex_prefix;
+ set_var_from_alternatives( \$tex_prefix,
+ ($opt_in_place ? abs_path($::installerdir) : undef),
+ $tlprefixenv,
+ (win32() ? getenv('SystemDrive') . '/texlive' : '/usr/local/texlive'));
+ set_var_from_alternatives( \$vars{'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');
+ set_standard_var('TEXMFSYSCONFIG', 'TEXLIVE_INSTALL_TEXMFSYSCONFIG',
+ $vars{'TEXDIR'} . '/texmf-config');
+ set_standard_var('TEXMFLOCAL', 'TEXLIVE_INSTALL_TEXMFLOCAL',
+ "$tex_prefix/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");
- my $texmfconfig = getenv('TEXLIVE_INSTALL_TEXMFCONFIG');
- if (platform() =~ m/darwin/) {
- $texmfconfig ||= "$texmfhome/texlive/$yyyy/texmf-config";
- } else {
- $texmfconfig ||= "$texmfhome/.texlive$yyyy/texmf-config";
- }
- $vars{'TEXMFCONFIG'} = $texmfconfig;
-
# for portable installation we want everything in one directory
if ($vars{'instopt_portable'}) {
$vars{'TEXMFHOME'} = "\$TEXMFLOCAL";
More information about the tex-live-commits
mailing list