Skip to content

Commit

Permalink
Added to Functions.module:
Browse files Browse the repository at this point in the history
-Total package size calculation based on the user's selection: CalcPaksSize
-Root partition size calculation for the "full disk" option: CalcRootSize

Added to frmChoice.class:

-some simple debugging info the be displayed in the frmGo form.
  • Loading branch information
easuter committed Aug 7, 2007
1 parent 3d34fbc commit 5206cfb
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 21 deletions.
12 changes: 6 additions & 6 deletions .lang/.pot
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ msgstr ""
msgid "Cancel"
msgstr ""

#: frmChoice.class:93
#: frmChoice.class:95
msgid ""
"<center><h3><b>You have 3 choices:</b></h3></center>\n"
"\n"
Expand All @@ -47,23 +47,23 @@ msgid ""
"</ul>\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 ""

Expand Down
12 changes: 6 additions & 6 deletions .lang/frmChoice.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<center><h3><b>You have 3 choices:</b></h3></center>\n\n<ul>\n<li><b><u>Full-automatic install:</u></b> Our easiest install yet; choose this option if you want to use your entire hard disk for VL. Your system will be automatically set up, partitions and all. <font color=\"#FF0000\">WARNING: this option will DELETE everything on your hard disk, or offer a choice if there are multiple disks.</font> There will of course be a confirmation dialog in case you selected this option by mistake.</li>\n<li><b><u>Semi-automatic install:</u></b> With this option, you manually partition your drives with gparted, but the rest of the setup will be pretty automatic.</li>\n<li><b><u>Advanced install:</u></b> For the technically savvy user that must do everything by hand. You can control most aspects of the install. However, there will be assisted options available all the way through, so this is a very flexible install.</li>\n</ul>\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 ""

51 changes: 51 additions & 0 deletions Functions.module
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion Global.class
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
Expand All @@ -66,3 +65,5 @@ STATIC PUBLIC tproc AS Process
'temp stuff 2 check out:
STATIC PUBLIC installDrive AS String



17 changes: 9 additions & 8 deletions frmChoice.class
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 5206cfb

Please sign in to comment.