| Viewing file:  firstboot_selinux.py (3.57 KB)      -rwxr-xr-x Select action/file-type:
 
  (+) |  (+) |  (+) | Code (+) | Session (+) |  (+) | SDB (+) |  (+) |  (+) |  (+) |  (+) |  (+) | 
 
## firstboot_selinux.py - SELinux page for firstboot
 #
 # Chris Lumens <clumens@redhat.com>
 #
 # Copyright 2005 Red Hat, Inc.
 #
 # 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, write to the Free Software
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 #
 
 import gtk
 import gtk.glade
 import sys
 import os
 sys.path.append('/usr/share/system-config-securitylevel')
 import selinuxPage
 
 ##
 ## I18N
 ##
 from rhpl.translate import _, N_
 import rhpl.translate as translate
 domain = "system-config-securitylevel"
 translate.textdomain (domain)
 
 ##
 ## Icon for windows
 ##
 
 iconPixbuf = None
 try:
 iconPixbuf = gtk.gdk.pixbuf_new_from_file("/usr/share/system-config-securitylevel/pixmaps/system-config-securitylevel.png")
 except:
 pass
 
 ##
 ## Pull in the Glade file
 ##
 if os.access("system-config-securitylevel.glade", os.F_OK):
 xml = gtk.glade.XML ("system-config-securitylevel.glade", domain=domain)
 else:
 xml = gtk.glade.XML ("/usr/share/system-config-securitylevel/system-config-securitylevel.glade", domain=domain)
 
 class childWindow:
 runPriority = 51
 moduleName = _("SELinux")
 needsReboot = False
 shortMessage = _("Security Enhanced Linux (SELinux) provides finer-grained "
 "security controls than those available in a traditional "
 "Linux system.  It can be set up in a disabled state, a "
 "state which only warns about things which would be "
 "denied, or a fully active state.  Most people should "
 "keep the default setting.")
 
 def __init__(self):
 self.xml = xml
 self.doDebug = None
 
 def setupScreen(self):
 self.seLinuxVBox = self.xml.get_widget("seLinuxVBox")
 
 def apply(self, *args):
 if self.selinuxPage.apply() == 1:
 dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_INFO,
 gtk.BUTTONS_YES_NO,
 _("Changing this SELinux setting requires rebooting the system so the entire file system may be relabeled.  Relabeling takes a long time depending on the file system.  Would you like to continue with this setting and reboot the system after firstboot is complete?"))
 dlg.set_position(gtk.WIN_POS_CENTER)
 dlg.show_all()
 rc = dlg.run()
 dlg.destroy()
 
 if rc == gtk.RESPONSE_NO:
 self.needsReboot = False
 return None
 else:
 self.needsReboot = True
 else:
 self.needsReboot = False
 
 return 0
 
 def launch(self, doDebug = None):
 self.doDeug = doDebug
 self.setupScreen()
 self.selinuxPage = selinuxPage.selinuxPage(xml, doDebug, True)
 
 messageLabel = gtk.Label(_(self.shortMessage))
 messageLabel.set_line_wrap(True)
 messageLabel.set_size_request(500, -1)
 messageLabel.set_alignment(0.0, 0.5)
 
 vbox = gtk.VBox(spacing=10)
 vbox.pack_start(messageLabel, expand=False)
 self.seLinuxVBox.reparent(vbox)
 
 icon = gtk.Image()
 icon.set_from_pixbuf(iconPixbuf)
 return vbox, icon, self.moduleName
 
 |