Skip to content

Commit

Permalink
Functions.CalcPaksSize now accepts the "all" argument, for calculatin…
Browse files Browse the repository at this point in the history
…g the

size of a bulk package selection.
  • Loading branch information
easuter committed Aug 8, 2007
1 parent 6b7a0ec commit b025a64
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
29 changes: 19 additions & 10 deletions Functions.module
Original file line number Diff line number Diff line change
Expand Up @@ -237,26 +237,33 @@ DIM sPackageRef AS String
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

Expand All @@ -271,14 +278,16 @@ DIM iTotalSize AS Long
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
Expand Down
2 changes: 1 addition & 1 deletion frmChoice.class
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ frmMain.btnGo_Click ' Advance to Go for it!.

'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

Expand Down

0 comments on commit b025a64

Please sign in to comment.