Skip to content

Commit

Permalink
Added swap size calculation based on system memory
Browse files Browse the repository at this point in the history
  • Loading branch information
easuter committed Aug 6, 2007
1 parent 8df72e9 commit 3d34fbc
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 55 deletions.
54 changes: 27 additions & 27 deletions .lang/.pot
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ msgstr ""
msgid "Enter a value:"
msgstr ""

#: InputBox.class:205 frmDriveSelect.class:126 frmPartSelect.class:371
#: InputBox.class:205 frmDriveSelect.class:126 frmPartSelect.class:372
msgid "OK"
msgstr ""

#: InputBox.class:212 frmDriveSelect.class:133 frmPartSelect.class:378
#: InputBox.class:212 frmDriveSelect.class:133 frmPartSelect.class:379
msgid "Cancel"
msgstr ""

#: frmChoice.class:91
#: frmChoice.class:93
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:102
#: frmChoice.class:104
msgid "Choose install type"
msgstr ""

#: frmChoice.class:117
#: frmChoice.class:119
msgid "Install types"
msgstr ""

#: frmChoice.class:122
#: frmChoice.class:124
msgid "Full-automatic"
msgstr ""

#: frmChoice.class:128
#: frmChoice.class:130
msgid "Semi-automatic"
msgstr ""

#: frmChoice.class:134
#: frmChoice.class:136
msgid "Advanced"
msgstr ""

Expand Down Expand Up @@ -137,7 +137,7 @@ msgstr ""
msgid "Config 2"
msgstr ""

#: frmDriveSelect.class:107 frmPartSelect.class:346
#: frmDriveSelect.class:107 frmPartSelect.class:347
msgid "Drives"
msgstr ""

Expand All @@ -157,7 +157,7 @@ msgstr ""
msgid "The choice"
msgstr ""

#: frmMain.class:225 frmPartSelect.class:386
#: frmMain.class:225 frmPartSelect.class:387
msgid "Partitions"
msgstr ""

Expand Down Expand Up @@ -231,71 +231,71 @@ msgstr ""
msgid "No extras"
msgstr ""

#: frmPartSelect.class:260
#: frmPartSelect.class:261
msgid "Mountpoints"
msgstr ""

#: frmPartSelect.class:266
#: frmPartSelect.class:267
msgid "/"
msgstr ""

#: frmPartSelect.class:272
#: frmPartSelect.class:273
msgid "/home"
msgstr ""

#: frmPartSelect.class:278
#: frmPartSelect.class:279
msgid "/var"
msgstr ""

#: frmPartSelect.class:284
#: frmPartSelect.class:285
msgid "/opt"
msgstr ""

#: frmPartSelect.class:290
#: frmPartSelect.class:291
msgid "/tmp"
msgstr ""

#: frmPartSelect.class:296
#: frmPartSelect.class:297
msgid "/boot"
msgstr ""

#: frmPartSelect.class:302
#: frmPartSelect.class:303
msgid "/usr"
msgstr ""

#: frmPartSelect.class:308
#: frmPartSelect.class:309
msgid "/share"
msgstr ""

#: frmPartSelect.class:314
#: frmPartSelect.class:315
msgid "FileSystem"
msgstr ""

#: frmPartSelect.class:320
#: frmPartSelect.class:321
msgid "xfs"
msgstr ""

#: frmPartSelect.class:326
#: frmPartSelect.class:327
msgid "reiserfs"
msgstr ""

#: frmPartSelect.class:332
#: frmPartSelect.class:333
msgid "ext3"
msgstr ""

#: frmPartSelect.class:338
#: frmPartSelect.class:339
msgid "ext2"
msgstr ""

#: frmPartSelect.class:354
#: frmPartSelect.class:355
msgid "Click on select install drive"
msgstr ""

#: frmPartSelect.class:360
#: frmPartSelect.class:361
msgid "Right-click in Mount or FileSystem to set"
msgstr ""

#: frmPartSelect.class:394
#: frmPartSelect.class:395
msgid ""
"<ul>\n"
"<li>Left-click to (un)select drive(s) to install Vector Linux.</li>\n"
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:91
#: frmChoice.class:93
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:102
#: frmChoice.class:104
msgid "Choose install type"
msgstr ""

#: frmChoice.class:117
#: frmChoice.class:119
msgid "Install types"
msgstr ""

#: frmChoice.class:122
#: frmChoice.class:124
msgid "Full-automatic"
msgstr ""

#: frmChoice.class:128
#: frmChoice.class:130
msgid "Semi-automatic"
msgstr ""

#: frmChoice.class:134
#: frmChoice.class:136
msgid "Advanced"
msgstr ""

42 changes: 21 additions & 21 deletions .lang/frmPartSelect.pot
Original file line number Diff line number Diff line change
Expand Up @@ -14,87 +14,87 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: frmPartSelect.class:260
#: frmPartSelect.class:261
msgid "Mountpoints"
msgstr ""

#: frmPartSelect.class:266
#: frmPartSelect.class:267
msgid "/"
msgstr ""

#: frmPartSelect.class:272
#: frmPartSelect.class:273
msgid "/home"
msgstr ""

