diff options
author | Norbert Preining <preining@logic.at> | 2008-03-21 07:17:08 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-03-21 07:17:08 +0000 |
commit | 8e87273a1960b9a6e95e3bb27ab8ddf98be6e621 (patch) | |
tree | 3890b4f2b2e1a36a18f4f436ce4f2fbef60e4895 | |
parent | e5e42ab9d2fe5584924e6db8d00d8d7d2443c657 (diff) |
better fallback behaviour, support in perltk installer
git-svn-id: svn://tug.org/texlive/trunk@7053 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 23 | ||||
-rw-r--r-- | Master/tlpkg/installer/install-menu-perltk.pl | 18 | ||||
-rwxr-xr-x | Master/tlpkg/installer/install-menu-text.pl | 16 |
3 files changed, 41 insertions, 16 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index ebc1b01c125..5a5e6a1a82e 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -61,6 +61,7 @@ C<TeXLive::TLUtils> -- Utilities used in the TeX Live Infrastructure Modules TeXLive::TLUtils::push_uniq(\@list, @items); TeXLive::TLUtils::member($item, @list); TeXLive::TLUtils::tllog($level, $string); + TeXLive::TLUtils::texdir_check($texdir); TeXLive::TLUtils::kpsewhich; TeXLive::TLUtils::conv_to_win_path($path); @@ -100,6 +101,7 @@ BEGIN { &create_language &sort_uniq &push_uniq + &texdir_check &member &kpsewhich "ewords @@ -1098,6 +1100,27 @@ sub member { =pod +=item C<texdir_check($texdir)> + +Test whether installation with TEXDIR set to $texdir would succeed due to +writing permissions. + +=cut + +sub texdir_check { + my ($texdir) = shift; # PATH/texlive/2008 + my $texdirparent = dirname($texdir); # PATH/texlive + my $texdirpparent = dirname($texdirparent); # PATH + if ( (-w $texdirpparent) || + ( (-d $texdirparent) && (-w $texdirparent) ) || + ( (-d $texdir) && (-w $texdir) ) ) { + return 1; + } + return 0; +} + +=pod + =item C<tllog($type, $rest, ...)> Debugging output is controlled by 2 global variables: $::LOGLEVELTERMINAL diff --git a/Master/tlpkg/installer/install-menu-perltk.pl b/Master/tlpkg/installer/install-menu-perltk.pl index 9cfff29955b..67dbed6a8e2 100644 --- a/Master/tlpkg/installer/install-menu-perltk.pl +++ b/Master/tlpkg/installer/install-menu-perltk.pl @@ -632,9 +632,23 @@ sub menu_set_collections_text { } sub menu_set_pathes_text { - menu_set_text($texdirtext, "$vars{'TEXDIR'}"); + if (TeXLive::TLUtils::texdir_check($vars{'TEXDIR'})) { + menu_set_text($texdirtext, "$vars{'TEXDIR'}"); + } else { + menu_set_text($texdirtext, "(default not writable - please change!)"); + } menu_set_text($texmflocaltext, "$vars{'TEXMFLOCAL'}"); - menu_set_text($texmfsysvartext, "$vars{'TEXMFSYSVAR'}"); + if (-w $vars{'TEXMFSYSVAR'}) { + menu_set_text($texmfsysvartext, "$vars{'TEXMFSYSVAR'}"); + } elsif ("$vars{'TEXMFSYSVAR'}" =~ m;^$vars{'TEXDIR'};) { + if (TeXLive::TLUtils::texdir_check($vars{'TEXDIR'})) { + menu_set_text($texmfsysvartext, "$vars{'TEXMFSYSVAR'}"); + } else { + menu_set_text($texmfsysvartext, "(please change TEXDIR first!)"); + } + } else { + menu_set_text($texmfsysvartext, "(default not writable - please change!)"); + } menu_set_text($texmfhometext, "$vars{'TEXMFHOME'}"); } diff --git a/Master/tlpkg/installer/install-menu-text.pl b/Master/tlpkg/installer/install-menu-text.pl index af81b7115db..88ed73355e7 100755 --- a/Master/tlpkg/installer/install-menu-text.pl +++ b/Master/tlpkg/installer/install-menu-text.pl @@ -451,14 +451,7 @@ sub directories_menu { ); menu_head "Current directories setup:"; - my $texdir = $vars{'TEXDIR'}; - my $texdirparent = dirname($texdir); - my $texdirpparent = dirname($texdirparent); - if ( (-w $texdirpparent) || - ( (-d $texdirparent) && (-w $texdirparent)) || - ( (-d $texdir) && (-w $texdir) ) ) { - # do nothing - } else { + if (!TeXLive::TLUtils::texdir_check($vars{'TEXDIR'})) { print "!! The default location as given below can't be written to. !! Either change the destination directory using <1> or create it !! outside this script. @@ -824,12 +817,7 @@ sub main_menu { TEXDIR (The main TeX directory): EOF ; - my $texdir = $vars{'TEXDIR'}; - my $texdirparent = dirname($texdir); - my $texdirpparent = dirname($texdirparent); - if ( (-w $texdirpparent) || - ( (-d $texdirparent) && (-w $texdirparent)) || - ( (-d $texdir) && (-w $texdir) ) ) { + if (TeXLive::TLUtils::texdir_check($vars{'TEXDIR'})) { print " $vars{'TEXDIR'}\n"; } else { print " !! default location: $vars{'TEXDIR'}\n"; |