summaryrefslogtreecommitdiff
path: root/Master/tlpkg/installer
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2008-11-28 01:21:05 +0000
committerKarl Berry <karl@freefriends.org>2008-11-28 01:21:05 +0000
commit37d75e59ddd5fe08ecd0395b8a62f59b7947ae28 (patch)
treeb5516de05061f40d98a69fab2e32cd9814121536 /Master/tlpkg/installer
parent0604602c658a52f572a2b7dbfd60d6976edfa669 (diff)
* install-tl (BEGIN): do not chdir to `dirname $0` (aka $Master); instead,
just set $::installerdir to it. * tlpkg/installer/install-menu-text.pl (input_dirname): new fn, factoring out directory processing code. Transform relative paths to absolute. (directories_menu): call it. git-svn-id: svn://tug.org/texlive/trunk@11446 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/installer')
-rwxr-xr-xMaster/tlpkg/installer/install-menu-text.pl62
1 files changed, 36 insertions, 26 deletions
diff --git a/Master/tlpkg/installer/install-menu-text.pl b/Master/tlpkg/installer/install-menu-text.pl
index 68fc8071d8f..86e8fd32de7 100755
--- a/Master/tlpkg/installer/install-menu-text.pl
+++ b/Master/tlpkg/installer/install-menu-text.pl
@@ -432,7 +432,7 @@ sub language_menu {
}
}
-
+
sub directories_menu {
my %command=(
'self' => \&directories_menu,
@@ -476,63 +476,53 @@ EOF
print " Note: ~ will expand to \$HOME (or to %USERPROFILE% on Windows)\n";
}
- other_options qw (R Q);
+ other_options qw(R Q);
my $answer = prompt 'Enter command';
+ my $dir;
+
my $home = getenv('HOME');
$home = getenv('USERPROFILE') if (win32);
$home ||= '~';
if ("\u$answer" eq '1') {
print "New value for $maindir [$vars{$maindir}]: ";
- chomp($answer=<STDIN>);
- $vars{$maindir}="$answer" if (length $answer);
- $vars{$maindir}=~s@\\@/@g if (win32);
- $vars{$maindir} =~ s/^~/$home/;
+ $answer = &input_dirname ();
+ $vars{$maindir} = $answer if $answer ne "";
if ($vars{$maindir}=~/^(.*)\/$texlive_release$/) {
$vars{'TEXMFLOCAL'}="$1/texmf-local";
$vars{'TEXMFSYSVAR'}="$1/$texlive_release/texmf-var";
$vars{'TEXMFSYSCONFIG'}="$1/$texlive_release/texmf-config";
- $vars{'TEXDIRW'} = $vars{'TEXDIR'} unless $vars{'from_dvd'};
- return $command{'self'};
} elsif ($vars{$maindir}=~/^(.*)$/) {
$vars{'TEXMFLOCAL'}="$1/texmf-local";
$vars{'TEXMFSYSVAR'}="$1/texmf-var";
$vars{'TEXMFSYSCONFIG'}="$1/texmf-config";
- $vars{'TEXDIRW'} = $vars{'TEXDIR'} unless $vars{'from_dvd'};
- return $command{'self'};
}
+ $vars{'TEXDIRW'} = $vars{'TEXDIR'} unless $vars{'from_dvd'};
+ return $command{'self'};
} elsif ("\u$answer" eq '2') {
print "New value for TEXMFLOCAL [$vars{'TEXMFLOCAL'}]: ";
- chomp($answer=<STDIN>);
- $vars{'TEXMFLOCAL'}="$answer" if (length $answer);
- $vars{'TEXMFLOCAL'}=~s@\\@/@g if (win32);
- $vars{'TEXMFLOCAL'} =~ s/^~/$home/;
+ $answer = &input_dirname ();
+ $vars{'TEXMFLOCAL'} = $answer if $answer ne "";
return $command{'self'};
} elsif ("\u$answer" eq '3') {
print "New value for TEXMFSYSVAR [$vars{'TEXMFSYSVAR'}]: ";
- chomp($answer=<STDIN>);
- $vars{'TEXMFSYSVAR'}="$answer" if (length $answer);
- $vars{'TEXMFSYSVAR'}=~s@\\@/@g if (win32);
- $vars{'TEXMFSYSVAR'} =~ s/^~/$home/;
+ $answer = &input_dirname ();
+ $vars{'TEXMFSYSVAR'} = $answer if $answer ne "";
return $command{'self'};
} elsif ("\u$answer" eq '4') {
print "New value for TEXMFSYSCONFIG [$vars{'TEXMFSYSCONFIG'}]: ";
- chomp($answer=<STDIN>);
- $vars{'TEXMFSYSCONFIG'}="$answer" if (length $answer);
- $vars{'TEXMFSYSCONFIG'}=~s@\\@/@g if (win32);
- $vars{'TEXMFSYSCONFIG'} =~ s/^~/$home/;
+ $answer = &input_dirname ();
+ $vars{'TEXMFSYSCONFIG'} = $answer if $answer ne "";
return $command{'self'};
} elsif ("\u$answer" eq '5') {
print "New value for TEXMFHOME [$vars{'TEXMFHOME'}]: ";
- chomp($answer=<STDIN>);
- $vars{'TEXMFHOME'}="$answer" if (length $answer);
- $vars{'TEXMFHOME'}=~s@\\@/@g if (win32);
+ $answer = &input_dirname ();
+ $vars{'TEXMFHOME'} = $answer if $answer ne "";
return $command{'self'};
-
}
if (defined $command{"\u$answer"}) {
@@ -543,6 +533,26 @@ EOF
}
}
+
+# Helper function to read a directory name and clean it up.
+#
+sub input_dirname
+{
+ chomp (my $answer = <STDIN>);
+ return "" if $answer eq "";
+
+ $answer =~ s!\\!/!g if win32(); # switch to forward slashes
+ $answer =~ s/^~/$home/; # $home expansion
+
+ # relative paths are unlikely to work in texmf.cnf, et al.,
+ # and don't have any apparent practical use. Convert to absolute.
+ if (! File::Spec->file_name_is_absolute($answer)) {
+ $answer = Cwd::abs_path($answer);
+ }
+ return $answer;
+}
+
+
$vars{'page'}=0;
sub html2text {