diff options
author | Norbert Preining <preining@logic.at> | 2009-03-16 13:02:28 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2009-03-16 13:02:28 +0000 |
commit | f349f9cc76b7ead9891ab644b1ad55d667089976 (patch) | |
tree | 4625a9b1d8aecbf1ba88f0289255b585a2e830fd | |
parent | fedc43a3b6f000805a6a1ef35455fa42370af8d2 (diff) |
rename opttion_w32_admin to option_w32_multi_user
implement initial support for reading config stuff from former installations
git-svn-id: svn://tug.org/texlive/branches/branch2009-dev@12397 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Master/install-tl | 66 | ||||
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 6 | ||||
-rwxr-xr-x | Master/tlpkg/installer/install-menu-text.pl | 30 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/00texlive.installation.tlpsrc | 2 |
4 files changed, 78 insertions, 26 deletions
diff --git a/Master/install-tl b/Master/install-tl index cb2b39f7f0f..ad3b51045ac 100755 --- a/Master/install-tl +++ b/Master/install-tl @@ -444,9 +444,32 @@ if ($opt_profile eq "") { require("installer/install-menu-text.pl"); } + # before we start the installation we check for the existence of + # a previous installation, and in case we ship inform the UI + { + my $tlmgrwhich = which("tlmgr"); + if ($tlmgrwhich) { + my $dn = dirname($tlmgrwhich); + $dn = abs_path("$dn/../.."); + printf "dn=$dn\n"; + my $tlpdboldpath = "$dn/$TeXLive::TLConfig::InfraLocation/$TeXLive::TLConfig::DatabaseName"; + if (-r $tlpdboldpath) { + # we found an old installation, so read that one in and save + # the list installed collections into an array. + print "tlpdboldpath = $tlpdboldpath\n"; + my $oldtlpdb=TeXLive::TLPDB->new(root => $dn); + if ($oldtlpdb) { + print "found old installation\n"; + my @colls = $oldtlpdb->collections; + push @runargs, "-old-installation-collections", \@colls; + } + } + } + } + my $ret = &{$::run_menu}(@runargs); if ($ret == $MENU_QUIT) { - do_cleanup(); MISSING + do_cleanup(); flushlog(); exit(1); } @@ -492,7 +515,7 @@ exit(0); sub do_installation { if (win32()) { debug("Switching to non-admin mode due to explict user request!\n"); - non_admin() if !$vars{'option_w32_admin'}; + non_admin() if !$vars{'option_w32_multi_user'}; } # do the actual installation my $h; @@ -938,12 +961,16 @@ sub calc_depends { # First look for packages in the selected scheme. my $scheme=$tlpdb->get_package($vars{'selected_scheme'}); if (!defined($scheme)) { - die ("Scheme $vars{'selected_scheme'} not defined, vars:\n"); - dump_vars(\*STDOUT); - } - - for my $scheme_content ($scheme->depends) { - $install{"$scheme_content"}=1 unless ($scheme_content=~/^collection-/); + if ($vars{'selected_scheme'}) { + # something is written in the selected scheme but not defined, that + # is strange, so warn and die + die ("Scheme $vars{'selected_scheme'} not defined, vars:\n"); + dump_vars(\*STDOUT); + } + } else { + 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 @@ -1058,7 +1085,7 @@ sub load_tlpdb { $vars{'option_sysint'} = 1 if win32(); $vars{'option_path'} = $tlpdb->option_path; $vars{'option_path'} = 1 if win32(); - $vars{'option_w32_admin'} = $tlpdb->option_w32_admin; + $vars{'option_w32_multi_user'} = $tlpdb->option_w32_multi_user; $vars{'sys_bin'} = $tlpdb->option_sys_bin; $vars{'sys_man'} = $tlpdb->option_sys_man; $vars{'sys_info'} = $tlpdb->option_sys_info; @@ -1278,6 +1305,27 @@ sub save_options_into_tlpdb { $localtlpdb->save() unless $vars{'from_dvd'}; } +# +# select a group of collection, maybe from an old isntallation +# +sub select_collections_from_list { + $vars{'selected_scheme'} = ""; + $vars{'n_collections_selected'}=0; + # remove the selection of all collections + foreach my $entry (keys %vars) { + if ($entry=~/^(collection-.*)/) { + $vars{"$1"}=0; + } + } + for my $c (@_) { + my $tlpobj = $tlpdb->get_package($c); + if ($tlpobj) { + $vars{$c} = 1; + ++$vars{'n_collections_selected'}; + } + } +} + # do everything to select a scheme # sub select_scheme { diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index 67cb9ed7d7b..b9d11518f02 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -1189,10 +1189,10 @@ sub option_path { if (@_) { $self->_set_option_value("opt_path", shift); } return $self->_option_value("opt_path"); } -sub option_w32_admin { +sub option_w32_multi_user { my $self = shift; - if (@_) { $self->_set_option_value("opt_w32_admin", shift); } - return $self->_option_value("opt_w32_admin"); + if (@_) { $self->_set_option_value("opt_w32_multi_user", shift); } + return $self->_option_value("opt_w32_multi_user"); } sub option_install_docfiles { my $self = shift; diff --git a/Master/tlpkg/installer/install-menu-text.pl b/Master/tlpkg/installer/install-menu-text.pl index c6a091b0cc6..da531ff51e6 100755 --- a/Master/tlpkg/installer/install-menu-text.pl +++ b/Master/tlpkg/installer/install-menu-text.pl @@ -110,6 +110,15 @@ sub prompt { # The menu loop. A menu is a function. Its return value is a # reference to another menu or to itself. sub run_menu_text { + my (@args) = @_; + # the text mode installer does not take interest in any argument + # but the -old-installation-collections + while (@args) { + my $f = shift @args; + if ($f eq "-old-installation-collections") { + select_collections_from_list(@{shift @args}); + } + } my $menu=\&main_menu; while ($RETURN == $MENU_CONTINUE) { $menu=$menu->(); @@ -211,7 +220,7 @@ sub scheme_menu { $keyval{$keys[$index]}="$scheme"; my $tlpobj = $tlpdb->get_package("$scheme"); printf " %s %s %s\n", $keys[$index], button($vars{"$scheme"}), - $tlpobj->shortdesc; + $tlpobj->shortdesc; ++$index; } @@ -221,14 +230,8 @@ sub scheme_menu { } } - my $scheme_tlpobj = $tlpdb->get_package($vars{'selected_scheme'}); - if (defined ($scheme_tlpobj)) { - foreach my $dependent ($scheme_tlpobj->depends) { - if ($dependent=~/^(collection-.*)/) { - $vars{"$1"}=1; - } - } - } + # select_scheme($vars{'selected_scheme'}); + if ($vars{"binary_win32"}) { $vars{"collection-wintools"} = 1; } else { @@ -240,6 +243,7 @@ sub scheme_menu { if (defined $keyval{"$answer"}) { $vars{'selected_scheme'}=$keyval{"$answer"}; + select_scheme($vars{'selected_scheme'}); return $command{'self'}->(); } if (defined $command{"\u$answer"}) { @@ -369,13 +373,13 @@ sub language_menu { my $tlpobj = $tlpdb->get_package("$language"); $keyval{$lang_keys[$index]}="$language"; printf " %s %s %-33s", $lang_keys[$index], button($vars{"$language"}), - substr($tlpobj->shortdesc,0,33); + substr($tlpobj->shortdesc,0,33); if (defined $languages[$index+$lines]) { my $language=$languages[$index+$lines]; my $tlpobj = $tlpdb->get_package("$language"); $keyval{$lang_keys[$index+$lines]}="$language"; printf " %s %s %-32s\n", $lang_keys[$index+$lines], - button($vars{"$language"}), substr($tlpobj->shortdesc,0,32); + button($vars{"$language"}), substr($tlpobj->shortdesc,0,32); } else { print "\n"; } @@ -390,13 +394,13 @@ sub language_menu { my $tlpobj = $tlpdb->get_package("$lang_doc"); $keyval{$lang_doc_keys[$index]}="$lang_doc"; printf " %s %s %-33s", $lang_doc_keys[$index], button($vars{"$lang_doc"}), - substr($tlpobj->shortdesc,0,33); + substr($tlpobj->shortdesc,0,33); if (defined $lang_docs[$index+$lines]) { my $lang_doc=$lang_docs[$index+$lines]; my $tlpobj = $tlpdb->get_package("$lang_doc"); $keyval{$lang_doc_keys[$index+$lines]}="$lang_doc"; printf " %s %s %-32s\n", $lang_doc_keys[$index+$lines], - button($vars{"$lang_doc"}), substr($tlpobj->shortdesc,0,32); + button($vars{"$lang_doc"}), substr($tlpobj->shortdesc,0,32); } else { print "\n"; } diff --git a/Master/tlpkg/tlpsrc/00texlive.installation.tlpsrc b/Master/tlpkg/tlpsrc/00texlive.installation.tlpsrc index 5cf57fa6a17..749887b1acf 100644 --- a/Master/tlpkg/tlpsrc/00texlive.installation.tlpsrc +++ b/Master/tlpkg/tlpsrc/00texlive.installation.tlpsrc @@ -23,7 +23,7 @@ depend location:__MASTER__ depend opt_paper:a4 depend opt_create_formats:1 depend opt_system_integration:0 -depend opt_w32_admin:1 +depend opt_w32_multi_user:1 depend opt_path:0 depend opt_sys_bin:/usr/local/bin depend opt_sys_info:/usr/local/info |