summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLUtils.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/TeXLive/TLUtils.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLUtils.pm23
1 files changed, 23 insertions, 0 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
&quotewords
@@ -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