From 42c9a43d8e2daa9a9963b9285ec47a95092825fd Mon Sep 17 00:00:00 2001 From: Siep Kroonenberg Date: Tue, 15 Mar 2022 18:32:50 +0000 Subject: Disk space check also in installer GUI git-svn-id: svn://tug.org/texlive/trunk@62712 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/installer/install-menu-extl.pl | 1 + Master/tlpkg/installer/install-tl-gui.tcl | 25 +++++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'Master/tlpkg') diff --git a/Master/tlpkg/installer/install-menu-extl.pl b/Master/tlpkg/installer/install-menu-extl.pl index 24a4d617d9e..4dd16ade9c7 100644 --- a/Master/tlpkg/installer/install-menu-extl.pl +++ b/Master/tlpkg/installer/install-menu-extl.pl @@ -83,6 +83,7 @@ sub read_vars { if ($l =~ /^([^:]+): (.*)$/) { $vars{$1} = $2; } elsif ($l eq 'endvars') { + $vars{'free_size'} = TeXLive::TLUtils::diskfree($vars{'TEXDIR'}); return 1; } else { return 0; diff --git a/Master/tlpkg/installer/install-tl-gui.tcl b/Master/tlpkg/installer/install-tl-gui.tcl index 27974bd4cc1..e654ce1b687 100755 --- a/Master/tlpkg/installer/install-tl-gui.tcl +++ b/Master/tlpkg/installer/install-tl-gui.tcl @@ -1,6 +1,6 @@ #!/usr/bin/env wish -# Copyright 2018-2021 Siep Kroonenberg +# Copyright 2018-2022 Siep Kroonenberg # This file is licensed under the GNU General Public License version 2 # or any later version. @@ -557,6 +557,7 @@ proc commit_root {} { set ::vars(TEXMFCONFIG) $::vars(TEXMFSYSCONFIG) } destroy .tltd + update_vars } ### main directory dialog ### @@ -1308,6 +1309,15 @@ proc abort_menu {} { # i.e. anything but advanced, alltrees or startinst } +proc maybe_install {} { + if {($::vars(free_size)!=-1) && \ + ($::vars(total_size) >= ($::vars(free_size)-100))} { + tk_messageBox -icon error -message [__ "Not enough room"] + } else { + set ::menu_ans "startinst" + } +} + proc run_menu {} { #if [info exists ::env(dbgui)] { # puts "\ndbgui: run_menu: advanced is now $::advanced" @@ -1391,8 +1401,8 @@ proc run_menu {} { # frame at bottom with install/quit buttons pack [ttk::frame .final] \ -in .bg -side bottom -pady {5pt 2pt} -fill x - ppack [ttk::button .install -text [__ "Install"] -command { - set ::menu_ans "startinst"}] -in .final -side right + ppack [ttk::button .install -text [__ "Install"] -command maybe_install] \ + -in .final -side right ppack [ttk::button .quit -text [__ "Quit"] -command { set ::out_log {} set ::menu_ans "no_inst"}] -in .final -side right @@ -1577,7 +1587,7 @@ proc run_menu {} { -in .selsf -row $rw -column 2 -sticky e } - # total size + # total size and available space # curf: current frame set curf [expr {$::advanced ? ".selsf" : ".dirf"}] incr rw @@ -1585,6 +1595,13 @@ proc run_menu {} { ttk::label .size_req -textvariable ::vars(total_size) pgrid .lsize -in $curf -row $rw -column 0 -sticky w pgrid .size_req -in $curf -row $rw -column 1 -sticky w + if {$::vars(free_size) != -1} { + incr rw + ttk::label .lavail -text [__ "Disk space available (in MB):"] + ttk::label .avail -textvariable ::vars(free_size) + pgrid .lavail -in $curf -row $rw -column 0 -sticky w + pgrid .avail -in $curf -row $rw -column 1 -sticky w + } ######################################################## # right side: options -- cgit v1.2.3