diff options
author | Siep Kroonenberg <siepo@cybercomm.nl> | 2008-06-08 21:03:34 +0000 |
---|---|---|
committer | Siep Kroonenberg <siepo@cybercomm.nl> | 2008-06-08 21:03:34 +0000 |
commit | bc133295dbbb37984c044e20bdb3b22c67771251 (patch) | |
tree | cee6ace2f758744da9b43af80c5947a3d5e27584 /Master/install-tl | |
parent | 140b6e1d7a8b6d16562c38927815d1591976191c (diff) |
Support for real installation for running from dvd, non-gui install.
Added cachedir tag to fonts.conf.
git-svn-id: svn://tug.org/texlive/trunk@8603 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/install-tl')
-rwxr-xr-x | Master/install-tl | 231 |
1 files changed, 139 insertions, 92 deletions
diff --git a/Master/install-tl b/Master/install-tl index 89fd8772c6e..86332fdb85f 100755 --- a/Master/install-tl +++ b/Master/install-tl @@ -109,8 +109,6 @@ my $default_scheme='scheme-full'; our @collections_std; our @collections_lang; our @collections_lang_doc; -# for win dealing -#our $Registry; # The global variable %vars is an associative list which contains all # variables and their values which can be changed by the user. # needs to be our since TeXLive::TLUtils uses it @@ -137,6 +135,7 @@ our %vars=( # 'n_' means 'number of'. 'src_splitting_supported' => 1, 'doc_splitting_supported' => 1, 'selected_scheme' => $default_scheme, + 'from_dvd' => 0, ); # @@ -145,6 +144,7 @@ process_logging_options(); # option handling my $opt_media = ""; +my $opt_from_dvd = ""; my $opt_url = ""; my $opt_profile = ""; my $opt_no_cls=0; @@ -161,6 +161,7 @@ $opt_gui = 1 if (win32); $::lang = "en"; GetOptions("media=s" => \$opt_media, + "from_dvd" => \$opt_from_dvd, "profile=s"=> \$opt_profile, "no-cls", "gui", \$opt_gui, @@ -230,6 +231,8 @@ my $finished = 0; my $system_tmpdir=get_system_tmpdir(); +# a couple of special uses of install-tl: + if ($opt_arch) { print platform; exit 0; @@ -279,6 +282,8 @@ if ($opt_arch) { exit 0; } +# continuing with normal install + info("Platform: ", platform, " => \'", platform_desc(platform), "\'\n"); if (media() eq "DVD") { info("Distribution: live (uncompressed)\n"); @@ -293,6 +298,13 @@ info("Directory for Temporary Files: '", $system_tmpdir, "\'\n"); info("Installer Directory: '$::installerdir'\n"); initialize_installer(); + +if ($opt_from_dvd and ($::_media_ ne "DVD")) { + print "Not running from DVD; 'from_dvd' option not applicable\n"; + $opt_from_dvd = 0; +} +$vars{'from_dvd'} = $opt_from_dvd; + setup_programs("$::installerdir/tlpkg/installer", "$::_platform_"); load_tlpdb(); @@ -374,13 +386,13 @@ if (!$finished) { # now open the log file and write out the log lines # try to open a log file -if (open(LOGF,">$vars{'TEXDIR'}/install-tl.log")) { +if (open(LOGF,">$vars{'TEXDIRW'}/install-tl.log")) { $::LOGFILE = \*LOGF; foreach my $line(@::LOGLINES) { print $::LOGFILE "$line"; } } else { - warn("Cannot create log file $vars{'TEXDIR'}/install-tl.log: $!\nNot writing out log lines!\n"); + warn("Cannot create log file $vars{'TEXDIRW'}/install-tl.log: $!\nNot writing out log lines!\n"); } # dump various things to the log file @@ -395,12 +407,18 @@ if (defined($::LOGFILE)) { dump_vars("$system_tmpdir/texlive.vars"); # write the profile out -create_profile("$vars{'TEXDIR'}/$InfraLocation/texlive.profile"); -debug("Profile written to $vars{'TEXDIR'}/$InfraLocation/texlive.profile\n"); - +if ($vars{'from_dvd'}) { + create_profile("$vars{'TEXDIRW'}/texlive.profile"); + debug("Profile written to $vars{'TEXDIRW'}/texlive.profile\n"); +} else { + 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); +print "Don't forget to set TEXMFSYSVAR to ".$vars{'TEXMFSYSVAR'}."!!!\n" + if ($vars{'from_dvd'} and !win32()); exit(0); @@ -413,24 +431,29 @@ exit(0); sub do_installation { # do the actual installation - foreach my $h (@::start_install_hook) { + my $h; + foreach $h (@::start_install_hook) { &$h(); } - calc_depends(); prepare_installation(); - save_options_into_tlpdb(); - do_install_packages(); + if (!$vars{'from_dvd'}) { + calc_depends(); + save_options_into_tlpdb(); + do_install_packages(); + } if (win32()) { add_texbindir_to_path($vars{'TEXDIR'}.'/bin/win32'); + setenv_reg('TEXMFSYSVAR', $vars{'TEXMFSYSVAR'}) if $vars{'from_dvd'}; broadcast_env(); - create_uninstaller($vars{'TEXDIR'}); + create_uninstaller($vars{'TEXDIR'}, $vars{'TEXDIRW'}, + $vars{'TEXMFSYSVAR'}, $vars{'TEXMFSYSCONFIG'}); } - foreach my $h (@::start_postinst_hook) { + foreach $h (@::start_postinst_hook) { &$h(); } do_postinst_stuff(); - $localtlpdb->save; - foreach my $h (@::end_install_hook) { + $localtlpdb->save unless $vars{'from_dvd'}; + foreach $h (@::end_install_hook) { &$h(); } } @@ -489,19 +512,22 @@ sub set_texlive_default_dirs { } else { $tex_prefix||='/usr/local/texlive'; } - $vars{'TEXDIR'}="$tex_prefix/$texlive_release"; + $vars{'TEXDIRW'}="$tex_prefix/$texlive_release"; $texmfsysvar=getenv('TEXLIVE_INSTALL_TEXMFSYSVAR'); - $texmfsysvar||=$vars{'TEXDIR'} . '/texmf-var'; - $vars{'TEXMFSYSVAR'}="$texmfsysvar"; + $texmfsysvar||=$vars{'TEXDIRW'} . '/texmf-var'; + $vars{'TEXMFSYSVAR'}=$texmfsysvar; $texmfsysconfig=getenv('TEXLIVE_INSTALL_TEXMFSYSCONFIG'); - $texmfsysconfig||=$vars{'TEXDIR'} . '/texmf-config'; - $vars{'TEXMFSYSCONFIG'}="$texmfsysconfig"; + $texmfsysconfig||=$vars{'TEXDIRW'} . '/texmf-config'; + $vars{'TEXMFSYSCONFIG'}=$texmfsysconfig; $texmflocal=getenv('TEXLIVE_INSTALL_TEXMFLOCAL'); $texmflocal||="$tex_prefix/texmf-local"; - $vars{'TEXMFLOCAL'}="$texmflocal"; + $vars{'TEXMFLOCAL'}=$texmflocal; + + $vars{'TEXDIR'} = $vars{'from_dvd'} ? abs_path($::installerdir) : + $vars{'TEXDIRW'}; $texmfhome=getenv('TEXLIVE_INSTALL_TEXMFHOME'); $texmfhome ||= "~"; @@ -513,6 +539,8 @@ sub calc_depends { # always be installed since the default is scheme-full which selects # all packages and never deselects it %install=(); + my $p; + my $a; # initialize the %install hash with what should be installed @@ -565,12 +593,12 @@ sub calc_depends { ddebug("initial number of installations: $#pre_selected\n"); # loop over all the pre_selected and add them - foreach my $p (@pre_selected) { + foreach $p (@pre_selected) { ddebug("pre_selected $p\n"); foreach my $p_dep ($tlpdb->get_package($p)->depends) { if ($p_dep =~ m/^(.*)\.ARCH$/) { my $foo = "$1"; - foreach my $a (@archs) { + foreach $a (@archs) { $install{"$foo.$a"} = 1; } } elsif ($p_dep =~ m/^(.*)\.win32$/) { @@ -597,7 +625,7 @@ sub calc_depends { # now do the size computation my $size = 0; - foreach my $p (keys %install) { + foreach $p (keys %install) { my $tlpobj = $tlpdb->get_package($p); if (not(defined($tlpobj))) { die "Cannot find $p in texlive.tlpdb, strange!\n"; @@ -605,7 +633,7 @@ sub calc_depends { $size+=$tlpobj->docsize if $vars{'option_doc'}; $size+=$tlpobj->srcsize if $vars{'option_src'}; $size+=$tlpobj->runsize; - foreach my $a (@archs) { + foreach $a (@archs) { $size += $tlpobj->binsize->{$a} if defined($tlpobj->binsize->{$a}); } } @@ -728,6 +756,7 @@ sub create_profile { print $fh "$key $vars{$key}\n" if $key=~/^option_fmt/; print $fh "$key $vars{$key}\n" if $key=~/^option_src/; print $fh "$key $vars{$key}\n" if $key=~/^option_symlinks/; + print $fh "$key $vars{$key}\n" if $key=~/^TEXDIRW/; print $fh "$key $vars{$key}\n" if $key=~/^TEXDIR/; print $fh "$key $vars{$key}\n" if $key=~/^TEXMFSYSVAR/; print $fh "$key $vars{$key}\n" if $key=~/^TEXMFSYSCONFIG/; @@ -760,10 +789,14 @@ sub read_profile { sub prepare_installation { make_var_skeleton "$vars{'TEXMFSYSVAR'}"; make_local_skeleton "$vars{'TEXMFLOCAL'}"; - mkdirhier "$vars{'TEXDIR'}/texmf-config"; + mkdirhier "$vars{'TEXMFSYSCONFIG'}"; - $localtlpdb=new TeXLive::TLPDB; - $localtlpdb->root("$vars{'TEXDIR'}"); + if ($vars{'from_dvd'}) { + $localtlpdb = $tlpdb; + } else { + $localtlpdb=new TeXLive::TLPDB; + $localtlpdb->root("$vars{'TEXDIR'}"); + } } @@ -797,7 +830,7 @@ sub save_options_into_tlpdb { } } $localtlpdb->option_available_archs(@archs); - $localtlpdb->save(); + $localtlpdb->save() unless $vars{'from_dvd'}; } # do_postinst_stuff has to fix up the texmf tree and install some missing @@ -805,11 +838,13 @@ sub save_options_into_tlpdb { # of former times, and should be critically checked. sub do_postinst_stuff { my $TEXDIR="$vars{'TEXDIR'}"; + my $TEXDIRW="$vars{'TEXDIRW'}"; my $TEXMFSYSVAR="$vars{'TEXMFSYSVAR'}"; my $TEXMFSYSCONFIG="$vars{'TEXMFSYSCONFIG'}"; my $TEXMFLOCAL="$vars{'TEXMFLOCAL'}"; + my $tmv; - do_texmf_cnf() unless $opt_portable; + do_texmf_cnf() unless ($opt_portable); # final program execution @@ -820,10 +855,6 @@ sub do_postinst_stuff { # - run the programs # Step 1: Clean the environment - #my @TMFVARS=qw(VARTEXFONTS TEXMFMAIN TEXMFDIST TEXMFLOCAL TEXMFSYSVAR - # TEXMFSYSCONFIG TEXMFHOME TEXMFVAR TEXMFCONFIG TEXMF SYSTEXMF VARTEXFONTS - # TEXMFDBS WEB2C TEXINPUTS TEXFORMATS MFBASES MPMEMS TEXPOOL MFPOOL MPPOOL - # PSHEADERS TEXFONTMAPS TEXPSHEADERS TEXCONFIG TEXMFCNF); my @TMFVARS0=qw(VARTEXFONTS TEXMF SYSTEXMF VARTEXFONTS TEXMFDBS WEB2C TEXINPUTS TEXFORMATS MFBASES MPMEMS TEXPOOL MFPOOL MPPOOL @@ -837,16 +868,17 @@ You should know what you are doing. We will remove that for the post install actions, but all further operations might be disturbed.\n\n"; } - foreach my $tmv (@TMFVARS0) { + foreach $tmv (@TMFVARS0) { delete $ENV{$tmv} if (defined($ENV{$tmv})); } if (!$opt_portable) { - foreach my $tmv (@TMFVARS1) { + foreach $tmv (@TMFVARS1) { delete $ENV{$tmv} if (defined($ENV{$tmv})); } } + $ENV{'TEXMFSYSVAR'} = $vars{'TEXMFSYSVAR'} if $vars{'from_dvd'}; - # Step 2: Setup the PATH, PATHEXT, switch to the new Perl + # Step 2: Setup the PATH, switch to the new Perl my $pathsep=(win32)? ';' : ':'; my $plat_bindir="$TEXDIR/bin/$vars{'this_platform'}"; @@ -870,8 +902,8 @@ operations might be disturbed.\n\n"; if (win32) { #$ENV{'PATHEXT'}=".texlua;" . "$ENV{'PATHEXT'}"; - $ENV{'TEXBINDIR'}=$TEXDIR . "\\bin\\win32"; - $ENV{'TEXBINDIR'} =~ s!/!\\!g; + #$ENV{'TEXBINDIR'}=$TEXDIR . "\\bin\\win32"; + #$ENV{'TEXBINDIR'} =~ s!/!\\!g; $ENV{'PERL5LIB'}="$perl_libdir"; } @@ -880,19 +912,22 @@ operations might be disturbed.\n\n"; # # (re-)initialize batchfile for uninstalling shortcuts - init_unshortbat($vars{'TEXDIR'}) if win32; + if (win32()) { + mkdirhier("$TEXDIRW/tlpkg/installer") if $vars{'from_dvd'}; + init_unshortbat($TEXDIRW); + } foreach my $package (sort keys %install) { if ($install{$package} && defined($PostInstall{$package})) { info("running post install action for $package\n"); - &{$PostInstall{$package}}($TEXDIR, $TEXMFSYSVAR, $TEXMFLOCAL); + &{$PostInstall{$package}}($TEXDIR, $TEXDIRW, $TEXMFSYSVAR, $TEXMFLOCAL); } } update_assocs() if win32(); # Step 4: run the programs - if (!$opt_portable) { + if (!$opt_portable and !$vars{'from_dvd'}) { info("running mktexlsr $TEXDIR/texmf-dist $TEXDIR/texmf\n"); system('mktexlsr', "$TEXDIR/texmf-dist", "$TEXDIR/texmf"); } @@ -902,17 +937,18 @@ operations might be disturbed.\n\n"; # $localtlpdb and this is simple code, so do it directly, i.e., duplicate # the code from the various generate-*.pl scripts info("writing fmtutil.cnf data to $TEXMFSYSVAR/web2c/fmtutil.cnf\n"); - TeXLive::TLUtils::create_fmtutil($localtlpdb, + my $tlp = $vars{'from_dvd'} ? $tlpdb : $localtlpdb; + TeXLive::TLUtils::create_fmtutil($tlp, #$localtlpdb, "$TEXMFSYSVAR/web2c/fmtutil.cnf", "$TEXMFLOCAL/web2c/fmtutil-local.cnf"); info("writing updmap.cfg to $TEXMFSYSVAR/web2c/updmap.cfg\n"); - TeXLive::TLUtils::create_updmap ($localtlpdb, + TeXLive::TLUtils::create_updmap ($tlp, #$localtlpdb, "$TEXMFSYSVAR/web2c/updmap.cfg", "$TEXMFLOCAL/web2c/updmap-local.cfg"); info("writing language.dat data to $TEXMFSYSVAR/tex/generic/config/language.dat\n"); - TeXLive::TLUtils::create_language($localtlpdb, + TeXLive::TLUtils::create_language($tlp, #$localtlpdb, "$TEXMFSYSVAR/tex/generic/config/language.dat", "$TEXMFLOCAL/tex/generic/config/language-local.dat"); @@ -992,57 +1028,68 @@ operations might be disturbed.\n\n"; # we have to adjust the texmf.cnf file to the paths set in the configuration! sub do_texmf_cnf { - open(TMF,"<$vars{'TEXDIR'}/texmf/web2c/texmf.cnf") - or die("$vars{'TEXDIR'}/texmf/web2c/texmf.cnf not found: $!\n"); - my @texmfcnflines = <TMF>; - close(TMF); - my @newtmf; - # we have to find TEXMFLOCAL TEXMFSYSVAR and TEXMFHOME - foreach my $line (@texmfcnflines) { - if ($line =~ m/^TEXMFLOCAL/) { - # by default TEXMFLOCAL = TEXDIR/../texmf-local, if this is the case - # we don't have to change anything from the default - my $deftmlocal = dirname($vars{'TEXDIR'}); - $deftmlocal .= "/texmf-local"; - if ("$vars{'TEXMFLOCAL'}" eq "$deftmlocal") { - push @newtmf, $line; - } else { - push @newtmf, "TEXMFLOCAL = $vars{'TEXMFLOCAL'}\n"; - } - } elsif ($line =~ m/^TEXMFSYSVAR/) { - # by default TEXMFSYSVAR = TEXDIR/texmf-var, if this is the case - # we don't have to change anything from the default - if ("$vars{'TEXMFSYSVAR'}" eq "$vars{'TEXDIR'}/texmf-var") { - push @newtmf, $line; - } else { - push @newtmf, "TEXMFSYSVAR = $vars{'TEXMFSYSVAR'}\n"; - } - } elsif ($line =~ m/^TEXMFSYSCONFIG/) { - # by default TEXMFSYSCONFIG = TEXDIR/texmf-config, if this is the case - # we don't have to change anything from the default - if ("$vars{'TEXMFSYSCONFIG'}" eq "$vars{'TEXDIR'}/texmf-config") { - push @newtmf, $line; - } else { - push @newtmf, "TEXMFSYSCONFIG = $vars{'TEXMFSYSCONFIG'}\n"; - } - } elsif ($line =~ m/^TEXMFHOME/) { - # kpse now expands ~ to USERPROFILE, so we don't treat win32 and - # unix differently - push @newtmf, "TEXMFHOME = $vars{'TEXMFHOME'}\n"; - } elsif ($line =~ m/^OSFONTDIR/) { - if (win32()) { - push @newtmf, "OSFONTDIR = \$SystemRoot/fonts//\n"; + if (!$vars{'from_dvd'}) { + open(TMF,"<$vars{'TEXDIR'}/texmf/web2c/texmf.cnf") + or die("$vars{'TEXDIR'}/texmf/web2c/texmf.cnf not found: $!\n"); + my @texmfcnflines = <TMF>; + close(TMF); + my @newtmf; + # we have to find TEXMFLOCAL TEXMFSYSVAR and TEXMFHOME + foreach my $line (@texmfcnflines) { + if ($line =~ m/^TEXMFLOCAL/) { + # by default TEXMFLOCAL = TEXDIR/../texmf-local, if this is the case + # we don't have to change anything from the default + my $deftmlocal = dirname($vars{'TEXDIR'}); + $deftmlocal .= "/texmf-local"; + if ("$vars{'TEXMFLOCAL'}" eq "$deftmlocal") { + push @newtmf, $line; + } else { + push @newtmf, "TEXMFLOCAL = $vars{'TEXMFLOCAL'}\n"; + } + } elsif ($line =~ m/^TEXMFSYSVAR/) { + # by default TEXMFSYSVAR = TEXDIR/texmf-var, if this is the case + # we don't have to change anything from the default + if ("$vars{'TEXMFSYSVAR'}" eq "$vars{'TEXDIR'}/texmf-var") { + push @newtmf, $line; + } else { + push @newtmf, "TEXMFSYSVAR = $vars{'TEXMFSYSVAR'}\n"; + } + } elsif ($line =~ m/^TEXMFSYSCONFIG/) { + # by default TEXMFSYSCONFIG = TEXDIR/texmf-config, if this is the case + # we don't have to change anything from the default + if ("$vars{'TEXMFSYSCONFIG'}" eq "$vars{'TEXDIR'}/texmf-config") { + push @newtmf, $line; + } else { + push @newtmf, "TEXMFSYSCONFIG = $vars{'TEXMFSYSCONFIG'}\n"; + } + } elsif ($line =~ m/^TEXMFHOME/) { + # kpse now expands ~ to USERPROFILE, so we don't treat win32 and + # unix differently + push @newtmf, "TEXMFHOME = $vars{'TEXMFHOME'}\n"; + } elsif ($line =~ m/^OSFONTDIR/) { + if (win32()) { + push @newtmf, "OSFONTDIR = \$SystemRoot/fonts//\n"; + } else { + push @newtmf, $line; + } } else { push @newtmf, $line; } - } else { - push @newtmf, $line; } + open(TMF,">$vars{'TEXDIR'}/texmf/web2c/texmf.cnf") + or die("Can't open $vars{'TEXDIR'}/texmf/web2c/texmf.cnf for writing: $!\n"); + foreach (@newtmf) { print TMF; } + close(TMF); + } else { # $vars{'from_dvd'} + open(TMF,">$vars{'TEXMFSYSVAR'}/web2c/texmf.cnf") + or die( + "Cannot open $vars{'TEXMFSYSVAR'}/web2c/texmf.cnf for writing: $!\n"); + print TMF "TEXMFLOCAL = $vars{'TEXMFLOCAL'}\n"; + # skip TEXMFSYSVAR since it has to be defined by an env var anyway + print TMF "TEXMFSYSCONFIG = $vars{'TEXMFSYSCONFIG'}\n"; + print TMF "TEXMFHOME = $vars{'TEXMFHOME'}\n"; + print TMF "OSFONTDIR = \$SystemRoot/fonts//\n" if win32(); } - open(TMF,">$vars{'TEXDIR'}/texmf/web2c/texmf.cnf") - or die("Can't open $vars{'TEXDIR'}/texmf/web2c/texmf.cnf for writing: $!\n"); - foreach (@newtmf) { print TMF; } - close(TMF); } # @@ -1069,7 +1116,7 @@ sub select_scheme { } } } - # we have first set all collection-* keys to zero and than + # we have first set all collection-* keys to zero and than # set to 1 only those which are required by the scheme # since now scheme asks for collection-wintools we set its vars value # to 1 in case we are installing win32 binaries |