diff options
author | Norbert Preining <preining@logic.at> | 2007-11-29 15:30:40 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2007-11-29 15:30:40 +0000 |
commit | 495401a178913dd4622aacc25978c252a6a1ca91 (patch) | |
tree | 5e3bce0bc2dd29b352db950ed7d86014352b6e00 /Master/install-tl.pl | |
parent | 3ccc631fabfef36be01565d0de3b6c8bdee69a04 (diff) |
various fixes to the installer
git-svn-id: svn://tug.org/texlive/trunk@5650 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/install-tl.pl')
-rwxr-xr-x | Master/install-tl.pl | 108 |
1 files changed, 41 insertions, 67 deletions
diff --git a/Master/install-tl.pl b/Master/install-tl.pl index 0174f31bac8..5b9864c56bd 100755 --- a/Master/install-tl.pl +++ b/Master/install-tl.pl @@ -28,6 +28,7 @@ use TeXLive::TLUtils qw(initialize_installer media platform platform_desc use TeXLive::TLPOBJ; use TeXLive::TLPDB; use TeXLive::TLConfig; +use Getopt::Long; use Cwd; $default_scheme='scheme-full'; @@ -53,7 +54,7 @@ initialize_installer; # The global variable %vars is an associative list which contains all # variables and their values which can be changed by the user. -my %vars; +our %vars; sub dump_vars { my $filename=shift; @@ -1038,67 +1039,28 @@ sub prepare_installation { } -sub add_tlpcontainer { - my ($package, $ziplocation, $dest) = @_; - my $unpackprog; - my $cwd = getcwd; - if ($ziplocation !~ m,^/,) { - $ziplocation = "$cwd/$ziplocation"; - } - # WARNING: If you change the location of the texlive.tlpdb this - # has to be changed, too!! - die ("No destination given, bad!\n") unless (defined($dest)); - my $container = "$ziplocation/$package"; - if (-r "$container.zip") { - $container.=".zip"; - $unpackprog="unzip -o -qq $container -d $dest"; - } elsif (-r "$container.tar.lzma") { - $container.=".tar.lzma"; - $unpackprog="lzcat $container | tar -xf - -C $dest"; - die("lzma is checked for but not implemented, please edit TLPDB.pm\n"); - } else { - warn "Cannot find a package $package (.zip or .lzma) in $ziplocation\n"; - # should be die, only for testing +sub do_install_packages { + foreach my $package (sort keys %install) { + print "INSTALL $package\n" if ($install{$package} == 1); my $tlpobj=$::tlpdb->get_package($package); - return $tlpobj; - } -# warn "Huuu, this needs testing and error checking!\n"; -# warn "Should we use -a -- adapt line endings etc?\n"; -# No! Always use binmode. - `$unpackprog`; - my $tlpobj=$::tlpdb->get_package($package); - $::localtlpdb->add_tlpobj($tlpobj); - return $tlpobj; -} - -# container_location -# returns for every package (argument) the location of the respective -# containers. It also COULD download necessary packages and return a -# temporary location -# -# NOTE: It returns the DIRECTORY where the packages are present -# -sub container_location { - return "archive"; -} -sub install_files { - # for each package listed as a key of %install all the files contained - # in it - # we have to get the arch first: - my @archs; - foreach (keys %vars) { - if (m/^diskbin_(.*)$/ ) { - if ($vars{$_}) {push @archs, $1;} - } - if (m/^netbin_(.*)$/ ) { - if ($vars{$_}) {push @archs, $1;} + if (&media eq 'DVD') { + my @allfiles = $tlpobj->all_files; + install_package(@allfiles); + } elsif (&media eq 'CD') { + my $cwd = getcwd; + my $container = "$package"; + if (-r "$::installerdir/archive/$package.zip") { + $container = "$package.zip"; + } elsif (-r "$::installerdir/archive/$package.tar.lzma") { + $container = "$package.tar.lzma"; + } else { + die "Cannot find a package $package (.zip or .lzma) in $::installerdir/archive\n"; + } + install_package($container); + } elsif (&media eq 'NET') { + install_package("$package.$TeXLive::TLConfig::DefaultContainerExtension"); } - } - my $destination="$vars{TEXDIR}"; - foreach my $p (sort keys %install) { - print "INSTALL $p\n" if ($install{$p} == 1); - my $containerdir=container_location($p); - add_tlpcontainer($p, $containerdir, $destination); + $::localtlpdb->add_tlpobj($tlpobj); } $::localtlpdb->save; } @@ -1137,8 +1099,8 @@ sub parse_executes_and_create_files { # fmtutil.cnf -> TEXMFSYSVAR/web2c my @formatlines; foreach my $f (keys %fmtcnffiles) { - open(INFILE,"<$thisdir/texmf/fmtutil/format.$f.cnf") - or die("Cannot open $thisdir/texmf/fmtutil/format.$f.cnf"); + open(INFILE,"<$installerdir/texmf/fmtutil/format.$f.cnf") + or die("Cannot open $installerdir/texmf/fmtutil/format.$f.cnf"); my @tmp = <INFILE>; close(INFILE); push @formatlines, @tmp; @@ -1154,15 +1116,15 @@ sub parse_executes_and_create_files { # hyphenation patterns my @languagelines = (); # we first have to add language.us - open(INFILE,"<$thisdir/texmf/tex/generic/config/language.us") - or die("Cannot open $thisdir/texmf/tex/generic/config/language.us"); + open(INFILE,"<$installerdir/texmf/tex/generic/config/language.us") + or die("Cannot open $installerdir/texmf/tex/generic/config/language.us"); my @tmp = <INFILE>; close(INFILE); push @languagelines, @tmp; # now do the other languages foreach my $f (keys %hypcnffiles) { - open(INFILE,"<$thisdir/texmf/tex/generic/config/language.$f.dat") - or die("Cannot open $thisdir/texmf/tex/generic/config/language.$f.dat"); + open(INFILE,"<$installerdir/texmf/tex/generic/config/language.$f.dat") + or die("Cannot open $installerdir/texmf/tex/generic/config/language.$f.dat"); my @tmp = <INFILE>; close(INFILE); push @languagelines, @tmp; @@ -1177,6 +1139,18 @@ sub parse_executes_and_create_files { } +# option handling +my $opt_media = ""; +GetOptions("media=s" => \$opt_media) or die("No pod doc till now!"); + +if ("$opt_media" eq "CD") { + $::_media_ = "CD"; +} elsif ("$opt_media" eq "NET") { + $::_media_ = "NET"; +} elsif ("$opt_media" eq "DVD") { + $::_media_ = "DVD"; +} + load_tlpdb; set_platforms_supported; set_texlive_default_dirs; @@ -1185,7 +1159,7 @@ set_install_platform; run_menu; calc_depends; prepare_installation; -install_files; +do_install_packages; parse_executes_and_create_files; # |