#: frmPartSelect.class:278
#: frmPartSelect.class:279
msgid "/var"
msgstr ""

#: frmPartSelect.class:284
#: frmPartSelect.class:285
msgid "/opt"
msgstr ""

#: frmPartSelect.class:290
#: frmPartSelect.class:291
msgid "/tmp"
msgstr ""

#: frmPartSelect.class:296
#: frmPartSelect.class:297
msgid "/boot"
msgstr ""

#: frmPartSelect.class:302
#: frmPartSelect.class:303
msgid "/usr"
msgstr ""

#: frmPartSelect.class:308
#: frmPartSelect.class:309
msgid "/share"
msgstr ""

#: frmPartSelect.class:314
#: frmPartSelect.class:315
msgid "FileSystem"
msgstr ""

#: frmPartSelect.class:320
#: frmPartSelect.class:321
msgid "xfs"
msgstr ""

#: frmPartSelect.class:326
#: frmPartSelect.class:327
msgid "reiserfs"
msgstr ""

#: frmPartSelect.class:332
#: frmPartSelect.class:333
msgid "ext3"
msgstr ""

#: frmPartSelect.class:338
#: frmPartSelect.class:339
msgid "ext2"
msgstr ""

#: frmPartSelect.class:346
#: frmPartSelect.class:347
msgid "Drives"
msgstr ""

#: frmPartSelect.class:354
#: frmPartSelect.class:355
msgid "Click on select install drive"
msgstr ""

#: frmPartSelect.class:360
#: frmPartSelect.class:361
msgid "Right-click in Mount or FileSystem to set"
msgstr ""

#: frmPartSelect.class:371
#: frmPartSelect.class:372
msgid "OK"
msgstr ""

#: frmPartSelect.class:378
#: frmPartSelect.class:379
msgid "Cancel"
msgstr ""

#: frmPartSelect.class:386
#: frmPartSelect.class:387
msgid "Partitions"
msgstr ""

#: frmPartSelect.class:394
#: frmPartSelect.class:395
msgid "<ul>\n<li>Left-click to (un)select drive(s) to install Vector Linux.</li>\n<li>Right-click on Linux partitions to pick mountpoint</li>\n<li>Left-click on other partitions to edit mountpoint</li>\n</ul>\n"
msgstr ""

14 changes: 14 additions & 0 deletions Functions.module
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,17 @@ CATCH ' Failed, usually due to already existing dirs:

END

PUBLIC FUNCTION CalcSwap(sysmem AS Integer) AS Integer
'Calculate the theoretical swap partition size based on system memory, in megabytes

IF sysmem < 128 THEN
RETURN sysmem * 2.5
ELSE IF sysmem < 256 AND sysmem > 128 THEN
RETURN sysmem * 2
ELSE
RETURN 512 'Don't return swap partition sizes above 512MB
ENDIF

END


6 changes: 5 additions & 1 deletion Global.class
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,15 @@ STATIC PUBLIC enumLILOMODE AS Long 'Boot manager installation.
' 2 = Floppy diskette
' 3 = Do not install

'System memory declarations:
STATIC PUBLIC SysMemory AS Integer
STATIC PUBLIC SwapMemory AS Integer

' Drive and partition declarations:
STATIC PUBLIC DiskInfo AS NEW Object[]
STATIC PUBLIC PartInfo AS NEW Object[]
STATIC PUBLIC PARTinst AS NEW Object[]
STATIC PUBLIC PARTswap AS String
STATIC PUBLIC PARTroot AS String
STATIC PUBLIC PARThome AS String
STATIC PUBLIC PARTvar AS String
Expand All @@ -61,4 +66,3 @@ STATIC PUBLIC tproc AS Process
'temp stuff 2 check out:
STATIC PUBLIC installDrive AS String


14 changes: 14 additions & 0 deletions Utils.module
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,20 @@ ENDIF

END

PUBLIC SUB GetSysMemory()
'Find system memory by reading the first line of /proc/meminfo
DIM hMemInfo AS File
DIM sLine AS String

OPEN "/proc/meminfo" FOR READ AS #hMemInfo
LINE INPUT #hMemInfo, sLine
CLOSE hMemInfo

sLine = Trim$(Mid$(Left$(sLine, RInStr(sLine, " ")), InStr(sLine, " "))) 'Isolate the memory size string
Global.SysMemory = Val(sLine) / 1024 'Turn the value into megabytes

END


PUBLIC SUB BUTTdisable()
' Disable all frmMain buttons:
Expand Down
3 changes: 3 additions & 0 deletions frmChoice.class
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ 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:
Utils.GetSysMemory
frmGo.TextLabel1.Text = "Memory: " & Global.SysMemory & "\n" & "Swap: " & Functions.CalcSwap(Global.SysMemory)

END

Expand Down
1 change: 1 addition & 0 deletions frmPartSelect.class
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ DIM arrTemp AS NEW String[]
DIM n AS Byte
DIM m AS Byte


'Center form on screen:
ME.Center
ME.Caption = "Partition Selection"
Expand Down

0 comments on commit 3d34fbc

Please sign in to comment.