|
From: <cod...@go...> - 2007-08-08 19:58:31
|
Author: easuter
Date: Wed Aug 8 12:57:31 2007
New Revision: 15
Modified:
trunk/Functions.module
trunk/frmChoice.class
Log:
Functions.CalcPaksSize now accepts the "all" argument, for calculating the
size of a bulk package selection.
Modified: trunk/Functions.module
==============================================================================
--- trunk/Functions.module (original)
+++ trunk/Functions.module Wed Aug 8 12:57:31 2007
@@ -237,26 +237,33 @@
DIM iSize AS Long
iSize = 0
-arsPackages = Split(selected_paks, ";") 'selected_packs is semi-colon delimited
+
'The config file must have the following layout for easy parsing
'(Package sizes must be in bytes!)
'
'Group: Base
-' Package_0:veclinux/required/veclinux.tlz|856480|Base System
-' Package_1:veclinux/required/vlconfig.tlz|33792|Config Files
+' Package_0:veclinux/required/veclinux.tlz|185597952|Base System
+' Package_1:veclinux/required/vlconfig.tlz|337945|Config Files
'Group: Dev
OPEN "/tmp/mnt/SOURCE/veclinux/vinstall-ng_packages.conf" FOR READ AS #hPackageConfig
WHILE NOT Eof(hPackageConfig)
LINE INPUT #hPackageConfig, sLine
- 'Find the sizes that correspond to each package reference by parsing the configuration file
- FOR EACH sPackageRef IN arsPackages
- IF InStr(sLine, "Package_" & sPackageRef & ":") > 0 THEN
+ 'Parse the package configuration file based on whether a bulk or individual package selection was made
+ IF InStr(selected_paks, "all") > 0 THEN
+ IF InStr(sLine, "Package_") > 0 THEN
iSize = iSize + Val(Trim$(Mid$(Left$(sLine, RInStr(sLine, "|") - 1), InStr(sLine, "|") + 1)))
- ENDIF
- NEXT
+ ENDIF
+ ELSE 'Parse individual package selection
+ arsPackages = Split(selected_paks, ";") 'selected_packs is semi-colon delimited when specific packages are selected
+ FOR EACH sPackageRef IN arsPackages
+ IF InStr(sLine, "Package_" & sPackageRef & ":") > 0 THEN
+ iSize = iSize + Val(Trim$(Mid$(Left$(sLine, RInStr(sLine, "|") - 1), InStr(sLine, "|") + 1)))
+ ENDIF
+ NEXT
+ ENDIF
WEND
CLOSE #hPackageConfig
@@ -271,14 +278,16 @@
DIM sTemp AS String
Utils.GetSysMemory
+iTotalSize = 0
IF Global.SimulationMode = TRUE THEN
- sTemp = "3800000"
+ sTemp = "38000000"
ELSE
SHELL "fdisk -s " & Global.installDrive TO sTemp
ENDIF
-iTotalSize = Val(sTemp) * 1024 'Convert to bytes
+iTotalSize = Val(sTemp)
+iTotalSize = iTotalSize * 1024 'Convert to bytes
'Return the size to be used for the root partition, in bytes, with a "safety margin" of 150MB
iRootSize = iTotalSize - CalcSwap(Global.SysMemory) - 157286400
Modified: trunk/frmChoice.class
==============================================================================
--- trunk/frmChoice.class (original)
+++ trunk/frmChoice.class Wed Aug 8 12:57:31 2007
@@ -35,7 +35,7 @@
'Debug
Utils.GetSysMemory
-frmGo.TextLabel1.Text = "Swap(MB): " & Functions.CalcSwap(Global.SysMemory) & " Root(MB): " & Functions.CalcRootSize() & " Packages will ocupy(MB): " & Functions.CalcPaksSize("0;1")
+frmGo.TextLabel1.Text = "Swap: " & Functions.AutoUnits(Functions.CalcSwap(Global.SysMemory)) & " Root: " & Functions.AutoUnits(Functions.AutoRootSize()) & " Packages will ocupy: " & Functions.AutoUnits(Functions.CalcPaksSize("all"))
END
|