summaryrefslogtreecommitdiff
path: root/Master/install-tl
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-10-05 18:42:41 +0000
committerKarl Berry <karl@freefriends.org>2011-10-05 18:42:41 +0000
commit76c8f1d8a9ff5b2832de96993a8b23a5dcd96901 (patch)
treec7644938423955a39c64e2b4d717f12574b6a2a4 /Master/install-tl
parent071d21392a40a6ca37449a93fda018b5ae8ec4ea (diff)
prepare for install-tl error detection
git-svn-id: svn://tug.org/texlive/trunk@24212 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/install-tl')
-rwxr-xr-xMaster/install-tl138
1 files changed, 68 insertions, 70 deletions
diff --git a/Master/install-tl b/Master/install-tl
index 2615b1c084e..17238e0baae 100755
--- a/Master/install-tl
+++ b/Master/install-tl
@@ -478,13 +478,11 @@ if ($opt_profile eq "") {
do_cleanup();
flushlog();
exit(1);
- }
- if ($ret == $MENU_ABORT) {
+ } elsif ($ret == $MENU_ABORT) {
# omit do_cleanup().
flushlog();
exit(2);
- }
- if ($ret == $MENU_ALREADYDONE) {
+ } elsif ($ret == $MENU_ALREADYDONE) {
debug("run_menu has already done the work ... cleaning up.\n");
$finished = 1;
}
@@ -499,33 +497,39 @@ if ($opt_profile eq "") {
read_profile($opt_profile);
}
-my $varsdump;
+my $varsdump = "";
foreach my $key (sort keys %vars) {
- $varsdump.=" $key: \"" . $vars{$key} . "\"\n";
+ $varsdump .= " $key: \"" . $vars{$key} . "\"\n";
}
-
log("Settings:\n" . $varsdump);
+my $errcount = 0;
if (!$finished) {
# do the actual installation
- # win32: first, remove trailing slash from texdir[w]
+ # w32: first, remove trailing slash from texdir[w]
# in case it is the root of a drive
$vars{'TEXDIR'} =~ s![/\\]$!!;
- #$vars{'TEXDIRW'} = $vars{'TEXDIR'}; # no longer used
sanitise_options();
info("Installing to: $vars{TEXDIR}\n");
- do_installation();
+ $errcount = do_installation();
}
do_cleanup();
-exit(0);
+my $status = 0;
+if ($errcount > 0) {
+ $status = 1;
+ warn "$0: errors in installation reported above,\n";
+ warn "$0: exiting with bad status.\n";
+}
+exit($status);
+
###################################################################
#
# FROM HERE ON ONLY SUBROUTINES
-# NO VARIABLE DECLARATIONS
+# NO VARIABLE DECLARATIONS OR CODE
#
###################################################################
@@ -719,7 +723,7 @@ sub do_installation {
# installed to the $localtlpdb
foreach my $s ($tlpdb->schemes) {
my $stlp = $tlpdb->get_package($s);
- die ("That cannot happen, $s not defined in tlpdb") unless defined($stlp);
+ die ("This cannot happen, $s not defined in tlpdb") if ! defined($stlp);
my $incit = 1;
foreach my $d ($stlp->depends) {
if (!defined($localtlpdb->get_package($d))) {
@@ -732,38 +736,40 @@ sub do_installation {
}
}
$localtlpdb->save unless $vars{'in_place'};
- do_postinst_stuff();
+
+ my $errcount = do_postinst_stuff();
if (win32() || $vars{'portable'}) {
print welcome();
} else {
print welcome_paths();
}
print warnings_summary();
+
+ return $errcount;
}
+
#
-# do_postinst_stuff has to fix up the texmf tree and install some missing
-# files. The things to do are taken from the install-live.sh installer
-# of former times, and should be critically checked.
+# Make texmf.cnf, backup directory, cleanups, path setting, and
+# (most importantly) post-install subprograms: mktexlsr, fmtutil,
+# and more. Return count of errors detected, or zero.
sub do_postinst_stuff {
- my $TEXDIR="$vars{'TEXDIR'}";
- my $TEXMFSYSVAR="$vars{'TEXMFSYSVAR'}";
- my $TEXMFSYSCONFIG="$vars{'TEXMFSYSCONFIG'}";
- my $TEXMFVAR="$vars{'TEXMFVAR'}";
- my $TEXMFCONFIG="$vars{'TEXMFCONFIG'}";
- my $TEXMFLOCAL="$vars{'TEXMFLOCAL'}";
+ my $TEXDIR = "$vars{'TEXDIR'}";
+ my $TEXMFSYSVAR = "$vars{'TEXMFSYSVAR'}";
+ my $TEXMFSYSCONFIG = "$vars{'TEXMFSYSCONFIG'}";
+ my $TEXMFVAR = "$vars{'TEXMFVAR'}";
+ my $TEXMFCONFIG = "$vars{'TEXMFCONFIG'}";
+ my $TEXMFLOCAL = "$vars{'TEXMFLOCAL'}";
my $tmv;
do_texmf_cnf();
- #
# clean up useless files in texmf-dist/tlpkg as this is only
# created by the relocatable packages
if (-d "$TEXDIR/$TeXLive::TLConfig::RelocTree/tlpkg") {
rmtree("$TEXDIR/TeXLive::TLConfig::RelocTree/tlpkg");
}
- #
# create package backup directory for tlmgr autobackup to work
mkdirhier("$TEXDIR/$TeXLive::TLConfig::PackageBackupDir");
@@ -795,41 +801,27 @@ operations might be disturbed.\n\n";
# Step 2: Setup the PATH, switch to the new Perl
- my $pathsep=(win32)? ';' : ':';
- my $plat_bindir="$TEXDIR/bin/$vars{'this_platform'}";
- my $perl_bindir="$TEXDIR/tlpkg/tlperl/bin";
- my $perl_libdir="$TEXDIR/tlpkg/tlperl/lib";
-
-## This won't do any good;
-## have to remove other tex directories in calling batchfile
-# if (win32) {
-# debug("Removing other TeXs from path\n");
-# my @newpt = ();
-# foreach my $d (split (';', $ENV{'PATH'})) {
-# push @newpt, $d unless TeXLive::TLWinGoo::is_a_texdir($d);
-# }
-# $ENV{'PATH'} = join($pathsep, @newpt);
-# debug("Path after removals(s):\n $ENV{'PATH'}\n");
-# }
+ my $pathsep = (win32)? ';' : ':';
+ my $plat_bindir = "$TEXDIR/bin/$vars{'this_platform'}";
+ my $perl_bindir = "$TEXDIR/tlpkg/tlperl/bin";
+ my $perl_libdir = "$TEXDIR/tlpkg/tlperl/lib";
debug("Prepending $plat_bindir to PATH\n");
-
- $ENV{'PATH'}="$plat_bindir" . "$pathsep" . "$ENV{'PATH'}";
+ $ENV{'PATH'} = $plat_bindir . $pathsep . $ENV{'PATH'};
if (win32) {
debug("Prepending $perl_bindir to PATH\n");
- $ENV{'PATH'}="$perl_bindir" . "$pathsep" . "$ENV{'PATH'}";
+ $ENV{'PATH'} = "$perl_bindir" . "$pathsep" . "$ENV{'PATH'}";
$ENV{'PATH'} =~ s!/!\\!g;
}
- debug("\nNew PATH is now:\n");
+ debug("\nNew PATH is:\n");
foreach my $dir (split $pathsep, $ENV{'PATH'}) {
debug(" $dir\n");
}
debug("\n");
-
if (win32) {
- $ENV{'PERL5LIB'}="$perl_libdir";
+ $ENV{'PERL5LIB'} = $perl_libdir;
}
#
@@ -838,7 +830,6 @@ operations might be disturbed.\n\n";
my $usedtlpdb = $vars{'in_place'} ? $tlpdb : $localtlpdb;
-
if (win32()) {
debug "Actual environment:\n".`set`."\n\n";
debug 'Effective TEXMFCNF: '.`kpsewhich -expand-path=\$TEXMFCNF`."\n";
@@ -846,12 +837,14 @@ operations might be disturbed.\n\n";
if (win32() and !$vars{'portable'} and !$vars{'in_place'}) {
create_uninstaller($vars{'TEXDIR'},
- $vars{'TEXMFSYSVAR'}, $vars{'TEXMFSYSCONFIG'});
+ $vars{'TEXMFSYSVAR'}, $vars{'TEXMFSYSCONFIG'});
# TODO: custom uninstaller for in_place
# (re-)initialize batchfile for uninstalling shortcuts
}
# Step 4: run the programs
+ my $errcount = 0;
+ # xxxx errcount -- check all these things and add any errors.
if (!$vars{'in_place'}) {
info("running mktexlsr $TEXDIR/texmf-dist $TEXDIR/texmf...\n");
@@ -941,17 +934,23 @@ operations might be disturbed.\n\n";
# on both, we run the postaction directives of the tlpdb
# no need to test for portable or in_place:
# the menus (or profile?) should have set the required options
- do_tlpdb_postactions();
+ $errcount += do_tlpdb_postactions();
+
+ return $errcount;
}
+# Run the post installation code in the postaction tlpsrc entries.
+# Return number of errors found, or zero.
+
sub do_tlpdb_postactions {
- info ("running package specific postactions\n");
- # Run the post installation code in the postaction tlpsrc entries
- # For now the option_desktop_integrations maps to both desktop
- # and menu entries, but we can split that later
+ info ("running package-specific postactions\n");
+
# option settings already reflect portable- and in_place options.
my $usedtlpdb = $vars{'in_place'} ? $tlpdb : $localtlpdb;
+
+ # For now the option_desktop_integrations maps to both desktop
+ # and menu entries, but we can split that later
foreach my $package ($usedtlpdb->list_packages) {
&TeXLive::TLUtils::do_postaction("install",
$usedtlpdb->get_package($package),
@@ -960,7 +959,9 @@ sub do_tlpdb_postactions {
$vars{'option_desktop_integration'},
$vars{'option_post_code'});
}
- info ("finished with package specific postactions\n");
+ info ("finished with package-specific postactions\n");
+
+ return 0; # xxxx errcount
}
sub do_path_adjustments {
@@ -1818,11 +1819,11 @@ sub update_numbers {
sub flushlog {
my $fh;
if (open(LOG,">install-tl.log")) {
- printf "Writing log file to current working directory.\n";
+ printf "Writing install-tl.log in current working directory.\n";
$fh = \*LOG;
} else {
$fh = \*STDERR;
- printf "Not creating a log file but flushing messages to stderr.\n";
+ printf "Could not write log file, so flushing messages to stderr.\n";
}
foreach my $l (@::LOGLINES) {
@@ -1843,11 +1844,10 @@ sub check_on_lang_collection_installed {
}
sub do_cleanup {
- # now open the log file and write out the log lines
- # try to open a log file
+ # now open the log file and write out the log lines if needed.
# the user could have given the -logfile option in which case all the
# stuff is already dumped to it and $::LOGFILE defined. So do not
- # redefine it
+ # redefine it.
if (!defined($::LOGFILE)) {
if (open(LOGF,">$vars{'TEXDIR'}/install-tl.log")) {
$::LOGFILE = \*LOGF;
@@ -1898,7 +1898,7 @@ sub welcome {
TeX Live is a joint project of the TeX user groups around the world;
please consider supporting it by joining the group best for you. The
- list of groups is available on the web at http://tug.org/usergroups.html.
+ list of user groups is on the web at http://tug.org/usergroups.html.
Welcome to TeX Live!
EOF
@@ -1945,9 +1945,9 @@ EOF
----------------------------------------------------------------------
The following environment variables contain the string "tex"
(case-independent). If you're doing anything but adding personal
- directories to the system paths, they may well cause trouble with
- some parts of running TeX. If you encounter problems, try unsetting
- them. Please ignore any spurious matches that are unrelated to TeX.
+ directories to the system paths, they may well cause trouble somewhere
+ while running TeX. If you encounter problems, try unsetting them.
+ Please ignore spurious matches unrelated to TeX.
$texenvs ----------------------------------------------------------------------
EOF
@@ -1963,28 +1963,26 @@ EOF
}
-#
# remember the warnings issued
sub install_warnlines_hook {
push @::warn_hook, sub { push @::WARNLINES, @_; };
}
-#
# a summary of warnings if there were any
sub warnings_summary {
return '' unless @::WARNLINES;
my $summary = <<EOF;
- There were some warnings during the installation process.
- Here is a summary of warning messages:
+ Summary of warning messages during installation:
EOF
$summary .= ' ' . join(' ', @::WARNLINES) . "\n";
return $summary;
}
+
-#
-# some helper fucntion
+# some helper functions
+#
sub select_collections {
my $varref = shift;
foreach (@_) {