From: <cod...@go...> - 2007-08-09 22:43:41
|
Author: easuter Date: Thu Aug 9 15:42:31 2007 New Revision: 17 Modified: trunk/.lang/.pot trunk/.lang/frmChoice.pot trunk/Functions.module trunk/Main.module trunk/frmChoice.class Log: - Functions.AutoRootSize now accepts a partition mode as an argument, in order to calculate the root partition size for that mode (auto and freespace modes, though the free-space mode still needs work) - Functions.EnoughSpace() created to compare the theoretical root partition size with the space the packages will ocupy (returns a boolean value). Modified: trunk/.lang/.pot ============================================================================== --- trunk/.lang/.pot (original) +++ trunk/.lang/.pot Thu Aug 9 15:42:31 2007 @@ -26,7 +26,7 @@ msgid "Cancel" msgstr "" -#: frmChoice.class:95 +#: frmChoice.class:94 msgid "" "<center><h3><b>You have 3 choices:</b></h3></center>\n" "\n" @@ -47,23 +47,23 @@ "</ul>\n" msgstr "" -#: frmChoice.class:106 +#: frmChoice.class:105 msgid "Choose install type" msgstr "" -#: frmChoice.class:121 +#: frmChoice.class:120 msgid "Install types" msgstr "" -#: frmChoice.class:126 +#: frmChoice.class:125 msgid "Full-automatic" msgstr "" -#: frmChoice.class:132 +#: frmChoice.class:131 msgid "Semi-automatic" msgstr "" -#: frmChoice.class:138 +#: frmChoice.class:137 msgid "Advanced" msgstr "" Modified: trunk/.lang/frmChoice.pot ============================================================================== --- trunk/.lang/frmChoice.pot (original) +++ trunk/.lang/frmChoice.pot Thu Aug 9 15:42:31 2007 @@ -14,27 +14,27 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: frmChoice.class:95 +#: frmChoice.class:94 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:106 +#: frmChoice.class:105 msgid "Choose install type" msgstr "" -#: frmChoice.class:121 +#: frmChoice.class:120 msgid "Install types" msgstr "" -#: frmChoice.class:126 +#: frmChoice.class:125 msgid "Full-automatic" msgstr "" -#: frmChoice.class:132 +#: frmChoice.class:131 msgid "Semi-automatic" msgstr "" -#: frmChoice.class:138 +#: frmChoice.class:137 msgid "Advanced" msgstr "" Modified: trunk/Functions.module ============================================================================== --- trunk/Functions.module (original) +++ trunk/Functions.module Thu Aug 9 15:42:31 2007 @@ -222,8 +222,8 @@ RETURN sysmem * 2.5 ELSE IF sysmem < 268435456 AND sysmem > 134217728 THEN RETURN sysmem * 2 -ELSE - RETURN 536870912 'Don't return swap partition sizes above 512MB +ELSE 'Don't return swap partition sizes above 512MB + RETURN 536870912 ENDIF END @@ -271,26 +271,55 @@ END -PUBLIC FUNCTION AutoRootSize() AS Long -'Calculate the size of the theoretical root partition +PUBLIC FUNCTION AutoRootSize(partmode AS Integer) AS Long +'Calculate the size of the theoretical root partition, for the automatic or free-space partitioning modes DIM iRootSize AS Long DIM iTotalSize AS Long DIM sTemp AS String -Utils.GetSysMemory -iTotalSize = 0 - -IF Global.SimulationMode = TRUE THEN - sTemp = "38000000" -ELSE - SHELL "fdisk -s " & Global.installDrive TO sTemp +IF Global.enumPARTMODE = 0 THEN 'Use entire drive + IF Global.SimulationMode = TRUE THEN + sTemp = "3800000" + ELSE 'Get real value from fdisk + SHELL "fdisk -s " & Global.installDrive TO sTemp + ENDIF + + iTotalSize = CLng(Val(Trim$(sTemp))) * 1024 'Convert to long integer and turn value into bytes + iRootSize = iTotalSize - CalcSwap(Global.SysMemory) + +ELSE IF Global.enumPARTMODE = 1 'Use only free space + IF Global.SimulationMode = TRUE THEN + sTemp = "3800000" + ELSE + 'Do whatever needs to be done to get free space values from available partitions + ENDIF +ELSE + Message.Error("Unacceptable partition mode (" & Global.enumPARTMODE & ") for AutoRootSize function.") ENDIF -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 RETURN iRootSize +END + +PUBLIC FUNCTION EnoughSpace() AS Boolean +'Check whether the space destined to the package installation is enough (with a 150MB "safety" margin) +DIM iAvailableSpace AS Long + +IF Global.enumPARTMODE = 0 THEN + iAvailableSpace = AutoRootSize - CalcSwap(Global.SysMemory) - 157286400 + IF iAvailableSpace > CalcPaksSize("all") THEN + RETURN TRUE + ELSE + RETURN FALSE + ENDIF +'Do the same for other partition modes +ELSE IF Global.enumPARTMODE = 1 THEN +ELSE IF Global.enumPARTMODE = 2 THEN +ELSE IF Global.enumPARTMODE = 3 THEN +ELSE IF Global.enumPARTMODE = 4 THEN +ELSE IF Global.enumPARTMODE = 5 THEN +ELSE + Message.Error("Invalid partition mode: " & Global.enumPARTMODE) +ENDIF + END Modified: trunk/Main.module ============================================================================== --- trunk/Main.module (original) +++ trunk/Main.module Thu Aug 9 15:42:31 2007 @@ -16,6 +16,9 @@ Global.SimulationMode = FALSE ENDIF +'Get some basic system info processed: +Utils.GetSysMemory + ' Initially no buttons being executed: Global.flagBUTTExec = FALSE Modified: trunk/frmChoice.class ============================================================================== --- trunk/frmChoice.class (original) +++ trunk/frmChoice.class Thu Aug 9 15:42:31 2007 @@ -25,6 +25,9 @@ PUBLIC SUB btnFullAuto_Click() ' Full-automatic. Global.enumINSTMODE = 0 ' Full-automatic install mode. +Global.enumPARTMODE = 0 'Full-automatic partitioning +Global.enumPACKS = 0 'All packages selected +Global.enumLILOMODE = 0 'Install lilo to MBR Utils.DrivePartInfo IF Global.DiskInfo.Count >= 1 THEN frmDriveSelect.ShowModal @@ -32,10 +35,6 @@ frmMain.btnChoice.Enabled = FALSE ' Disable Choices. frmMain.btnGo.Enabled = TRUE ' Enable Go for it!. frmMain.btnGo_Click ' Advance to Go for it!. - -'Debug -Utils.GetSysMemory -frmGo.TextLabel1.Text = "Swap: " & Functions.AutoUnits(Functions.CalcSwap(Global.SysMemory)) & " Root: " & Functions.AutoUnits(Functions.AutoRootSize()) & " Packages will ocupy: " & Functions.AutoUnits(Functions.CalcPaksSize("all")) END |