From: <cod...@go...> - 2008-08-21 21:02:21
|
Author: M0E.lnx Date: Thu Aug 21 14:01:36 2008 New Revision: 134 Modified: branches/iVL/FrmInstallSys.class branches/iVL/FrmLilo.class branches/iVL/MdlConfLilo.module branches/iVL/MdlDiskPart.module branches/iVL/MdlInstallSys.module branches/iVL/MdlPartSel.module Log: - Added small snipplet to handle installing on a system with both, SATA a IDE drives - Added option to mount linux partitions to /mnt/xdx - Added code to handle more than one swap partition. All swap space will be enabled during the Install, and all will be listed in /etc/fstab. Modified: branches/iVL/FrmInstallSys.class ============================================================================== --- branches/iVL/FrmInstallSys.class (original) +++ branches/iVL/FrmInstallSys.class Thu Aug 21 14:01:36 2008 @@ -26,12 +26,12 @@ FMain.tvPlan["Inst2"].Picture = MdlCore.sNowPic FMain.tvPlan["Inst2"].Selected = TRUE - + MdlInstallSys.ACTIVATE_SWAP_SPACE() ' activate swap for the current install - 'MdlPartFrmt.PREPARE_ALL_PARTITIONS() ' formats partitions and mounts them + MdlPartFrmt.PREPARE_ALL_PARTITIONS() ' formats partitions and mounts them END @@ -49,7 +49,7 @@ 'STOP EVENT -'ME.BEGIN_PROCESS() ' COMMENTED FOR TESTING PURPOSES +ME.BEGIN_PROCESS() ' COMMENTED FOR TESTING PURPOSES Modified: branches/iVL/FrmLilo.class ============================================================================== --- branches/iVL/FrmLilo.class (original) +++ branches/iVL/FrmLilo.class Thu Aug 21 14:01:36 2008 @@ -21,7 +21,7 @@ PUBLIC SUB Form_Open() -ClsPartSel.sRoot = "/dev/sdb1" ' +'ClsPartSel.sRoot = "/dev/sdb1" ' FMain.FrmCurr = ME FMain.tvPlan["Conf0"].Selected = TRUE FMain.tvPlan["Conf0"].Picture = MdlCore.sNowPic Modified: branches/iVL/MdlConfLilo.module ============================================================================== --- branches/iVL/MdlConfLilo.module (original) +++ branches/iVL/MdlConfLilo.module Thu Aug 21 14:01:36 2008 @@ -73,7 +73,7 @@ END IF ' THE FOLLOWING LINE IS FOR TESTING ONLY - ClsGlobal.sTargetMnt = "/tmp" + 'ClsGlobal.sTargetMnt = "/tmp" File.Save(ClsGlobal.sTargetMnt &/ "etc" &/ "lilo.conf", sOut) IF ERROR THEN Message.Error(Error.Text & gb.NewLine & Error.Where) Modified: branches/iVL/MdlDiskPart.module ============================================================================== --- branches/iVL/MdlDiskPart.module (original) +++ branches/iVL/MdlDiskPart.module Thu Aug 21 14:01:36 2008 @@ -28,6 +28,7 @@ DIM sWins AS String = "gpartedbin,Gpartedbin" '" GParted, / dev / sda - GParted, / dev / hda - GParted "" DIM sWons AS String[] = Split(sWins, ",") DIM sType AS String + 'DIM sTypeArr AS String[] 'Desktop.Find("", "GParted") ' The window can be found on the Desktop WM_CLASS property which can be seen via the xprop application @@ -39,7 +40,13 @@ SHELL "probedisk | grep -v \'cdrom\' | cut -f 1 -d \'|\' | grep \'a\'" TO sType stype = Trim(sType) 'Message(sType) - + IF stype = "" THEN + Message.Error("VectorLinux is unable to determine the type of hard disks on your system. <br>" & + "It is still possible to install VectorLinux on your system, but you need to pre-partition your disks first") + ELSE IF InStr(sType, "\n") > 0 THEN + ' more than one type of disk was found... by default, gparted will load using /dev/hda first + sType = "/dev/hda" + END IF IF Exist("/usr/sbin/gparted") = FALSE THEN Message.Error("Gparted was not found on this system. Please install gparted and try again") Modified: branches/iVL/MdlInstallSys.module ============================================================================== --- branches/iVL/MdlInstallSys.module (original) +++ branches/iVL/MdlInstallSys.module Thu Aug 21 14:01:36 2008 @@ -95,6 +95,7 @@ DIM sWinMntPnt AS String DIM sFstab AS String DIM sPartFmt AS String + DIM cb AS ComboBox 'FOR testing purposes @@ -222,13 +223,21 @@ "#/dev/sda1 /mnt/pendrive vfat fmask=111,dmask=0,noauto,user,quiet,shortname=mixed 0 0\n\n" & "# Swap partitions\n" & "# The 'sw' option means auto activating with 'swapon -a'.\n" -IF ClsPartSel.sSwap THEN - ' take a second here to throw the swap line to the current running system - SHELL "echo \'" & ClsPartSel.sSwap & Space(5) & "none" & Space(5) & "swap" & Space(5) & "sw" & Space(5) & "0" & Space(5) & "0" & "\' >> /etc/fstab" WAIT - 'write the same line to the future fstab - sFstab = sFstab & gb.NewLine & - ClsPartSel.sSwap & Space(5) & "none" & Space(5) & "swap" & Space(5) & "sw" & Space(5) & "0" & Space(5) & "0" -END IF + ' This will add all the swap partitions to fstab + FOR EACH cb IN MdlPartSel.oSwaps + sFstab = sFstab & gb.NewLine & + cb.Tag & Space(1) & "none" & Space(1) & "swap" & Space(1) & "sw" * Space(1) & "0" & Space(1) & "0" & gb.NewLine + NEXT + + + +' ' ' IF ClsPartSel.sSwap THEN +' ' ' ' take a second here to throw the swap line to the current running system +' ' ' SHELL "echo \'" & ClsPartSel.sSwap & Space(5) & "none" & Space(5) & "swap" & Space(5) & "sw" & Space(5) & "0" & Space(5) & "0" & "\' >> /etc/fstab" WAIT +' ' ' 'write the same line to the future fstab +' ' ' sFstab = sFstab & gb.NewLine & +' ' ' ClsPartSel.sSwap & Space(5) & "none" & Space(5) & "swap" & Space(5) & "sw" & Space(5) & "0" & Space(5) & "0" +' ' ' END IF sFstab = sFstab & "\n" ' Wheewww!... that's the whole fstab there... Please fix the win partitions @@ -263,6 +272,19 @@ RETURN sMntOpts END +PUBLIC SUB ACTIVATE_SWAP_SPACE() + + DIM cb AS ComboBox + + FOR EACH cb IN MdlPartSel.oSwaps + SHELL "echo \'" & cb.Tag & " none swap sw 0 0 \' >> /etc/fstab" WAIT + NEXT + SHELL "swapon -a" WAIT + +END + + + PUBLIC SUB PERFORM_FULL_INSTALL() @@ -727,36 +749,7 @@ SHELL "cat " & ClsGlobal.sSourceMnt &/ "veclinux" &/ "SETUP.CONF" & " | grep ^CONF" TO sRawList 'Message.Info(sRawList) PRINT sRawList & " config" -' IF InStr(sRawList, "\n") THEN -' PRINT "Multiple config files found ... starting at the top of the list" -' -' sList = Split(sRawList, "\n") -' FOR i = 0 TO sList.count - 1 -' sCOnfLine = Trim(sList[i]) -' IF Left(sCOnfLine, Len("CONF")) = "CONF" THEN -' sPkg = Right(sCOnfLine, Len(sCOnfLine) - InStr(sCOnfLine, "\'")) -' 'PRINT sPkg -' sLinarr = Split(sPkg, ":") -' sPkgPath = sLinarr[0] -' -' 'PRINT sPkgPath -' ' now install the packages -' INC iPkgNum -' ' This may need to be installed as a bulk rather than a package -' 'hproc = SHELL "install-pkg " & ClsGlobal.sSourceMnt &/ "veclinux" &/ sPkgPath & Space(1) & ClsGlobal.sTargetMnt & " || echo \'FAILED\'" FOR READ -' ME.BULK_INSTALL(ClsGlobal.sSourceMnt &/ "veclinux" &/ sPkgPath) -' FrmInstallSys.pbInstallProg2.Value = MdlSetup.UPDATE_OVERALL_PROGRESS(iPkgCnt, iPkgNum) -' WAIT 1 -' IF hproc.State = Process.Running THEN -' REPEAT -' WAIT 2 -' UNTIL -' hproc.State = Process.Stopped -' ' INC iPkgNum -' END IF -' END IF -' NEXT -' ELSE ' only one line found + PRINT "Found a single CONF package... Installing it now" sRawList = Trim(sRawList) sLinarr = Split(sRawList, ":") Modified: branches/iVL/MdlPartSel.module ============================================================================== --- branches/iVL/MdlPartSel.module (original) +++ branches/iVL/MdlPartSel.module Thu Aug 21 14:01:36 2008 @@ -18,6 +18,7 @@ PUBLIC oMountPoints AS Object[] PUBLIC oFsTypes AS Object[] +PUBLIC oSwaps AS Object[] PUBLIC SUB DISPLAY_PARTITION_OPTIONS() @@ -37,10 +38,12 @@ DIM iX AS Integer DIM iWidth AS Integer DIM iCol1, icol2, iCol3 AS Integer + DIM sSwaps AS String[] + DIM ii AS Integer ' fire up the arrays oFsTypes = NEW Object[] oMountPoints = NEW Object[] - + oSwaps = NEW Object[] ' We will mount the partitions first, and then figure out their size SHELL " probepart | grep -e \" Linux$\" | cut -f 1 -d \' \' | grep /dev" TO sDump1 @@ -135,6 +138,7 @@ .Add("/usr") .Add("/var") .Add("/tmp") + .Add("/mnt" &/ Right(.tag, Len(.tag) - RInStr(.tag, "/"))) ' Add option to mount linux partitions to /mnt/xdx .Add("Swap") IF InStr(FrmSelISO.lstInstallableImg.Text, .tag) THEN .Enabled = FALSE @@ -196,55 +200,40 @@ sSwapList = Trim(sSwapList) IF sSwapList <> "" THEN - 'Message.Info(sSwapList) - IF InStr(sSwapList, gb.NewLine) THEN + +' ' ' Message.Info(sSwapList) + 'IF InStr(sSwapList, gb.NewLine) THEN 'several swap partitions found 'how do we deal w/ this? - ELSE - spart = Trim(sSwapList) - 'SHELL "export " & sSwapList & "=$(df -h | grep -i swap) | cut -f 2 -d \' \'" TO vSwapSize - SHELL " export sw=$(probepart | grep -i \" *swap$\") && echo $sw | cut -f 4 -d \' \'" TO vSwapSize - 'Message(CStr(vSwapSize)) - IF vSwapSize <> "" THEN - 'vSwapSize = Trim(CStr(vSwapSize)) - 'Message.Info(vSwapSize) - iswapsize = CInt(vSwapSize) - - iswapsize = Round(iswapsize / 1024 / 1024, -2) - END IF - 'now create the swap label and combo box - tl = NEW TextLabel(FrmPartSel.scrollPartitions) AS "swlabel" - WITH tl - '.x = .Parent.x - .x = icol1 'FrmPartSel.tlPartRow.Left - .y = y - .Text = sPart & " ( " & CStr(iswapsize) & "G )" - .Width = lbwidth - .Height = 27 - .tag = "SwapLbl" - .Alignment = Align.Normal - ClsPartSel.sSwap = sPart - - END WITH - - ' now create a combobox with the swap-only option - cb = NEW ComboBox(FrmPartSel.scrollPartitions) AS "swapsel" - WITH cb - .y = y - '.x = lbwidth + 24 - .x = icol2 'FrmPartSel.tlPartRow2.Left - .Width = tl.Width - .tag = "swapSelection" - .ReadOnly = TRUE - .Add("Swap") - - END WITH + sSwaps = Split(sSwapList, "\n") + FOR ii = 0 TO sSwaps.count - 1 + sPart = Trim(sSwaps[ii]) + 'SHELL "export sw=$(parted " & Left(sSwaps[i], Len(sSwaps[i]) - 1) & " print | grep ^\' " & Right(sSwaps[i]) & "); echo $sw | cut -f 4 -d \' \'" TO vSwapSize + SHELL "export sw=$(parted " & Left(sPart, Len(sPart) - 1) & " print | grep ^\' " & Right(sPart) & "\'); echo $sw | cut -f 4 -d \' \'" TO vSwapSize + tl = NEW TextLabel(FrmPartSel.scrollPartitions) AS "swlabel" + WITH tl + .x = icol1 + .y = y + .text = sPart & " ( " & CStr(vSwapSize) & " )" + .Width = lbwidth + .Height = 27 + .Alignment = Align.Normal + .tag = sSwaps[ii] + END WITH - - - 'Message.Info("Swap total = " & iswapsize) + cb = NEW ComboBox(FrmPartSel.scrollPartitions) AS "swapsel" + WITH cb + .y = y + .x = icol2 + .width = tl.Width + .ReadOnly = TRUE + .Add("Swap") + .tag = sPart + END WITH + ME.oSwaps.Add(cb) + NEXT END IF -END IF + FOR EACH cb IN MdlPartSel.oMountPoints IF cb.width > iWidth THEN iWidth = cb.Width @@ -262,6 +251,18 @@ END + +PUBLIC SUB swapsel_click() + + DIM cb AS ComboBox + ' we need to set at least one swap partition + FOR EACH cb IN ME.oSwaps + ClsPartSel.sSwap = cb.Tag + NEXT + + +END + PUBLIC SUB MountPoints_CLick() @@ -306,6 +307,7 @@ sdropdwn.Add("Swap") sdropdwn.Text = "Swap" sdropdwn.Enabled = FALSE + ELSE IF sdropdwn.Text <> "Do not format" AND sdropdwn.Enabled = TRUE THEN sdropdwn.Enabled = TRUE |