From b5f9f85b6e9ab02674aa20a1c470176f58845e4f Mon Sep 17 00:00:00 2001 From: wiktor w brodlo Date: Thu, 11 Aug 2011 12:57:38 +0000 Subject: Custom kernel --- anaconda | 2 ++ iw/custom_kernel_gui.py | 73 +++++++++++++++++++++++++++++++++++++++++++++++++ iw/kernel_gui.py | 2 ++ ui/custom_kernel.glade | 24 ++++++---------- ui/kernel.glade | 8 +++--- 5 files changed, 89 insertions(+), 20 deletions(-) create mode 100644 iw/custom_kernel_gui.py diff --git a/anaconda b/anaconda index fc87336..e99e25a 100755 --- a/anaconda +++ b/anaconda @@ -472,12 +472,14 @@ class Anaconda(object): self.displayMode = None self.extraModules = [] self.firewall = firewall.Firewall() + self.genkernel = False self.id = None self._instClass = None self._instLanguage = None self._intf = None self.isHeadless = False self.fullScreen = False + self.kernel = None self.keyboard = keyboard.Keyboard() self.ksdata = None self.makeconf_march = None diff --git a/iw/custom_kernel_gui.py b/iw/custom_kernel_gui.py new file mode 100644 index 0000000..9e9c46b --- /dev/null +++ b/iw/custom_kernel_gui.py @@ -0,0 +1,73 @@ +# +# custom_kernel_gui.py: gui kernel configuration. +# +# Copyright (C) 2011 wiktor w brodlo +# Copyright (C) 2011 Gentoo Foundation +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# + +import string +import gtk +import gtk.glade +import gtk.gdk +import gobject +import pango +import sys +import gui +import re +import subprocess + +from iw_gui import * + +from constants import * +import gettext +_ = lambda x: gettext.ldgettext("anaconda", x) + +class KernelWindow(InstallWindow): + def getNext(self): + box = self.xml.get_widget("kernel_viewport") + terminal = VirtualTerminal() + box.add(terminal) + + out = subprocess.check_output(["emerge", "-p", "gentoo-sources"]) + kernel_line = out.split("\n")[4].split() + for x in kernel_line: + m = re.search("sys-kernel/gentoo-sources-.*", kernel_line) + if m != None: + kernel = m.group(0) + + version = kernel.partition("gentoo-sources-")[2] + (version_kernel, version_r, version_rn) = version.partition("-r") + version_r = version_r+version_rn + + # Ensure the same version is emerged. + terminal.run_command("emerge =gentoo-sources-"+version) + terminal.run_command("cd /usr/src/linux-"+version_kernel+"-gentoo"+version_r) + terminal.run_command("make nconfig") + self.anaconda.kernel = version_kernel+"-gentoo"+version_r + return None + + def getScreen(self, anaconda): + self.anaconda = anaconda + self.intf = anaconda.intf + + # Skip if we're doing a genkernel + if self.anaconda.genkernel: + return None + + (self.xml, self.align) = gui.getGladeWidget("custom_kernel.glade", "custom_kernel_align") + + return self.align + diff --git a/iw/kernel_gui.py b/iw/kernel_gui.py index e09bc3b..ba4e934 100644 --- a/iw/kernel_gui.py +++ b/iw/kernel_gui.py @@ -35,6 +35,8 @@ _ = lambda x: gettext.ldgettext("anaconda", x) class KernelWindow(InstallWindow): def getNext(self): + if self.xml.get_widget("genkernel").get_property("active"): + self.anaconda.genkernel = True return None def getScreen(self, anaconda): diff --git a/ui/custom_kernel.glade b/ui/custom_kernel.glade index ac316ae..ce61418 100644 --- a/ui/custom_kernel.glade +++ b/ui/custom_kernel.glade @@ -2,18 +2,18 @@ - + False 18 - + 400 True False 0 0 - + True False 5 @@ -25,7 +25,7 @@ 0 0 You have selected a custom kernel. Use the menu below (nconfig) to create your configuration. -The basic settings have been selected for you, but no drivers are enabled. +Press "Next" to download the kernel and configure it. This may take a while, as the kernel image is fairly large (roughly 75 MB). center @@ -35,20 +35,12 @@ The basic settings have been selected for you, but no drivers are enabled. - + True - True - automatic - automatic + False + queue - - True - False - queue - - - - + diff --git a/ui/kernel.glade b/ui/kernel.glade index 01b4ebd..24eb9d4 100644 --- a/ui/kernel.glade +++ b/ui/kernel.glade @@ -2,18 +2,18 @@ - + False 18 - + 400 True False 0 0 - + True False 5 @@ -48,7 +48,7 @@ However, a custom kernel can be smaller, faster and tailored to your system.False queue - + True False True -- cgit v1.2.3-65-gdbad