texlive[62712] Master/tlpkg/installer: Disk space check also in

commits+siepo at tug.org commits+siepo at tug.org
Tue Mar 15 19:32:51 CET 2022


Revision: 62712
          http://tug.org/svn/texlive?view=revision&revision=62712
Author:   siepo
Date:     2022-03-15 19:32:50 +0100 (Tue, 15 Mar 2022)
Log Message:
-----------
Disk space check also in installer GUI

Modified Paths:
--------------
    trunk/Master/tlpkg/installer/install-menu-extl.pl
    trunk/Master/tlpkg/installer/install-tl-gui.tcl

Modified: trunk/Master/tlpkg/installer/install-menu-extl.pl
===================================================================
--- trunk/Master/tlpkg/installer/install-menu-extl.pl	2022-03-15 02:28:46 UTC (rev 62711)
+++ trunk/Master/tlpkg/installer/install-menu-extl.pl	2022-03-15 18:32:50 UTC (rev 62712)
@@ -83,6 +83,7 @@
     if ($l =~ /^([^:]+): (.*)$/) {
       $vars{$1} = $2;
     } elsif ($l eq 'endvars') {
+      $vars{'free_size'} = TeXLive::TLUtils::diskfree($vars{'TEXDIR'});
       return 1;
     } else {
       return 0;

Modified: trunk/Master/tlpkg/installer/install-tl-gui.tcl
===================================================================
--- trunk/Master/tlpkg/installer/install-tl-gui.tcl	2022-03-15 02:28:46 UTC (rev 62711)
+++ trunk/Master/tlpkg/installer/install-tl-gui.tcl	2022-03-15 18:32:50 UTC (rev 62712)
@@ -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 @@
     set ::vars(TEXMFCONFIG) $::vars(TEXMFSYSCONFIG)
   }
   destroy .tltd
+  update_vars
 }
 
 ### main directory dialog ###
@@ -1308,6 +1309,15 @@
   # 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 @@
   # 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 @@
         -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 @@
   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



More information about the tex-live-commits mailing list.