From: <cod...@go...> - 2007-12-09 02:43:28
|
Author: easuter Date: Sat Dec 8 18:42:49 2007 New Revision: 28 Modified: trunk/.lang/.pot trunk/.lang/frmPartitions.pot trunk/.project trunk/.settings trunk/Functions.module trunk/Main.module trunk/Utils.module trunk/frmChoice.class trunk/frmPartitions.class Log: Changes: - Funtions.module: Fixed bug in getFreePartSpace's dosfsck parser - Main.class: The installer now runs Utils.DrivePartInfo at startup. This keeps hard-drive data loaded in memory and increases the speed a which the frmPartSelect abd frmDriveSelect forms open. Modified: trunk/.lang/.pot ============================================================================== --- trunk/.lang/.pot (original) +++ trunk/.lang/.pot Sat Dec 8 18:42:49 2007 @@ -292,7 +292,7 @@ msgid "Advanced selection" msgstr "" -#: frmPackages.class:147 frmPartitions.class:265 +#: frmPackages.class:147 frmPartitions.class:264 msgid "Manual" msgstr "" @@ -373,7 +373,7 @@ "</ul>\n" msgstr "" -#: frmPartitions.class:216 +#: frmPartitions.class:215 msgid "" "<center><h3><b>Available partitioning modes:</b></h3></center>\n" "\n" @@ -402,39 +402,39 @@ "</ul>\n" msgstr "" -#: frmPartitions.class:228 +#: frmPartitions.class:227 msgid "Partitioning mode" msgstr "" -#: frmPartitions.class:243 +#: frmPartitions.class:242 msgid "Automatic" msgstr "" -#: frmPartitions.class:250 +#: frmPartitions.class:249 msgid "Full disk" msgstr "" -#: frmPartitions.class:258 +#: frmPartitions.class:257 msgid "Unpartitioned space" msgstr "" -#: frmPartitions.class:272 +#: frmPartitions.class:271 msgid "GParted" msgstr "" -#: frmPartitions.class:280 +#: frmPartitions.class:279 msgid "cfdisk" msgstr "" -#: frmPartitions.class:287 +#: frmPartitions.class:286 msgid "Others" msgstr "" -#: frmPartitions.class:294 +#: frmPartitions.class:293 msgid "Preset strategies" msgstr "" -#: frmPartitions.class:302 +#: frmPartitions.class:301 msgid "No partitioning" msgstr "" Modified: trunk/.lang/frmPartitions.pot ============================================================================== --- trunk/.lang/frmPartitions.pot (original) +++ trunk/.lang/frmPartitions.pot Sat Dec 8 18:42:49 2007 @@ -14,47 +14,47 @@ "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: frmPartitions.class:216 +#: frmPartitions.class:215 msgid "<center><h3><b>Available partitioning modes:</b></h3></center>\n\n<b><u>Automatic partitioning:</u></b> The installer will handle all partition related decisions for you:\n<ul>\n<li><b>Full disk:</b> Choose this option if you want to use your entire hard disk for VL. <font color=\"#FF0000\">WARNING: this option will DELETE everything on your hard disk, or offer a choice if there are multiple disks. You have been WARNED.</font></li>\n<li><b>Unpartitioned space:</b> using available free (unpartitioned) disk space.</li>\n</ul>\n<b><u>Manual partitioning:</u></b> You have full control of partitioning.\n<ul>\n<li><b>Using gparted</b> (the advanced graphical partitioner).</li>\n<li><b>Using cfdisk</b> (the traditional partition tool).</li>\n</ul>\n<b><u>Other partitioning:</u></b>\n<ul>\n<li><b>Preset strategies:</b> auto allocates partitions according to most common usage strategy intended for this computer.</li>\n<li><b>No partitioning:</b> If you wish to use existing Linux and swap partitions. <font color=\"#FF0000\">WARNING: The existing Linux partitions will be OVERWRITTEN. You have been WARNED.</font></li>\n</ul>\n" msgstr "" -#: frmPartitions.class:228 +#: frmPartitions.class:227 msgid "Partitioning mode" msgstr "" -#: frmPartitions.class:243 +#: frmPartitions.class:242 msgid "Automatic" msgstr "" -#: frmPartitions.class:250 +#: frmPartitions.class:249 msgid "Full disk" msgstr "" -#: frmPartitions.class:258 +#: frmPartitions.class:257 msgid "Unpartitioned space" msgstr "" -#: frmPartitions.class:265 +#: frmPartitions.class:264 msgid "Manual" msgstr "" -#: frmPartitions.class:272 +#: frmPartitions.class:271 msgid "GParted" msgstr "" -#: frmPartitions.class:280 +#: frmPartitions.class:279 msgid "cfdisk" msgstr "" -#: frmPartitions.class:287 +#: frmPartitions.class:286 msgid "Others" msgstr "" -#: frmPartitions.class:294 +#: frmPartitions.class:293 msgid "Preset strategies" msgstr "" -#: frmPartitions.class:302 +#: frmPartitions.class:301 msgid "No partitioning" msgstr "" Modified: trunk/.project ============================================================================== --- trunk/.project (original) +++ trunk/.project Sat Dec 8 18:42:49 2007 @@ -2,7 +2,7 @@ Title=VL-gui-installer Startup=Main Icon=vl_logo_icon2.png -Version=0.0.254 +Version=0.0.260 Library=gb.qt Library=gb.qt.ext TabSize=3 Modified: trunk/.settings ============================================================================== --- trunk/.settings (original) +++ trunk/.settings Sat Dec 8 18:42:49 2007 @@ -1,9 +1,12 @@ [Breakpoints] Count=0 +[DebugWindow] +Count=0 + [FFind] -SearchIn="Sub" -CaseSensitive=True +SearchIn="Project" +CaseSensitive=False SearchWord=False SearchComment=False SearchString=True Modified: trunk/Functions.module ============================================================================== --- trunk/Functions.module (original) +++ trunk/Functions.module Sat Dec 8 18:42:49 2007 @@ -235,6 +235,7 @@ DIM sUsedBlocks AS String DIM arrTemp AS NEW String[] DIM iFreeBytes AS Long +DIM i AS Integer sDevice = Trim$(sDevice) sFilesystem = Trim$(sFilesystem) @@ -269,13 +270,19 @@ sBlockSize = Trim$(Mid$(arrTemp[2], RInStr(arrTemp[2], Space$(1)))) iFreeBytes = HexToLong(sFreeBlocks) * CLng(sBlockSize) ELSE IF sFilesystem = "FAT12" OR sFilesystem = "FAT16" OR sFilesystem = "FAT32" THEN 'Who even uses FAT12 on today's hard-drives anyway?! - SHELL "dosfsck -v " & sDevice TO sTemp 'The "-a" switch sould also be used to automaticaly repair a FAT partition, but that can take ages...lets see how well it works without it. + SHELL "dosfsck -v " & sDevice TO sTemp 'The "-a" switch should also be used to automaticaly repair a FAT partition, but that can take ages...lets see how well it works without it. sTemp = Trim$(sTemp) arrTemp = Split(sTemp, Chr$(10)) + 'Debug + ' FOR i = 0 TO arrTemp.Length - 1 + ' PRINT arrTemp[i] + ' NEXT 'Reuse sTemp, can't get sFreeBlocks in one go - sTemp = Trim$(Mid$(Left$(arrTemp[20], RInStr(arrTemp[20], "/") - 1), InStr(arrTemp[20], ",") + 1)) - sTemp2 = Trim$(Mid$(Left$(arrTemp[20], RInStr(arrTemp[20], Space$(1))), RInStr(arrTemp[20], "/") + 1)) - sFreeBlocks = Str(CLng(Val(sTemp2) - Val(sTemp))) + sTemp = Trim$(Mid$(Left$(arrTemp[arrTemp.Length - 1], RInStr(arrTemp[arrTemp.Length - 1], "/") - 1), InStr(arrTemp[arrTemp.Length - 1], ",") + 1)) + 'PRINT sTemp + sTemp2 = Trim$(Mid$(Left$(arrTemp[arrTemp.Length - 1], RInStr(arrTemp[arrTemp.Length - 1], Space$(1))), RInStr(arrTemp[arrTemp.Length - 1], "/") + 1)) + 'PRINT sTemp2 + sFreeBlocks = Str(CLng(Val(sTemp2) - CLng(Val(sTemp)))) sBlockSize = Trim$(Left$(Trim$(arrTemp[7]), InStr(Trim$(arrTemp[7]), Space$(1)))) iFreeBytes = CLng(sFreeBlocks) * CLng(sBlockSize) ELSE IF sFilesystem = "NTFS" THEN @@ -284,6 +291,7 @@ arrTemp = Split(sTemp, Chr$(10)) 'It would be a lot easier to use an expression in the output of ntfsresize to identify the number of free bytes, but that is not i18n ready! 'So "chomp" away portions of the string until the first integer is found (this will be the free space value) + 'PRINT arrTemp[10] sTemp = arrTemp[10] WHILE Len(sTemp) > 0 sTemp2 = Trim$(Left$(sTemp, InStr(sTemp, Space$(1)))) @@ -406,79 +414,79 @@ END -PUBLIC SUB BootMngrSet() -' This must determine: -' * Where the root partition is -' * Where the kernel is installed -' * where to install lilo (from global.enumLILOMODE ?? ) -' * Which OS's to display in the boot menu (From user input) -' * To use bootsplash or to use framebuffer -' We'll use message.info to display the values for now, we can move those values somewhere else, or dome something more useful with them later - DIM sRoot_Part AS String - DIM sKernel_Loc AS String - DIM ROOT_DIR AS String = "/" - DIM Boot_DIR AS String = Root_DIR & "boot" - ' Locate the root Partition - IF global.enumLILOMODE = 0 THEN - locate_mbr() - SHELL "cat /etc/fstab | awk '{if ($2 == \"/\") {print $1}}'" TO sRoot_Part - IF NOT sRoot_Part OR sRoot_Part <> "" THEN - SHELL "mount | awk '{if ($3 == \"/\") {print $1}}'" TO sRoot_Part - END IF - 'message.Info("I've identified your root partition as " & gb.newline & sRoot_Part) - Global.RootPart = sRoot_Part ' Store the location of the root partition to the global module - END IF -' Figure out where the kernel is - IF Exist(Boot_DIR & "/vmlinuz") THEN - sKernel_Loc = Boot_DIR & "/vmlinuz" - ELSE IF Exist(ROOT_DIR & "/vmlinuz") THEN - sKernel_Loc = Root_DIR & "/vmlinuz" - ELSE - Message.Info("I can't find a kernel !!! ") - END IF - IF sKernel_Loc OR sKernel_Loc <> "" THEN - 'message.Info("I've located the kernel in " & gb.NewLine & sKernel_Loc) - Global.KernelLoc = sKernel_Loc ' Store the location of the kernel to the global module - END IF - -END - -PUBLIC SUB locate_mbr() - - ' If the user chooses to install bootmanager to MBR - ' This routine will analyze whether there are more than 1 MBR available - ' and which one to use if true, else, use the one available automatically - 'SHELL "/sbin/vliloconf" - -DIM disks AS String ' list of the mbrs as string -DIM MBRs AS String[] ' split the many MBR's -DIM MBR AS String ' Hold a temporary MBR -DIM MBRTotal AS Integer ' Total MBRS -DIM MBRIndex AS Integer ' Current MBR (index) -DIM UseMBR AS String ' MBR to use.... A better place for this is probabbly somewhere in Global -DIM findcmd AS String = "fdisk -l | grep Disk | cut -d \" \" -f 2 | cut -c 1-8" +' PUBLIC SUB BootMngrSet() +' ' This must determine: +' ' * Where the root partition is +' ' * Where the kernel is installed +' ' * where to install lilo (from global.enumLILOMODE ?? ) +' ' * Which OS's to display in the boot menu (From user input) +' ' * To use bootsplash or to use framebuffer +' ' We'll use message.info to display the values for now, we can move those values somewhere else, or dome something more useful with them later +' DIM sRoot_Part AS String +' DIM sKernel_Loc AS String +' DIM ROOT_DIR AS String = "/" +' DIM Boot_DIR AS String = Root_DIR & "boot" +' ' Locate the root Partition +' IF global.enumLILOMODE = 0 THEN +' locate_mbr() +' SHELL "cat /etc/fstab | awk '{if ($2 == \"/\") {print $1}}'" TO sRoot_Part +' IF NOT sRoot_Part OR sRoot_Part <> "" THEN +' SHELL "mount | awk '{if ($3 == \"/\") {print $1}}'" TO sRoot_Part +' END IF +' 'message.Info("I've identified your root partition as " & gb.newline & sRoot_Part) +' Global.RootPart = sRoot_Part ' Store the location of the root partition to the global module +' END IF +' ' Figure out where the kernel is +' IF Exist(Boot_DIR & "/vmlinuz") THEN +' sKernel_Loc = Boot_DIR & "/vmlinuz" +' ELSE IF Exist(ROOT_DIR & "/vmlinuz") THEN +' sKernel_Loc = Root_DIR & "/vmlinuz" +' ELSE +' Message.Info("I can't find a kernel !!! ") +' END IF +' IF sKernel_Loc OR sKernel_Loc <> "" THEN +' 'message.Info("I've located the kernel in " & gb.NewLine & sKernel_Loc) +' Global.KernelLoc = sKernel_Loc ' Store the location of the kernel to the global module +' END IF +' +' END ' -'SHELL "fdisk -l | grep Disk | cut -d " " - f 2 | cut -c 1-8" TO disks -SHELL findcmd TO disks -'message.Info(disks) -MBRs = Split(disks, " ") ' Maybe use a blank space (ie " " ) instead ?? -MbrTotal = MBRs.Count -IF MBRTotal = 0 THEN ' This should never happen. -'message.Info(disks) - message.Error("Cannot find an MBR on this box... You must be on some kind of alien box... ;) ") -'ELSE IF MBRTotal = 1 ' Located only one MBR -' UseMBR = disks ' Obviously, use the one available MBR -' Message.Info("The boot manager will be installed to: " & disks) -'ELSE IF MBRTotal >= 2 THEN ' We found several MBR's here... Your box is loaded with drives out the whazoo! -ELSE -'message.Info(disks) -FOR MBRIndex = 0 TO MBRs.count - 1 - MBR = MBRs[MBRIndex] - frmChooseMBR.MbrList.Add(MBR) ' populate the list in the form - frmChooseMBR.Show ' This form will shoot out a value to Global -NEXT -END IF - -END +' PUBLIC SUB locate_mbr() +' +' ' If the user chooses to install bootmanager to MBR +' ' This routine will analyze whether there are more than 1 MBR available +' ' and which one to use if true, else, use the one available automatically +' 'SHELL "/sbin/vliloconf" +' +' DIM disks AS String ' list of the mbrs as string +' DIM MBRs AS String[] ' split the many MBR's +' DIM MBR AS String ' Hold a temporary MBR +' DIM MBRTotal AS Integer ' Total MBRS +' DIM MBRIndex AS Integer ' Current MBR (index) +' DIM UseMBR AS String ' MBR to use.... A better place for this is probabbly somewhere in Global +' DIM findcmd AS String = "fdisk -l | grep Disk | cut -d \" \" -f 2 | cut -c 1-8" +' ' +' 'SHELL "fdisk -l | grep Disk | cut -d " " - f 2 | cut -c 1-8" TO disks +' SHELL findcmd TO disks +' 'message.Info(disks) +' MBRs = Split(disks, " ") ' Maybe use a blank space (ie " " ) instead ?? +' MbrTotal = MBRs.Count +' IF MBRTotal = 0 THEN ' This should never happen. +' 'message.Info(disks) +' message.Error("Cannot find an MBR on this box... You must be on some kind of alien box... ;) ") +' 'ELSE IF MBRTotal = 1 ' Located only one MBR +' ' UseMBR = disks ' Obviously, use the one available MBR +' ' Message.Info("The boot manager will be installed to: " & disks) +' 'ELSE IF MBRTotal >= 2 THEN ' We found several MBR's here... Your box is loaded with drives out the whazoo! +' ELSE +' 'message.Info(disks) +' FOR MBRIndex = 0 TO MBRs.count - 1 +' MBR = MBRs[MBRIndex] +' frmChooseMBR.MbrList.Add(MBR) ' populate the list in the form +' frmChooseMBR.Show ' This form will shoot out a value to Global +' NEXT +' END IF +' +' END Modified: trunk/Main.module ============================================================================== --- trunk/Main.module (original) +++ trunk/Main.module Sat Dec 8 18:42:49 2007 @@ -25,6 +25,8 @@ ' Load the Main window: frmMain.Load + + ' Make always on top: 'frmMain.TopOnly = TRUE @@ -65,6 +67,9 @@ ' Start off with button 1 on Main window: Global.prevForm = 1 + +'Gather hard-drive data before showing the interface +Utils.DrivePartInfo() ' And get the show on the road....: frmMain.Show Modified: trunk/Utils.module ============================================================================== --- trunk/Utils.module (original) +++ trunk/Utils.module Sat Dec 8 18:42:49 2007 @@ -159,7 +159,7 @@ ENDIF NEXT Global.DiskInfo[iDisk].UnallocatedBytes = Global.DiskInfo[iDisk].Bytes - iDiskUsedBytes - PRINT global.DiskInfo[iDisk].UnallocatedBytes + 'PRINT global.DiskInfo[iDisk].UnallocatedBytes 'for debug NEXT Modified: trunk/frmChoice.class ============================================================================== --- trunk/frmChoice.class (original) +++ trunk/frmChoice.class Sat Dec 8 18:42:49 2007 @@ -29,7 +29,7 @@ Global.enumPACKS = 0 'All packages selected Global.enumLILOMODE = 0 'Install lilo to MBR -Utils.DrivePartInfo + IF Global.DiskInfo.Count >= 1 THEN frmDriveSelect.ShowModal frmMain.btnChoice.Enabled = FALSE ' Disable Choices. Modified: trunk/frmPartitions.class ============================================================================== --- trunk/frmPartitions.class (original) +++ trunk/frmPartitions.class Sat Dec 8 18:42:49 2007 @@ -166,7 +166,6 @@ Global.flagBUTTExec = TRUE ' Mountpoint selection: -Utils.DrivePartInfo frmPartSelect.ShowModal ' Unflag button execution: |