From 0402f14f8d60fd3b46a00e4f81a2bbe925565b2b Mon Sep 17 00:00:00 2001 From: Piotr Strzelczyk Date: Fri, 25 Jun 2010 00:57:36 +0000 Subject: portable installation option (changes handling of -portable switch) git-svn-id: svn://tug.org/texlive/trunk@19149 c570f23f-e606-0410-a88d-b1316a301751 --- Master/install-tl | 101 ++++++++++++++++-------------------------------------- 1 file changed, 29 insertions(+), 72 deletions(-) (limited to 'Master/install-tl') diff --git a/Master/install-tl b/Master/install-tl index 3469697aee1..6a0b83d3857 100755 --- a/Master/install-tl +++ b/Master/install-tl @@ -143,6 +143,7 @@ our %vars=( # 'n_' means 'number of'. 'doc_splitting_supported' => 1, 'selected_scheme' => $default_scheme, 'from_dvd' => 0, + 'portable' => 0, ); # option handling @@ -305,8 +306,6 @@ our @media_available; if ($opt_print_arch) { print platform()."\n"; exit 0; -} elsif ($opt_portable) { - &do_portable (); } @@ -443,6 +442,7 @@ if ($opt_from_dvd and ($media ne "DVD")) { $opt_from_dvd = 0; } $vars{'from_dvd'} = $opt_from_dvd; +$vars{'portable'} = $opt_portable; load_tlpdb(); @@ -569,6 +569,7 @@ if (!$finished) { # in case it is the root of a drive $vars{'TEXDIR'} =~ s![/\\]$!!; $vars{'TEXDIRW'} =~ s![/\\]$!!; + sanitise_options(); info("Installing to: $vars{TEXDIRW}\n"); do_installation(); } @@ -647,7 +648,7 @@ sub do_postinst_stuff { my $TEXMFLOCAL="$vars{'TEXMFLOCAL'}"; my $tmv; - do_texmf_cnf() unless ($opt_portable); + do_texmf_cnf(); # # clean up useless files in texmf-dist/tlpkg as this is only @@ -677,7 +678,7 @@ sub do_postinst_stuff { my @TMFVARS1=qw(TEXMFMAIN TEXMFDIST TEXMFLOCAL TEXMFSYSVAR TEXMFSYSCONFIG TEXMFVAR TEXMFCONFIG TEXMFHOME TEXMFCACHE); - if (defined($ENV{'TEXMFCNF'}) and !$vars{'from_dvd'} and !$opt_portable) { + if (defined($ENV{'TEXMFCNF'}) and !$vars{'from_dvd'} and !$vars{'portable'}) { print "WARNING: environment variable TEXMFCNF is set. You should know what you are doing. We will remove that for the post install actions, but all further @@ -749,19 +750,16 @@ operations might be disturbed.\n\n"; debug 'Effective TEXMFCNF: '.`kpsewhich -expand-path=\$TEXMFCNF`."\n"; } - # TODO: can the following two clauses be merged? - if (win32()) { + if (win32() and !$vars{'portable'}) { create_uninstaller($vars{'TEXDIR'}, $vars{'TEXDIRW'}, $vars{'TEXMFSYSVAR'}, $vars{'TEXMFSYSCONFIG'}); - } - # (re-)initialize batchfile for uninstalling shortcuts - if (win32() and !$opt_portable) { + # (re-)initialize batchfile for uninstalling shortcuts mkdirhier("$TEXDIRW/tlpkg/installer") if $vars{'from_dvd'}; } # Step 4: run the programs - if (!$opt_portable and !$vars{'from_dvd'}) { + if (!$vars{'from_dvd'}) { info("running mktexlsr $TEXDIR/texmf-dist $TEXDIR/texmf\n"); system('mktexlsr', "$TEXDIR/texmf-dist", "$TEXDIR/texmf"); } @@ -958,6 +956,10 @@ sub do_texmf_cnf { } } + if ($vars{'portable'}) { + push @changedtmf, "ASYMPTOTE_HOME = \$TEXMFCONFIG/asymptote\n"; + } + my ($TMF, $TMFLUA); if (!$vars{'from_dvd'}) { $TMF = ">$vars{'TEXDIR'}/texmf.cnf"; @@ -1100,6 +1102,13 @@ sub set_texlive_default_dirs { my $texmfconfig = getenv('TEXLIVE_INSTALL_TEXMFCONFIG'); $texmfconfig ||= "$texmfhome/.texlive$yyyy/texmf-config"; $vars{'TEXMFCONFIG'} = $texmfconfig; + + # for portable installation we want everything in one directory + if ($vars{'portable'} && !$vars{'from_dvd'}) { + $vars{'TEXMFHOME'} = "\$TEXMFLOCAL"; + $vars{'TEXMFVAR'} = "\$TEXMFSYSVAR"; + $vars{'TEXMFCONFIG'} = "\$TEXMFSYSCONFIG"; + } } sub calc_depends { @@ -1456,6 +1465,16 @@ sub read_profile { } } +# helper subroutine to do sanity check of options before installation +sub sanitise_options { + # from_dvd option overrides portable option + $vars{'portable'} &&= !$vars{'from_dvd'}; + # portable option overrides any system integration options + $vars{'option_path'} &&= !$vars{'portable'}; + $vars{'option_file_assocs'} &&= !$vars{'portable'}; + $vars{'option_desktop_integration'} &&= !$vars{'portable'}; +} + sub prepare_installation { make_var_skeleton "$vars{'TEXMFSYSVAR'}"; make_local_skeleton "$vars{'TEXMFLOCAL'}"; @@ -1830,68 +1849,6 @@ EOF } -# portable option, invoked from tl-portable script. -# -sub do_portable { - $::opt_verbosity = -1; - $::_platform_ = platform(); - $location = getenv('TEXDIR'); - die "$0: Don't use --portable directly; use tl-portable instead\n" - unless $location; - $vars{'TEXDIR'} = $location; - if (not -d $vars{'TEXDIR'}.'/bin/'.$::_platform_) { # shouldn't happen - die "$0: Platform ".$::_platform_." not supported."; - } - # set_platforms_supported(); - # set_texlive_default_dirs(); - $vars{'TEXDIRW'} = getenv('TEXDIRW'); - $vars{'TEXMFSYSVAR'} = getenv('TEXMFSYSVAR'); - $vars{'TEXMFSYSCONFIG'} = getenv('TEXMFSYSCONFIG'); - $vars{'TEXMFLOCAL'} = getenv('TEXMFLOCAL'); - $vars{'TEXMFHOME'} = getenv('TEXMFHOME'); - $vars{'TEXMFVAR'} = getenv('TEXMFVAR'); - $vars{'TEXMFCONFIG'} = getenv('TEXMFCONFIG'); - if (win32()) { - non_admin(); - my $winpath = "$vars{'TEXDIR'}/bin/win32"; - } - - our $PORTABLE_PROMPT_DONE = 0; # used in subroutine below - if (! -d "$vars{'TEXMFCONFIG'}" ) { - portable_prompt (); - mkdirhier "$vars{'TEXMFCONFIG'}"; - } - if (! -d "$vars{'TEXMFSYSCONFIG'}" ) { - portable_prompt (); - mkdirhier "$vars{'TEXMFSYSCONFIG'}"; - } - if (! -d "$vars{'TEXMFSYSVAR'}" ) { - portable_prompt (); - load_tlpdb(); - $localtlpdb = $tlpdb; - $texlive_release = $tlpdb->config_release; - make_var_skeleton "$vars{'TEXMFSYSVAR'}"; - # the usual option for pregenerating all formats doesn't apply - $vars{'option_fmt'} = 0; - do_postinst_stuff(); - } - - close($::LOGFILE) if defined($::LOGFILE); - print welcome(); - exit 0; - - - # Give the user a chance to bail before changing anything. - # (Nested subroutine.) - sub portable_prompt - { - return if $PORTABLE_PROMPT_DONE; - $PORTABLE_PROMPT_DONE = 1; - print "About to generate some files, press Enter to continue:"; - ; - } -} - # # some helper fucntion sub select_collections { -- cgit v1.2.3