diff options
author | Andrew Gaffney <agaffney@gentoo.org> | 2007-03-18 21:03:19 +0000 |
---|---|---|
committer | Andrew Gaffney <agaffney@gentoo.org> | 2007-03-18 21:03:19 +0000 |
commit | 8aeb1bba00025ddb73eb8956e4b1aa9258f2f27f (patch) | |
tree | 98aa54e553939f28e1eac357bf3e351f2480beb3 | |
parent | add ability to specify runlevel with service (diff) | |
download | gli-8aeb1bba00025ddb73eb8956e4b1aa9258f2f27f.tar.gz gli-8aeb1bba00025ddb73eb8956e4b1aa9258f2f27f.tar.bz2 gli-8aeb1bba00025ddb73eb8956e4b1aa9258f2f27f.zip |
fix up StartupServices to only display services that currently exist on the system
git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/gli/branches/overhaul@1809 f8877401-5920-0410-a79b-8e2d7e04ca0d
-rw-r--r-- | src/fe/gtk/StartupServices.py | 83 |
1 files changed, 45 insertions, 38 deletions
diff --git a/src/fe/gtk/StartupServices.py b/src/fe/gtk/StartupServices.py index 1938622..cbd2c18 100644 --- a/src/fe/gtk/StartupServices.py +++ b/src/fe/gtk/StartupServices.py @@ -5,6 +5,7 @@ import gtk import gobject +import os from GLIScreen import * from gettext import gettext as _ @@ -14,10 +15,11 @@ class Panel(GLIScreen): _helptext = """ <b><u>Startup Services</u></b> -If you installed gnome, kde, or another graphical desktop, be sure to select \ -xdm if you want to startup into your graphical environment. - -sshd is also a recommended service already installed in the base system. +On this screen, you can select services that you would like to startup at boot. \ +Common choices are sshd (remote access) and xdm (graphical login...choose this \ +for kdm, gdm, and entrance, as well). Only services that are provided by a \ +package you already have installed and are not already in a runlevel are \ +displayed. """ def __init__(self, controller): @@ -25,27 +27,32 @@ sshd is also a recommended service already installed in the base system. vert = gtk.VBox(False, 0) vert.set_border_width(10) - self.services = None - self.choice_list = [("alsasound", _(u"Loads ALSA modules and restores mixer levels")), - ("apache", _(u"Common web server (version 1.x)")), - ("apache2", _(u"Common web server (version 2.x)")), - ("distccd", _(u"Allows your system to help other systems compile")), - ("hdparm", _(u"Makes it easy to set drive parameters automatically at boot")), - ("portmap", _(u"Necessary for mounting NFS shares")), - ("proftpd", _(u"Common FTP server")), - ("sshd", _(u"OpenSSH server (allows remote logins)")), - ("xfs", _(u"X Font Server (available if xorg-x11 compiled with USE=font-server)")), - ("xdm", _(u"Gives you a graphical login which then starts X"))] - - content = """ -On this screen, you can select services that you would like to startup at boot. -Common choices are sshd (remote access) and xdm (graphical login...choose this -for kdm, gdm, and entrance, as well). Adding a service here does not -automatically emerge the corresponding package. You will need to add it on the -Extra Packages screen yourself. -""" - content_label = gtk.Label(content) - vert.pack_start(content_label, expand=False, fill=False, padding=0) +# self.cur_runlevel = "default" +# self.runlevels = {} + self.existing_services = [] + for runlevel in os.listdir(self.controller.install_profile.get_root_mount_point() + "/etc/runlevels/"): +# self.runlevels[runlevel] = os.listdir(self.controller.install_profile.get_root_mount_point() + "/etc/runlevels/" + runlevel) + for service in os.listdir(self.controller.install_profile.get_root_mount_point() + "/etc/runlevels/" + runlevel): + self.existing_services.append(service) + self.new_services = [] + for service in os.listdir(self.controller.install_profile.get_root_mount_point() + "/etc/init.d/"): + if service.endswith(".sh"): continue + if not service in self.existing_services: + self.new_services.append(service) + self.new_services.sort() + + self.choice_list = { + "alsasound": _(u"Loads ALSA modules and restores mixer levels"), + "apache": _(u"Common web server (version 1.x)"), + "apache2": _(u"Common web server (version 2.x)"), + "distccd": _(u"Allows your system to help other systems compile"), + "hdparm": _(u"Makes it easy to set drive parameters automatically at boot"), + "portmap": _(u"Necessary for mounting NFS shares"), + "proftpd": _(u"Common FTP server"), + "sshd": _(u"OpenSSH server (allows remote logins)"), + "xfs": _(u"X Font Server (available if xorg-x11 compiled with USE=font-server)"), + "xdm": _(u"Gives you a graphical login which then starts X") + } self.treedata = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_STRING) self.treeview = gtk.TreeView(self.treedata) @@ -66,6 +73,18 @@ Extra Packages screen yourself. self.treewindow.add(self.treeview) vert.pack_start(self.treewindow, expand=False, fill=False, padding=10) + self.services = self.controller.install_profile.get_services() + if self.services: + if isinstance(self.services, str): + self.services = self.services.split(',') + else: + self.services = list(self.services) + else: + self.services = [] + self.treedata.clear() + for service in self.new_services: + self.treedata.append([(service in self.services), service, self.choice_list.get(service, "")]) + self.add_content(vert) def flag_toggled(self, cell, path): @@ -80,21 +99,9 @@ Extra Packages screen yourself. self.services.pop(self.services.index(service)) def activate(self): - self.controller.SHOW_BUTTON_BACK = True + self.controller.SHOW_BUTTON_BACK = False self.controller.SHOW_BUTTON_FORWARD = True - self.services = self.controller.install_profile.get_services() - if self.services: - if isinstance(self.services, str): - self.services = self.services.split(',') - else: - self.services = list(self.services) - else: - self.services = [] - self.treedata.clear() - for choice in self.choice_list: - self.treedata.append([(choice[0] in self.services), choice[0], choice[1]]) - def next(self): self.controller.install_profile.set_services(None, ",".join(self.services), None) progress = ProgressDialog(self.controller, ("set_services", ), self.progress_callback) |