From 1508dd54ba22718c5b8cb7cfdbb74b83b219de0f Mon Sep 17 00:00:00 2001 From: "M0E.lnx" Date: Mon, 13 Aug 2007 15:35:59 +0000 Subject: [PATCH] The Boot manager setup now detects the different drives and can find the kernel, as well as the root partitions. It will show a list of available disks. So far only gathers information but this information will be useful when writing the actual config file for the boot manager --- .lang/.pot | 33 +++++------ .lang/frmTools.pot | 22 ++++---- .project | 2 +- Functions.module | 137 +++++++++++++++++++++++---------------------- frmChooseMBR.form | 7 ++- frmTools.class | 5 +- 6 files changed, 104 insertions(+), 102 deletions(-) diff --git a/.lang/.pot b/.lang/.pot index 0d4e64d..86e0f74 100644 --- a/.lang/.pot +++ b/.lang/.pot @@ -67,19 +67,16 @@ msgstr "" msgid "Advanced" msgstr "" -#: frmChooseMBR.class:45 +#: frmChooseMBR.class:46 msgid "Next >" msgstr "" -#: frmChooseMBR.class:50 +#: frmChooseMBR.class:51 msgid "< Back" msgstr "" -#: frmChooseMBR.class:55 -msgid "" -"You chose to install the boot manager to your MBR, but you have\n" -"multiple disks. Please select the disk you would like to install the " -"bootmanager in to." +#: frmChooseMBR.class:56 +msgid "Please select the drive you want your boot manager installed to:" msgstr "" #: frmConfig.class:116 @@ -384,7 +381,7 @@ msgstr "" msgid "No partitioning" msgstr "" -#: frmTools.class:115 +#: frmTools.class:116 msgid "" "

Vector Linux repair tools:

\n" "\n" @@ -409,43 +406,43 @@ msgid "" "\n" msgstr "" -#: frmTools.class:126 +#: frmTools.class:127 msgid "VL Tools" msgstr "" -#: frmTools.class:141 +#: frmTools.class:142 msgid "Distro repair" msgstr "" -#: frmTools.class:148 +#: frmTools.class:149 msgid "Restore packages" msgstr "" -#: frmTools.class:156 +#: frmTools.class:157 msgid "Repair LILO" msgstr "" -#: frmTools.class:163 +#: frmTools.class:164 msgid "Backup / restore" msgstr "" -#: frmTools.class:170 +#: frmTools.class:171 msgid "Backup /home" msgstr "" -#: frmTools.class:178 +#: frmTools.class:179 msgid "Restore /home" msgstr "" -#: frmTools.class:185 +#: frmTools.class:186 msgid "Miscellaneous" msgstr "" -#: frmTools.class:192 +#: frmTools.class:193 msgid "Tool 5" msgstr "" -#: frmTools.class:200 +#: frmTools.class:201 msgid "(Make FHS tree)" msgstr "" diff --git a/.lang/frmTools.pot b/.lang/frmTools.pot index 2cea9a9..c6a31ba 100644 --- a/.lang/frmTools.pot +++ b/.lang/frmTools.pot @@ -14,47 +14,47 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: frmTools.class:115 +#: frmTools.class:116 msgid "

Vector Linux repair tools:

\n\nDistro repair tools:\n\nBackup / restore tools:\n\nMiscellaneous tools: \n\n" msgstr "" -#: frmTools.class:126 +#: frmTools.class:127 msgid "VL Tools" msgstr "" -#: frmTools.class:141 +#: frmTools.class:142 msgid "Distro repair" msgstr "" -#: frmTools.class:148 +#: frmTools.class:149 msgid "Restore packages" msgstr "" -#: frmTools.class:156 +#: frmTools.class:157 msgid "Repair LILO" msgstr "" -#: frmTools.class:163 +#: frmTools.class:164 msgid "Backup / restore" msgstr "" -#: frmTools.class:170 +#: frmTools.class:171 msgid "Backup /home" msgstr "" -#: frmTools.class:178 +#: frmTools.class:179 msgid "Restore /home" msgstr "" -#: frmTools.class:185 +#: frmTools.class:186 msgid "Miscellaneous" msgstr "" -#: frmTools.class:192 +#: frmTools.class:193 msgid "Tool 5" msgstr "" -#: frmTools.class:200 +#: frmTools.class:201 msgid "(Make FHS tree)" msgstr "" diff --git a/.project b/.project index f2d5bd2..d299806 100644 --- a/.project +++ b/.project @@ -2,7 +2,7 @@ Title=VL-gui-installer Startup=Main Icon=vl_logo_icon2.png -Version=0.0.178 +Version=0.0.193 Library=gb.qt Library=gb.qt.ext TabSize=3 diff --git a/Functions.module b/Functions.module index 76fd091..7ed1f5f 100644 --- a/Functions.module +++ b/Functions.module @@ -324,72 +324,77 @@ ENDIF 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) -' 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) -' 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 -' ' -' ' SHELL "fdisk -l | grep Disk | cut -d " & " " & "-f 2 | cut -c 1-8" TO 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! -' ' 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 +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) + 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) + 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" ' -'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 diff --git a/frmChooseMBR.form b/frmChooseMBR.form index 3f02ae1..fc3c0c5 100644 --- a/frmChooseMBR.form +++ b/frmChooseMBR.form @@ -5,7 +5,8 @@ Font = Font["Luxi Mono"] Text = ("") { MbrList ListBox - MoveScaled(1,14,62,23) + MoveScaled(1,10,62,27) + Font = Font["Luxi Mono"] } { btNext Button MoveScaled(53,38,9,3) @@ -16,7 +17,7 @@ Text = ("< Back") } { lbWarn TextLabel - MoveScaled(1,1,62,12) - Text = ("You chose to install the boot manager to your MBR, but you have\nmultiple disks. Please select the disk you would like to install the bootmanager in to.") + MoveScaled(1,1,62,8) + Text = ("Please select the drive you want your boot manager installed to:") } } diff --git a/frmTools.class b/frmTools.class index 67834a2..244871e 100644 --- a/frmTools.class +++ b/frmTools.class @@ -24,10 +24,9 @@ TextLabel1.Adjust END PUBLIC SUB btnBMRepair_Click() ' Repair LILO: -'frmMain.btnChoice_Click -'frmMain.btnConfigure_click ' Display the Boot Manager selection window +frmMain.btnChoice_Click +frmMain.btnConfigure_click ' Display the Boot Manager selection window ' Save us some time and use the existing code via Xdialog ??? -SHELL "/sbin/vliloconf" ' Might need to just make it appear in the right place