summaryrefslogtreecommitdiff
path: root/Master/install-tl.pl
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2007-11-20 22:21:16 +0000
committerNorbert Preining <preining@logic.at>2007-11-20 22:21:16 +0000
commit58a26ad4e76dccf8836ac6665ff28e2ca27ee6fa (patch)
tree8aff17df499e7bd622bd3984865e31f5d506048d /Master/install-tl.pl
parent9f95e764988f3168d44c45954624e1bd9e458bfb (diff)
some work on installation stuff
git-svn-id: svn://tug.org/texlive/trunk@5532 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/install-tl.pl')
-rwxr-xr-xMaster/install-tl.pl240
1 files changed, 164 insertions, 76 deletions
diff --git a/Master/install-tl.pl b/Master/install-tl.pl
index 932558e2da2..0366d8428c3 100755
--- a/Master/install-tl.pl
+++ b/Master/install-tl.pl
@@ -7,7 +7,7 @@
# This file is licensed under the GNU General Public License version 2
# or any later version.
-$texlive_release="2008";
+$texlive_release="2007";
BEGIN {
$^W = 1;
@@ -22,7 +22,7 @@ use TeXLive::TLUtils qw(initialize_installer media platform platform_desc
additional_architectures_available_from_net get_system_tmpdir member);
use TeXLive::TLPOBJ;
use TeXLive::TLPDB;
-
+use Cwd;
$default_scheme='scheme-full';
@@ -49,13 +49,12 @@ print "Directory for Temporary Files: '", get_system_tmpdir, "\'\n";
my %vars;
sub dump_vars {
- my $filename=shift;
- open VARS, ">$filename";
+ open VARS, ">./vars";
foreach $key (keys %vars) {
print VARS "$key $vars{$key}\n";
}
close VARS;
- print "\n%vars dumped to '$filename'.\n";
+ print "\n%vars dumped to ./vars.\n";
}
@@ -137,71 +136,6 @@ sub set_texlive_default_dirs {
);
-sub calc_depends {
- my $size;
- # First look for packages in the selected scheme.
-
- my $scheme=$tlpdb->get_package($vars{'selected_scheme'});
-
- for my $scheme_content ($scheme->depends) {
- $install{"$scheme_content"}=1 unless ($scheme_content=~/^collection-/);
- }
-
- # Now look for collections in the %vars hash. These are not
- # necessarily the collections required by a scheme. The final
- # decision is made in the collections/languages menu.
-
- my @collections;
-
- foreach my $key (keys %vars) {
- if ($key=~/^collection-/) {
- push @collections, $key if $vars{$key};
- }
- }
-
- # Now we look for packages in collections. A collection can contain
- # other collections. In this case we push it to the @collections
- # list if it doesn't exist already.
-
- foreach my $selected_collection (@collections) {
- my $collection=$tlpdb->get_package($selected_collection);
-
- for my $package ($collection->depends) {
- if ($package=~/^collection-/) {
- push @collections, $package
- unless member $package, @collections;
- } else {
- my $tlpobj = $tlpdb->{'tlps'}{$package};
- if ($tlpobj->category eq "Package") {
- $install{"$package"}=1;
- $size+=$tlpobj->docsize if $vars{'option_doc'};
- $size+=$tlpobj->srcsize if $vars{'option_src'};
- $size+=$tlpobj->runsize;
- } elsif ($tlpobj->category eq "TLCore") {
- if ($package=~/^bin-/) {
- my %binsizes = %{$tlpobj->binsize};
- foreach my $arch (keys %binsizes) {
- if ((defined $vars{"diskbin_$arch"} and
- $vars{"diskbin_$arch"}==1) ||
- (defined $vars{"netbin_$arch"} and
- $vars{"netbin_$arch"}==1)) {
- $install{"$package"}=1;
- $size+=$binsizes{$arch};
- }
- }
- } else {
- $install{"$package"}=1;
- }
- }
- }
- }
- }
- $vars{'total_size'}=sprintf "%d", $size/1024**2;
-# printf "Total: %d MB\n", $size/1024**2;
-}
-
-
-
sub clear_screen {
# return 0;
(unix)? system 'clear':system 'cls';
@@ -834,7 +768,7 @@ EOF
sub quit {
- dump_vars './vars';
+ dump_vars;
exit 0;
}
@@ -864,7 +798,6 @@ sub main_menu {
++$vars{'n_collections_selected'} if $vars{$key}==1;
}
}
- calc_depends;
my %command=(
'self' => \&main_menu,
@@ -928,12 +861,67 @@ EOF
}
+sub calc_depends {
+ # First look for packages in the selected scheme.
+
+ my $scheme=$tlpdb->get_package($vars{'selected_scheme'});
+
+ for my $scheme_content ($scheme->depends) {
+ $install{"$scheme_content"}=1 unless ($scheme_content=~/^collection-/);
+ }
+
+ # Now look for collections in the %vars hash. These are not
+ # necessarily the collections required by a scheme. The final
+ # decision is made in the collections/languages menu.
+
+ my @collections;
+
+ foreach my $key (keys %vars) {
+ if ($key=~/^collection-/) {
+ push @collections, $key if $vars{$key};
+ }
+ }
+# printf "%d collections\n", @collections+0;
+
+ # Now we look for packages in collections. A collection can contain
+ # other collections. In this case we push it to the @collections
+ # list if it doesn't exist already.
+
+ foreach my $selected_collection (@collections) {
+ my $collection=$tlpdb->get_package($selected_collection);
+
+ for my $collection_content ($collection->depends) {
+ if ($collection_content=~/^collection-/) {
+ push @collections, $collection_content
+ unless member $collection_content, @collections;
+ } else {
+ $install{"$collection_content"}=1;
+ }
+ }
+ }
+
+ # we also want to packages of the collections, so we add the collections
+ # now to the list of install packages
+ foreach $selected_collection (@collections) {
+ $install{"$selected_collection"}=1;
+ }
+
+# printf "%d\n", @collections+0;
+# print "---------------\n";
+# foreach my $pkg (keys %install) {
+# print "Package $pkg\n";
+# }
+# print "---------------\n";
+# foreach my $col (@collections) {
+# print "$col\n";
+# }
+}
sub create_profile {
# The file "TLprofile" is created at the beginning of the
# installation process and contains information about the current
# setup. The purpose is to allow non-interactive installations.
- open PROFILE, ">$profilepath/texlive.profile";
+ open PROFILE, ">$profilepath/TLprofile";
print PROFILE "selected_scheme $vars{selected_scheme}\n";
foreach my $key (keys %vars) {
print PROFILE "$key $vars{$key}\n"
@@ -945,6 +933,101 @@ sub create_profile {
close PROFILE;
}
+#
+# prepare_installation
+sub prepare_installation {
+ my $destdir = $vars{"TEXDIR"};
+ my $texmfvar = $vars{"TEXMFSYSVAR"};
+ `echo mkdir -p "$destdir"`;
+ `echo mkdir -p "$destdir/$texlive_release"`;
+ `echo mkdir -p "$destdir/$texlive_release/$TeXLive::TLConfig::InfraLocation"`;
+ `echo mkdir -p "$texmfvar"`;
+ my $localtlpdbpath = "$destdir/$TeXLive::TLConfig::InfraLocation/texlive.tlpdb";
+ $::localtlpdb = new TeXLive::TLPDB;
+ $::localtlpdb->location("$localtlpdbpath");
+}
+
+sub add_tlpcontainer {
+ my ($package, $ziplocation, $archrefs, $dest) = @_;
+ my $cwd = getcwd;
+ if ($ziplocation !~ m,^/,) {
+ $ziplocation = "$cwd/$ziplocation";
+ }
+ my $tlpobj = _add_tlpcontainer($package, $ziplocation, "all", $dest);
+ if ($tlpobj->is_arch_dependent) {
+ foreach (@$archrefs) {
+ _add_tlpcontainer($package, $ziplocation, $_, $dest);
+ }
+ }
+}
+
+sub _add_tlpcontainer {
+ my ($package, $ziplocation, $arch, $dest) = @_;
+ my $unpackprog;
+ my $args;
+ # 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));
+ if ($arch ne "all") {
+ $package .= ".$arch";
+ }
+ 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 $conainer | 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
+ 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";
+ `$unpackprog`;
+ # we only create/add tlpobj for arch eq "all"
+ if ($arch eq "all") {
+ 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 to be installed
+# NOTE: For arch dependent packages you have to get all the
+# $package.$arch.extension
+# in this directory, too!
+# This is how add_tlpcontainer works.
+#
+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; }
+ }
+ }
+ my $destination = "$vars{TEXDIR}/$texlive_release";
+ foreach my $p (keys %install) {
+ my $containerdir = container_location($p);
+ add_tlpcontainer($p, $containerdir, \@archs, $destination);
+ }
+}
load_tlpdb;
set_platforms_supported;
@@ -953,12 +1036,17 @@ initialize_collections;
set_install_platform;
run_menu;
calc_depends;
+prepare_installation;
+install_files;
+#do_postinstall;
+foreach my $k (keys %install) {
+ print "INSTALL $k\n";
+}
-
-dump_vars './vars';
+dump_vars;
$profilepath='.';
create_profile;
-print "Profile written to $profilepath/texlive.profile\n";
+print "Profile written to $profilepath/TLprofile\n";
__END__