diff options
author | wiktor w brodlo <wiktor@brodlo.net> | 2011-08-11 12:57:38 +0000 |
---|---|---|
committer | wiktor w brodlo <wiktor@brodlo.net> | 2011-08-11 12:57:38 +0000 |
commit | b5f9f85b6e9ab02674aa20a1c470176f58845e4f (patch) | |
tree | 2eacc8e0c32dd55d400ef9e325b7ceb6519ce16e | |
parent | kernel selection (diff) | |
download | anaconda-b5f9f85b6e9ab02674aa20a1c470176f58845e4f.tar.gz anaconda-b5f9f85b6e9ab02674aa20a1c470176f58845e4f.tar.bz2 anaconda-b5f9f85b6e9ab02674aa20a1c470176f58845e4f.zip |
Custom kernel
-rwxr-xr-x | anaconda | 2 | ||||
-rw-r--r-- | iw/custom_kernel_gui.py | 73 | ||||
-rw-r--r-- | iw/kernel_gui.py | 2 | ||||
-rw-r--r-- | ui/custom_kernel.glade | 24 | ||||
-rw-r--r-- | ui/kernel.glade | 8 |
5 files changed, 89 insertions, 20 deletions
@@ -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 <http://www.gnu.org/licenses/>. +# + +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 @@ <glade-interface> <!-- interface-requires gtk+ 2.6 --> <!-- interface-naming-policy toplevel-contextual --> - <widget class="GtkWindow" id="profile_window"> + <widget class="GtkWindow" id="kernel_window"> <property name="can_focus">False</property> <property name="border_width">18</property> <child> - <widget class="GtkAlignment" id="profile_align"> + <widget class="GtkAlignment" id="custom_kernel_align"> <property name="width_request">400</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> <property name="yalign">0</property> <child> - <widget class="GtkVBox" id="profile_box"> + <widget class="GtkVBox" id="kernel_box"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="border_width">5</property> @@ -25,7 +25,7 @@ <property name="xalign">0</property> <property name="yalign">0</property> <property name="label" translatable="yes">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.</property> +Press "Next" to download the kernel and configure it. This may take a while, as the kernel image is fairly large (roughly 75 MB).</property> <property name="justify">center</property> </widget> <packing> @@ -35,20 +35,12 @@ The basic settings have been selected for you, but no drivers are enabled.</prop </packing> </child> <child> - <widget class="GtkScrolledWindow" id="scrolledwindow1"> + <widget class="GtkViewport" id="kernel_viewport"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">automatic</property> - <property name="vscrollbar_policy">automatic</property> + <property name="can_focus">False</property> + <property name="resize_mode">queue</property> <child> - <widget class="GtkViewport" id="kernel_viewport"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="resize_mode">queue</property> - <child> - <placeholder/> - </child> - </widget> + <placeholder/> </child> </widget> <packing> 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 @@ <glade-interface> <!-- interface-requires gtk+ 2.6 --> <!-- interface-naming-policy toplevel-contextual --> - <widget class="GtkWindow" id="profile_window"> + <widget class="GtkWindow" id="kernel_window"> <property name="can_focus">False</property> <property name="border_width">18</property> <child> - <widget class="GtkAlignment" id="profile_align"> + <widget class="GtkAlignment" id="kernel_align"> <property name="width_request">400</property> <property name="visible">True</property> <property name="can_focus">False</property> <property name="xalign">0</property> <property name="yalign">0</property> <child> - <widget class="GtkVBox" id="profile_box"> + <widget class="GtkVBox" id="kerne_box"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="border_width">5</property> @@ -48,7 +48,7 @@ However, a custom kernel can be smaller, faster and tailored to your system.</pr <property name="can_focus">False</property> <property name="resize_mode">queue</property> <child> - <widget class="GtkVBox" id="kernel_box"> + <widget class="GtkVBox" id="pick_kernel_box"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="homogeneous">True</property> |