summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-01-09 12:40:16 +0000
committerNorbert Preining <preining@logic.at>2008-01-09 12:40:16 +0000
commit4141e69a42b45f87439e90778a3d31ee7a3e2537 (patch)
tree601ac0b1f201551cb410a1bc91c3458471469406 /Master
parent8fd0661535168fd7720c263009507890c2b5ae3c (diff)
first work on perltk installer, adaptions of install-tl.pl
git-svn-id: svn://tug.org/texlive/trunk@6163 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/install-tl.pl80
-rw-r--r--Master/tlpkg/TeXLive/install-menu-perltk.pl184
2 files changed, 251 insertions, 13 deletions
diff --git a/Master/install-tl.pl b/Master/install-tl.pl
index 26037e22d1b..1abd7324962 100755
--- a/Master/install-tl.pl
+++ b/Master/install-tl.pl
@@ -155,7 +155,6 @@ set_platforms_supported();
set_texlive_default_dirs();
initialize_collections();
set_install_platform();
-
if ($opt_profile eq "") {
# do the normal interactive installation!
#
@@ -172,6 +171,7 @@ if ($opt_profile eq "") {
our $MENU_INSTALL = 0;
our $MENU_ABORT = 1;
our $MENU_QUIT = 2;
+ #require("TeXLive/install-menu-perltk.pl");
require("TeXLive/install-menu-text.pl");
my $ret = run_menu();
if ($ret == $MENU_QUIT) {
@@ -244,6 +244,9 @@ sub set_platforms_supported {
$vars{"netbin_$binary"}=0;
}
}
+ for my $key (keys %vars) {
+ ++$vars{'n_systems_available'} if ($key=~/^(disk|net)bin/);
+ }
}
# Environment variables and default values on UNIX:
@@ -419,12 +422,14 @@ sub initialize_collections {
push @collections_std, $pkg;
}
}
- my $scheme_tlpobj = $tlpdb->get_package($default_scheme);
- if (defined ($scheme_tlpobj)) {
- foreach my $dependent ($scheme_tlpobj->depends) {
- if ($dependent=~/^(collection-.*)/) {
- $vars{"$1"}=1;
- }
+ }
+ my $scheme_tlpobj = $tlpdb->get_package($default_scheme);
+ if (defined ($scheme_tlpobj)) {
+ $vars{'n_collections_selected'}=0;
+ foreach my $dependent ($scheme_tlpobj->depends) {
+ if ($dependent=~/^(collection-.*)/) {
+ $vars{"$1"}=1;
+ ++$vars{'n_collections_selected'};
}
}
}
@@ -447,21 +452,28 @@ sub set_install_platform {
$warn_nobin_x86_64_linux="$warn_nobin" .
"$wp No binaries for x86_64-linux found, using i386-linux instead.\n";
+ my $ret = $warn_nobin;
if (defined $vars{"diskbin_$detected_platform"}) {
$vars{"diskbin_$detected_platform"}=1;
$vars{'inst_platform'}=$detected_platform;
- return $nowarn;
+ $ret = $nowarn;
} elsif (defined $vars{"netbin_$detected_platform"}) {
$vars{"netbin_$detected_platform"}=1;
$vars{'inst_platform'}=$detected_platform;
- return $nowarn;
+ $ret = $nowarn;
} elsif ($detected_platform eq 'x86_64-linux') {
$vars{'diskbin_i386-linux'}=1;
$vars{'inst_platform'}='i386-linux';
- return $warn_nobin_x86_64_linux;
+ $ret = $warn_nobin_x86_64_linux;
} else {
- return $warn_nobin;
+ $ret = $warn_nobin;
+ }
+ foreach my $key (keys %vars) {
+ if ($key=~/^diskbin.*/ or $key=~/^netbin.*/) {
+ ++$vars{'n_systems_selected'} if $vars{$key}==1;
+ }
}
+ return($ret);
}
sub create_profile {
@@ -741,6 +753,52 @@ sub do_win_registry_magic {
warn "Don't know what to do if a non admin user installs texlive on win32\n!";
}
}
+
+
+#
+# do everything to select a scheme
+#
+sub select_scheme {
+ my $s = shift;
+ # set the selected scheme to $s
+ $vars{'selected_scheme'} = $s;
+ # remove the selection of all collections
+ foreach my $entry (keys %vars) {
+ if ($entry=~/^(collection-.*)/) {
+ $vars{"$1"}=0;
+ }
+ }
+ # select the collections belonging to the scheme
+ my $scheme_tlpobj = $tlpdb->get_package($s);
+ if (defined ($scheme_tlpobj)) {
+ $vars{'n_collections_selected'}=0;
+ foreach my $dependent ($scheme_tlpobj->depends) {
+ if ($dependent=~/^(collection-.*)/) {
+ $vars{"$1"}=1;
+ ++$vars{'n_collections_selected'};
+ }
+ }
+ }
+ # for good measure, update the deps
+ calc_depends();
+}
+
+sub update_numbers {
+ $vars{'n_collections_selected'}=0;
+ $vars{'n_systems_available'} = 0;
+ $vars{'n_collections_selected'} = 0;
+ $vars{'n_systems_selected'} = 0;
+ foreach my $key (keys %vars) {
+ if ($key =~ /^(disk|net)bin/) {
+ ++$vars{'n_systems_available'};
+ ++$vars{'n_systems_selected'} if $vars{$key} == 1;
+ }
+ if ($key =~ /^collection-/) {
+ ++$vars{'n_collections_available'};
+ ++$vars{'n_collections_selected'} if $vars{$key} == 1;
+ }
+ }
+}
__END__
### Local Variables:
diff --git a/Master/tlpkg/TeXLive/install-menu-perltk.pl b/Master/tlpkg/TeXLive/install-menu-perltk.pl
index adc8c064bd0..389c0eddc43 100644
--- a/Master/tlpkg/TeXLive/install-menu-perltk.pl
+++ b/Master/tlpkg/TeXLive/install-menu-perltk.pl
@@ -26,9 +26,48 @@ my $return = $MENU_INSTALL;
require Tk;
+my $mw;
+
+my $bintextbutton;
+my $schemebutton;
+my $collectionstext;
+my $texmflocaltext;
+my $texmfsysvartext;
+my $texdirtext;
+
sub run_menu {
- my $mw = MainWindow->new;
- $mw->Label(-text => 'Hello, world!')->pack;
+ calc_depends;
+ $mw = MainWindow->new;
+ $mw->Label(-text => 'TeX Live 2008 Installation')->pack;
+ $bintextbutton = $mw->Button(
+ -command => sub { menu_select_binsystems(); }
+ );
+ $bintextbutton->pack;
+ $schemebutton = $mw->Button(
+ -command => sub { menu_select_scheme(); }
+ );
+ $schemebutton->pack;
+ $mw->Label(-text => 'Customizing installation scheme')->pack;
+ $mw->Button(
+ -text => "Standard Collections",
+ -command => sub { menu_select_standard_collections(); }
+ )->pack;
+ $mw->Button(
+ -text => "Language Collections",
+ -command => sub { menu_select_lang_collections(); }
+ )->pack;
+ $collectionstext = $mw->Label();
+ $collectionstext->pack;
+ $mw->Button(
+ -text => "Directories' setup",
+ -command => sub { notimpl(); }
+ )->pack;
+ $texdirtext = $mw->Label();
+ $texmflocaltext = $mw->Label();
+ $texmfsysvartext = $mw->Label();
+ $texdirtext->pack;
+ $texmflocaltext->pack;
+ $texmfsysvartext->pack;
$mw->Button(
-text => 'Quit',
-command => sub { $return = $MENU_QUIT; $mw->destroy },
@@ -37,8 +76,149 @@ sub run_menu {
-text => 'Cancel',
-command => sub { $return = $MENU_ABORT; $mw->destroy }
)->pack;
+ menu_update_texts();
Tk::MainLoop();
print "return value = $return\n";
return $MENU_ABORT;
}
+sub notimpl {
+ my $errorwin = $mw->Toplevel;
+ $errorwin->Button(-text => "Not implemented yet!",
+ -command => [ $errorwin => 'destroy' ])->pack;
+}
+
+
+sub menu_select_scheme {
+ my $sw = $mw->Toplevel;
+ my @schemes;
+ foreach my $pkg ($tlpdb->list_packages) {
+ my $tlpobj = $tlpdb->{'tlps'}{$pkg};
+ if ($tlpobj->category eq "Scheme") {
+ push @schemes, $pkg;
+ $vars{"$pkg"}=($vars{'selected_scheme'} eq $pkg)? 1:0;
+ }
+ }
+ @schemes=sort @schemes;
+ my $selected = $vars{'selected_scheme'};
+ foreach my $scheme (@schemes) {
+ $sw->Radiobutton(-variable => \$selected, -value => $scheme,
+ -text => $scheme)->pack;
+ }
+ $sw->Button(-text => "Return",
+ -command => sub { callback_select_scheme($selected) ; $sw->destroy })->pack;
+ $sw->Button(-text => "Cancel",
+ -command => sub { $sw->destroy })->pack;
+}
+
+sub menu_select_standard_collections {
+ my $sw = $mw->Toplevel;
+ foreach my $coll (sort @collections_std) {
+ $sw->Checkbutton(-variable => \$vars{$coll}, -text => $coll)->pack;
+ }
+ $sw->Button(-text => "Return",
+ -command => sub { callback_select_collection() ; $sw->destroy })->pack;
+ $sw->Button(-text => "Cancel",
+ -command => sub { $sw->destroy })->pack;
+}
+
+sub menu_select_lang_collections {
+ my $sw = $mw->Toplevel;
+ foreach my $coll (sort @collections_lang) {
+ $sw->Checkbutton(-variable => \$vars{$coll}, -text => $coll)->pack;
+ }
+ $sw->Button(-text => "Return",
+ -command => sub { callback_select_collection() ; $sw->destroy })->pack;
+ $sw->Button(-text => "Cancel",
+ -command => sub { $sw->destroy })->pack;
+}
+
+sub menu_select_binsystems {
+ my $sw = $mw->Toplevel;
+ my @diskarchs = ();
+ my @netarchs = ();
+ foreach my $key (keys %vars) {
+ if ($key=~/diskbin_(.*)/) {
+ push @diskbins, $1;
+ $from_net{"$1"}=0;
+ }
+ if ($key=~/netbin_(.*)/) {
+ push @netbins, $1;
+ $from_net{"$1"}=1;
+ }
+ }
+ my @binaries=sort(@diskbins,@netbins);
+ foreach my $sys (@binaries) {
+ if ($from_net{$sys}) {
+ $sw->Checkbutton(-variable => \$vars{"netbin_$sys"}, -text => "$sys")->pack;
+ } else {
+ $sw->Checkbutton(-variable => \$vars{"diskbin_$sys"}, -text => $sys)->pack;
+ }
+ }
+ $sw->Button(-text => "Return",
+ -command => sub { callback_select_systems() ; $sw->destroy })->pack;
+ $sw->Button(-text => "Cancel",
+ -command => sub { $sw->destroy })->pack;
+}
+
+
+sub menu_set_text {
+ my $w = shift;
+ my $t = shift;
+ $w->configure(-text => $t);
+}
+
+sub menu_set_schemebutton_text {
+ menu_set_text($schemebutton, "Selected Scheme: $vars{'selected_scheme'}");
+}
+
+sub menu_set_binbutton_text {
+ menu_set_text($bintextbutton, "Binary Systems $vars{'n_systems_selected'} out of $vars{'n_systems_available'}");
+}
+
+sub menu_set_collections_text {
+ menu_set_text($collectionstext, "$vars{'n_collections_selected'} collections out of $vars{'n_collections_available'}, disk space required: $vars{'total_size'} MB");
+}
+
+sub menu_set_pathes_text {
+ menu_set_text($texdirtext, "TEXDIR (The main TeX directory): $vars{'TEXDIR'}");
+ menu_set_text($texmflocaltext, "TEXMFLOCAL (Directory for local styles etc): $vars{'TEXMFLOCAL'}");
+ menu_set_text($texmfsysvartext, "TEXMFSYSVAR (Directory for local config): $vars{'TEXMFSYSVAR'}");
+}
+
+
+sub menu_update_texts {
+ menu_set_pathes_text;
+ menu_set_collections_text;
+ menu_set_binbutton_text;
+ menu_set_schemebutton_text;
+}
+
+sub callback_select_scheme {
+ my $s = shift;
+ select_scheme($s);
+ menu_update_texts();
+}
+
+sub callback_select_collection {
+ calc_depends();
+ update_numbers();
+ menu_update_texts();
+}
+
+sub callback_select_systems() {
+ calc_depends();
+ update_numbers();
+ menu_update_texts();
+}
+
+sub dump_vars_stdout {
+ foreach my $k (keys %vars) {
+ print "DEBUG: vars{$k} = $vars{$k}\n";
+ }
+}
+
+
+1;
+
+