summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2011-05-30 19:42:46 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2011-05-30 19:42:46 +0000
commit9629e970cd48e4e43c78ae4105bd3380b4cb82f5 (patch)
tree7ceb8edacf91d4fa569364802da598d6c2e57b4a /Master
parent03614d57b851e87bd64f908b6c1dfad07b945811 (diff)
Fixes for handling TEXDIR
git-svn-id: svn://tug.org/texlive/trunk@22688 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm53
-rw-r--r--Master/tlpkg/TeXLive/TLWinGoo.pm2
-rw-r--r--Master/tlpkg/installer/install-menu-perltk.pl14
-rwxr-xr-xMaster/tlpkg/installer/install-menu-text.pl3
-rw-r--r--Master/tlpkg/installer/install-menu-wizard.pl21
5 files changed, 68 insertions, 25 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm
index 9f6961b5fef..ad42a62b36b 100644
--- a/Master/tlpkg/TeXLive/TLUtils.pm
+++ b/Master/tlpkg/TeXLive/TLUtils.pm
@@ -529,10 +529,10 @@ sub dirname {
if (win32) {
$path=~s!\\!/!g;
}
- if ($path=~m!/!) { # dirname("foo/bar/baz") -> "foo/bar"
- $path=~m!(.*)/.*!;
+ if ($path=~m!/!) { # dirname("foo/bar/baz") -> "foo/bar"
+ $path=~m!(.*)/.*!; # works because of greedy matching
return $1;
- } else { # dirname("ignore") -> "."
+ } else { # dirname("ignore") -> "."
return ".";
}
}
@@ -582,14 +582,24 @@ Tests whether its argument is a directory where we can create a directory.
=cut
+sub dir_slash {
+ my $d = shift;
+ $d = "$d/" unless $d =~ m!/!;
+ return $d;
+}
+
+# test whether subdirectories can be created in the argument
sub dir_creatable {
$path=shift;
- return 0 unless -d $path;
+ #print STDERR "testing $path\n";
$path =~ s!\\!/!g if win32;
- $path =~ s!/$!!g;
+ $path =~ s!/$!!;
+ return 0 unless -d dir_slash($path);
+ #print STDERR "testing $path\n";
my $i = 0;
while (-e $path . "/" . $i) { $i++; }
my $d = $path."/".$i;
+ #print STDERR "creating $d\n";
return 0 unless mkdir $d;
return 0 unless -d $d;
rmdir $d;
@@ -619,9 +629,9 @@ a fileserver.
sub dir_writable {
$path=shift;
- return 0 unless -d $path;
+ return 0 unless -d dir_slash($path);
$path =~ s!\\!/!g if win32;
- $path =~ s!/$!!g;
+ $path =~ s!/$!!;
my $i = 0;
while (-e $path . "/" . $i) { $i++; }
my $f = $path."/".$i;
@@ -2867,17 +2877,30 @@ sub merge_into {
Test whether installation with TEXDIR set to $texdir would succeed due to
writing permissions.
+Writable or not, we will not allow installation to the root
+directory (Unix) or the root of the system drive (Windows).
+
=cut
sub texdir_check {
- my ($texdir) = shift; # PATH/texlive/2008
- my $texdirparent = dirname($texdir); # PATH/texlive
- my $texdirpparent = dirname($texdirparent); # PATH
- if ( (dir_creatable($texdirpparent)) ||
- ( (-d $texdirparent) && (dir_creatable($texdirparent)) ) ||
- ( (-d $texdir) && (dir_writable($texdir)) ) ) {
- return 1;
- }
+ my $texdir = shift;
+ my $texdirparent;
+ my $texdirpparent;
+ $texdir =~ s!/$!!; # remove final slash
+ #print STDERR "Checking $texdir".'[/]'."\n";
+ # disallow unix root
+ return 0 if $texdir eq "";
+ # disallow w32 systemdrive root
+ return 0 if (win32() and $texdir eq $ENV{SystemDrive});
+
+ return dir_writable($texdir) if (-d dir_slash($texdir));
+ ($texdirparent = $texdir) =~ s!/[^/]*$!!;
+ #print STDERR "Checking $texdirparent".'[/]'."\n";
+ return dir_creatable($texdirparent) if -d dir_slash($texdirparent);
+ # try another level up the tree
+ ($texdirpparent = $texdirparent) =~ s!/[^/]*$!!;
+ #print STDERR "Checking $texdirpparent".'[/]'."\n";
+ return dir_creatable($texdirpparent) if -d dir_slash($texdirpparent);
return 0;
}
diff --git a/Master/tlpkg/TeXLive/TLWinGoo.pm b/Master/tlpkg/TeXLive/TLWinGoo.pm
index 365e86b7b0f..612ed86dd2a 100644
--- a/Master/tlpkg/TeXLive/TLWinGoo.pm
+++ b/Master/tlpkg/TeXLive/TLWinGoo.pm
@@ -1228,7 +1228,7 @@ rem del /q \"$td\\doc.html\"
del /q \"$td\\index.html\"
del /q \"$td\\texmf.cnf\"
del /q \"$td\\install-tl*.*\"
-del /q \"$td\\tl-portable.*\"
+del /q \"$td\\tl-tray-menu.exe\"
rem del /q \"$td\\texlive.profile\"
del /q \"$td\\release-texlive.txt\"
set test=
diff --git a/Master/tlpkg/installer/install-menu-perltk.pl b/Master/tlpkg/installer/install-menu-perltk.pl
index 7f17d1d6d1b..8b57a620dd5 100644
--- a/Master/tlpkg/installer/install-menu-perltk.pl
+++ b/Master/tlpkg/installer/install-menu-perltk.pl
@@ -323,7 +323,7 @@ sub run_menu_perltk {
if ($::opt_all_options || win32()) {
$row++;
- $fr->Label(-text => __('Add shortcuts to menu and desktop'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
+ $fr->Label(-text => __('Add menu shortcuts'), -anchor => 'w')->grid(-row => $row, -column => 1, -sticky => 'w');
$fr->Label(-anchor => 'w', -textvariable => \$deskintyesno)->grid(-row => $row, -column => 2, -padx => "2m");
$deskintbutton = $fr->Button(-text => __("Toggle"), -command => sub { toggle_and_set_opt_variable(\$vars{'option_desktop_integration'}, \$deskintyesno); });
$deskintbutton->grid(-row => $row, -column => 3, -sticky => "ew", -padx => "2m");
@@ -886,7 +886,7 @@ sub menu_set_pathes_text {
if (TeXLive::TLUtils::texdir_check($vars{'TEXDIR'})) {
menu_set_text($texdirtext, native_slashify($vars{'TEXDIR'}), -foreground => "black");
} else {
- menu_set_text($texdirtext, __("(default not writable - please change!)"), -foreground => "red");
+ menu_set_text($texdirtext, __("(default not allowed or not writable - please change!)"), -foreground => "red");
}
menu_set_text($texmflocaltext, native_slashify($vars{'TEXMFLOCAL'}));
if ((-w $vars{'TEXMFSYSVAR'}) || (-w dirname($vars{'TEXMFSYSVAR'}))) {
@@ -982,7 +982,15 @@ sub callback_edit_directories {
$vars{'TEXMFSYSVAR'}="$texdirnoslash/texmf-var";
$vars{'TEXMFSYSCONFIG'}="$texdirnoslash/texmf-config";
}
- $vars{'TEXDIRW'}=$vars{'TEXDIR'}
+ if ($vars{'TEXDIR'} =~ /:$/) {
+ # drive letter
+ $vars{'TEXDIR'} = $vars{'TEXDIR'}."/";
+ # note: main::do_installation will remove this final slash
+ } elsif ($vars{'TEXDIR'} =~ /\/$/ and $vars{'TEXDIR'} !~ /:\/$/) {
+ # remove final slash
+ $vars{'TEXDIR'} =~ s!/$!!;
+ }
+ #$vars{'TEXDIRW'}=$vars{'TEXDIR'}
}
menu_update_texts();
}
diff --git a/Master/tlpkg/installer/install-menu-text.pl b/Master/tlpkg/installer/install-menu-text.pl
index 57325029979..b349c52ce59 100755
--- a/Master/tlpkg/installer/install-menu-text.pl
+++ b/Master/tlpkg/installer/install-menu-text.pl
@@ -458,7 +458,8 @@ sub directories_menu
menu_head "Directories setup:";
if (!TeXLive::TLUtils::texdir_check($vars{'TEXDIR'})) {
- print "!! The default location as given below can't be written to.
+ print "!! The default location as given below is forbidden or
+!! can't be written to.
!! Either change the destination directory using <1> or create it
!! outside this script.
";
diff --git a/Master/tlpkg/installer/install-menu-wizard.pl b/Master/tlpkg/installer/install-menu-wizard.pl
index 7403997ea0c..82f106ad28d 100644
--- a/Master/tlpkg/installer/install-menu-wizard.pl
+++ b/Master/tlpkg/installer/install-menu-wizard.pl
@@ -269,7 +269,7 @@ sub check_show_warning {
$warning->configure(-text => "");
$nxt->configure(-state => "normal");
} else {
- $warning->configure(-text => __('(default not writable - please change!)'));
+ $warning->configure(-text => __('(default not allowed or not writable - please change!)'));
$nxt->configure(-state => "disabled");
}
}
@@ -298,6 +298,7 @@ sub change_path {
sub callback_change_texdir {
my ($val) = @_;
my $home = getenv('HOME');
+ my $texdirnoslash;
if (win32()) {
$home = getenv('USERPROFILE');
$home =~ s!\\!/!g;
@@ -315,11 +316,21 @@ sub callback_change_texdir {
$vars{'TEXMFSYSVAR'}="$1/$texlive_release/texmf-var";
$vars{'TEXMFSYSCONFIG'}="$1/$texlive_release/texmf-config";
} elsif ($vars{'TEXDIR'}=~/^(.*)$/) {
- $vars{'TEXMFLOCAL'}="$1/texmf-local";
- $vars{'TEXMFSYSVAR'}="$1/texmf-var";
- $vars{'TEXMFSYSCONFIG'}="$1/texmf-config";
+ $texdirnoslash = $1;
+ $texdirnoslash =~ s!/$!!;
+ $vars{'TEXMFLOCAL'}="$texdirnoslash/texmf-local";
+ $vars{'TEXMFSYSVAR'}="$texdirnoslash/texmf-var";
+ $vars{'TEXMFSYSCONFIG'}="$texdirnoslash/texmf-config";
+ }
+ if ($vars{'TEXDIR'} =~ /:$/) {
+ # drive letter: add final slash
+ $vars{'TEXDIR'} = $vars{'TEXDIR'}."/";
+ # note: main::do_installation will remove this final slash
+ } elsif ($vars{'TEXDIR'} =~ /\/$/ and $vars{'TEXDIR'} !~ /:\/$/) {
+ # remove final slash
+ $vars{'TEXDIR'} =~ s![\\/]$!!;
}
- $vars{'TEXDIRW'}=$vars{'TEXDIR'};
+ #$vars{'TEXDIRW'}=$vars{'TEXDIR'};
$dest = $vars{'TEXDIR'};
$dest_display = native_slashify($dest); # useful as -textvar value in Labels
check_show_warning();