diff --git a/.lang/.pot b/.lang/.pot index 18d7b4c..9537a9d 100644 --- a/.lang/.pot +++ b/.lang/.pot @@ -26,7 +26,7 @@ msgstr "" msgid "Cancel" msgstr "" -#: frmChoice.class:93 +#: frmChoice.class:95 msgid "" "

You have 3 choices:

\n" "\n" @@ -47,23 +47,23 @@ msgid "" "\n" msgstr "" -#: frmChoice.class:104 +#: frmChoice.class:106 msgid "Choose install type" msgstr "" -#: frmChoice.class:119 +#: frmChoice.class:121 msgid "Install types" msgstr "" -#: frmChoice.class:124 +#: frmChoice.class:126 msgid "Full-automatic" msgstr "" -#: frmChoice.class:130 +#: frmChoice.class:132 msgid "Semi-automatic" msgstr "" -#: frmChoice.class:136 +#: frmChoice.class:138 msgid "Advanced" msgstr "" diff --git a/.lang/frmChoice.pot b/.lang/frmChoice.pot index 915c53a..5a66722 100644 --- a/.lang/frmChoice.pot +++ b/.lang/frmChoice.pot @@ -14,27 +14,27 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: frmChoice.class:93 +#: frmChoice.class:95 msgid "

You have 3 choices:

\n\n\n" msgstr "" -#: frmChoice.class:104 +#: frmChoice.class:106 msgid "Choose install type" msgstr "" -#: frmChoice.class:119 +#: frmChoice.class:121 msgid "Install types" msgstr "" -#: frmChoice.class:124 +#: frmChoice.class:126 msgid "Full-automatic" msgstr "" -#: frmChoice.class:130 +#: frmChoice.class:132 msgid "Semi-automatic" msgstr "" -#: frmChoice.class:136 +#: frmChoice.class:138 msgid "Advanced" msgstr "" diff --git a/Functions.module b/Functions.module index 5f4fca5..2227ff0 100644 --- a/Functions.module +++ b/Functions.module @@ -228,4 +228,55 @@ ENDIF END +PUBLIC FUNCTION CalcPaksSize(selected_paks AS String) AS Long +'Calculate the space required by the user's package selection +'Call the function by separating the package references with semi-colons +DIM arsPackages AS string[] +DIM hPackageConfig AS file +DIM sLine AS String +DIM sPackageRef AS String +DIM iSize AS Long +iSize = 0 +arsPackages = Split(selected_paks, ";") + +'The config file must have the following layout for easy parsing (example): +' +'Group: Base +' Package_0:veclinux/required/veclinux.tlz|856480|Base System +' Package_1:veclinux/required/vlconfig.tlz|33792| 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 + iSize = iSize + Val(Mid$(Left$(sLine, RInStr(sLine, "|") - 1), InStr(sLine, "|") + 1)) + ENDIF + NEXT + WEND +CLOSE #hPackageConfig + +iSize = iSize / 1024 'Convert the value to megabytes and then return it +RETURN iSize + +END + +PUBLIC FUNCTION CalcRootSize() AS Long +'Calculate the size of the theoretical root partition +DIM iRootSize AS Long +DIM iTotalSize AS Long +DIM sTemp AS String + +Utils.GetSysMemory +SHELL "fdisk -s " & Global.installDrive TO sTemp +iTotalSize = Val(sTemp) / 1024 + +'Return the size to be used for the root partition, in megabytes, with a "safety margin" of 200MB +iRootSize = iTotalSize - CalcSwap(Global.SysMemory) - 200 +RETURN iRootSize + +END diff --git a/Global.class b/Global.class index 22d8e5f..4dc6b80 100644 --- a/Global.class +++ b/Global.class @@ -44,7 +44,6 @@ STATIC PUBLIC enumLILOMODE AS Long 'Boot manager installation. 'System memory declarations: STATIC PUBLIC SysMemory AS Integer -STATIC PUBLIC SwapMemory AS Integer ' Drive and partition declarations: STATIC PUBLIC DiskInfo AS NEW Object[] @@ -66,3 +65,5 @@ STATIC PUBLIC tproc AS Process 'temp stuff 2 check out: STATIC PUBLIC installDrive AS String + + diff --git a/frmChoice.class b/frmChoice.class index ec99d58..6c69b30 100644 --- a/frmChoice.class +++ b/frmChoice.class @@ -24,26 +24,27 @@ END PUBLIC SUB btnFullAuto_Click() ' Full-automatic. -Global.enumINSTMODE = 1 ' Full-automatic install mode. +Global.enumINSTMODE = 0 ' Full-automatic install mode. Utils.DrivePartInfo -IF Global.DiskInfo.Count > 1 THEN frmDriveSelect.ShowModal +IF Global.DiskInfo.Count >= 1 THEN frmDriveSelect.ShowModal frmMain.btnChoice.Enabled = FALSE ' Disable Choices. frmMain.btnGo.Enabled = TRUE ' Enable Go for it!. frmMain.btnGo_Click ' Advance to Go for it!. -'Debug: + +'Debug Utils.GetSysMemory -frmGo.TextLabel1.Text = "Memory: " & Global.SysMemory & "\n" & "Swap: " & Functions.CalcSwap(Global.SysMemory) +frmGo.TextLabel1.Text = "Swap(MB): " & Functions.CalcSwap(Global.SysMemory) & " Root(MB): " & Functions.CalcRootSize() & " Packages will ocupy(MB): " & Functions.CalcPaksSize("0;1") END PUBLIC SUB btnSemiAuto_Click() ' Semi-automatic. -Global.enumINSTMODE = 1 ' Semi-automatic install mode. -frmMain.btnChoice.Enabled = FALSE ' Disable Choices. -frmMain.btnPartitions.Enabled = TRUE ' Enable Partitions. -frmMain.btnPartitions_Click ' Advance to Partitions. +' Global.enumINSTMODE = 1 ' Semi-automatic install mode. +' frmMain.btnChoice.Enabled = FALSE ' Disable Choices. +' frmMain.btnPartitions.Enabled = TRUE ' Enable Partitions. +' frmMain.btnPartitions_Click ' Advance to Partitions. END