from installclass import BaseInstallClass import rhpl from rhpl.translate import N_,_ from constants import * from flags import flags import os import iutil import types import rpmUtils.arch import logging from kickstart import AnacondaKSScript log = logging.getLogger("anaconda") class InstallClass(BaseInstallClass): hidden = 0 pixmap = "cern-workstation.png" showMinimal = 1 showLoginChoice = 1 name = N_("CERN Recommended Setup") id = "slc" _description = N_("The default installation of %s includes a set of " "software applicable for desktop usage." "It also provides customized system setup for " "use in CERN computing environment. " "This is the CERN SUPPORTED setup option." "\nWhat additional tasks would you like your system " "to include support for?") %(productName,) name = N_("CERN Recommended Setup") pkgstext = "some text about packages ??" showUpgrade = 1 sortPriority = 0.1 allowExtraRepos = True repos = { "Scientific Linux CERN Updates": ("http://linuxsoft.cern.ch/cern/slc5X/%s/updates/RPMS/" %(rpmUtils.arch.getBaseArch() ,), None), "Scientific Linux CERN Extras" : ("http://linuxsoft.cern.ch/cern/slc5X/%s/extras/RPMS/" %(rpmUtils.arch.getBaseArch() ,), None), "Scientific Linux CERN OnlyCERN" : ("http://linuxsoft.cern.ch/onlycern/slc5X/%s/RPMS/" %(rpmUtils.arch.getBaseArch() ,), None), } taskMap = { 'sl' : [(N_("GNOME Desktop"), ["graphics", "office", "games", "sound-and-video","base-x", "gnome-desktop","graphical-internet","printing"],), (N_("KDE Desktop"), ["graphics", "office", "games", "sound-and-video","base-x", "kde-desktop","graphical-internet","printing"],), (N_("Server "), ["server-cfg", "dns-server", "web-server", "ftp-server", "smb-server", "mail-server", "network-server", "legacy-network-server", "news-server"]), (N_("Server - GUI "), ["server-cfg", "dns-server", "web-server", "ftp-server", "smb-server", "mail-server", "network-server", "legacy-network-server", "news-server", "base-x", "gnome-desktop", "admin-tools"]), (N_("Office and Productivity"), ["graphics", "office", "games", "sound-and-video"]), (N_("Software Development"), ["development-libs", "development-tools", "gnome-software-development", "x-software-development"],), (N_("Virtualization"), ["virtualization"]), (N_("Clustering"), ["clustering"]), (N_("Cluster Storage"), ["cluster-storage"],)] } # install key related bits skipkeytext = None instkeyname = None allowinstkeyskip = True instkeydesc = None installkey = None skipkey = True instnum = None def setGroupSelection(self, anaconda): grps = anaconda.backend.getDefaultGroups(anaconda) map(lambda x: anaconda.backend.selectGroup(x), grps) coregrps = ["core", "base", "dialup", "text-internet"] map(lambda x: anaconda.backend.selectGroup(x), coregrps) desktopgrps = ["editors", "graphics", "office", "games", "sound-and-video","base-x","gnome-desktop", "graphical-internet","printing"] map(lambda x: anaconda.backend.selectGroup(x), desktopgrps) # above is default SL selection, below we add groups which were in SLC4 for compat ... othergrps = ["system-tools","engineering-and-scientific", "gnome-software-development","x-software-development", "kde-software-development","development-tools", "kde-desktop","openafs-client","cern-addons", "cern-addons-x11","cern-castor-client", "cern-addon-perl-modules", "legacy-software-development"] # "cern-addon-perl-modules" <- to be implemented map(lambda x: anaconda.backend.selectGroup(x), othergrps) def getPackagePaths(self, uri): rc = {} for (name, path) in self.repopaths.items(): if not type(uri) == types.ListType: uri = [uri,] if not type(path) == types.ListType: path = [path,] lst = [] for i in uri: for p in path: lst.append("%s/%s" % (i, p)) rc[name] = lst log.info("package paths is %s" %(rc,)) return rc def postAction(self, anaconda, serial): if len(self.postScripts) == 0: return log.info("Running CERN post actions") if anaconda.intf is not None: w = anaconda.intf.waitWindow(("Running..."), ("Executing post-install actions")) for script in self.postScripts: script.run(anaconda.rootPath, serial) if anaconda.intf is not None: w.pop() def setInstallData(self, anaconda ): BaseInstallClass.setInstallData(self, anaconda) BaseInstallClass.setDefaultPartitioning(self, anaconda.id.partitions,CLEARPART_TYPE_LINUX) BaseInstallClass.setTimezoneInfo(self, anaconda.id ,"Europe/Zurich",1) BaseInstallClass.setFirewall(self, anaconda.id, enable = 1, trusts = [], ports = ["22:tcp", "7001:udp"]) BaseInstallClass.setAuthentication(self, anaconda.id ,"--useshadow --enablemd5 --enablekrb5 ") self.postScripts = [] postactions = [ ("/bin/ln -sf /usr/share/lcm/profile_standalone_cern.xml /usr/share/lcm/profile_standalone.xml","/bin/sh",1), # temporary: until Jan fixes it ... ("/usr/bin/perl -p -i -e 's/enabled=1/enabled=0/' /etc/yum.repos.d/epel.repo","/bin/sh",1), ("/sbin/chkconfig --del rfiod","/bin/sh",1), ("/bin/rpm -q castor-lib >& /dev/null && F=`/bin/mktemp /tmp/XXXXX` && /bin/rpm -q --qf '%{POSTIN}' castor-lib > $F && /bin/sh -x $F 1 && /bin/rm -f $F","/bin/sh",1) ] for (script, interp, chroot) in postactions: self.postScripts.append(AnacondaKSScript(script, interp, chroot)) def setSteps(self, dispatch): BaseInstallClass.setSteps(self, dispatch); dispatch.skipStep("regkey", skip = 1) def __init__(self, expert): BaseInstallClass.__init__(self, expert) self.repopaths = { "base": "%s" %(productPath,) } self.tasks = self.taskMap[productPath.lower()]