summaryrefslogtreecommitdiff
path: root/Master/install-tl
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2022-03-05 14:03:21 +0000
committerNorbert Preining <preining@logic.at>2022-03-05 14:03:21 +0000
commit3f56a2387224b352fe370d8ec94ca49aa1d3d937 (patch)
tree4edf802ca70969a3030853e2534c6dd9890e3b03 /Master/install-tl
parent09a830748cdedad7fc6dbd8d239513e7374c97f4 (diff)
installer and free disk space improvements
- factor free disk space computation into a new TLUtils function - save (and update) the free disk space for the current TEXDIR in %vars - display the free disk space (if it is available) in the text menu git-svn-id: svn://tug.org/texlive/trunk@62431 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/install-tl')
-rwxr-xr-xMaster/install-tl38
1 files changed, 9 insertions, 29 deletions
diff --git a/Master/install-tl b/Master/install-tl
index 73c1a525d98..5f1cf6896e3 100755
--- a/Master/install-tl
+++ b/Master/install-tl
@@ -907,6 +907,8 @@ sub final_remote_init {
set_texlive_default_dirs();
set_install_platform();
initialize_collections();
+ # size information
+ $vars{'free_size'} = TeXLive::TLUtils::diskfree($vars{'TEXDIR'});
# initialize the scheme from the command line value, if given.
if ($opt_scheme) {
@@ -943,35 +945,13 @@ sub do_installation {
if (win32()) {
TeXLive::TLWinGoo::maybe_make_ro ($vars{'TEXDIR'});
}
- # If df is available, check for free disk space
- if ($::progs{"df"}) {
- # To ensure that GNU coreutil df returns POSIX style 512-blocks,
- # it is necessary to set POSIXLY_CORRECT=1
- # (GNU df defaults to 1024-block)
- # https://en.wikipedia.org/wiki/POSIX#512-_vs_1024-byte_blocks
- my $td = $vars{'TEXDIR'};
- $td .= "/" if ($td !~ m!/$!);
- debug("Checking for free diskspace in $td\n");
- my ($output, $retval) =
- TeXLive::TLUtils::run_cmd("df -P \"$vars{'TEXDIR'}\"",
- POSIXLY_CORRECT => 1);
- if ($retval == 0) {
- # Output format should be this:
- # Filesystem 512-blocks Used Available Capacity Mounted on
- # /dev/sdb3 6099908248 3590818104 2406881416 60% /home
- my ($h,$l) = split(/\n/, $output);
- my ($fs, $nrb, $used, $avail, @rest) = split(' ', $l);
- debug("disk space: used=$used (512-block), avail=$avail (512-block),",
- " required=$vars{'total_size'} (Mb)\n");
- # $vars{'total_size'} is number required in Mb (1024**2)
- # $vars{'total_size'} =
- # sprintf "%d", ($size * $TeXLive::TLConfig::BlockSize)/1024**2;
- # $avail is in 512 blocks, so we need to device by 2 * 1024 to obtain Mb
- # require that at least 100M remain free
- my $reserve = 100;
- if ( $avail / 2024 + $reserve < $vars{'total_size'}) {
- die("DISK SPACE INSUFFICIENT!");
- }
+ # check for free disk space
+ my $diskfree = TeXLive::TLUtils::diskfree($vars{'TEXDIR'});
+ # -1 is returned if df not available or some other error
+ if ($diskfree != -1) {
+ my $reserve = 100;
+ if ( $diskfree + $reserve < $vars{'total_size'}) {
+ die("DISK SPACE INSUFFICIENT!");
}
}
# now remove final slash from TEXDIR even if it is the root of a drive