InstallClass was banished.
Though, I extended the Pomona Class and InstData.
continue
def doAutoPartition(pomona):
- instClass = pomona.id.instClass
diskset = pomona.id.diskset
partitions = pomona.id.partitions
def doInstall(pomona):
pomona.backend.doInstall(pomona)
-# does this need to be per-backend? we'll just leave here until it does :)
-def doBasePackageSelect(pomona):
- pomona.id.instClass.setPackageSelection(pomona)
- pomona.id.instClass.setGroupSelection(pomona)
-
def writeConfiguration(pomona):
log.info("Writing main configuration")
pomona.id.write(pomona)
from flags import flags
-#from backend import doPostSelection, doRepoSetup, doBasePackageSelect
+#from backend import doPostSelection, doRepoSetup
from backend import doPreInstall, doPostInstall, doInstall
from backend import writeConfiguration
("timezone", ),
("accounts", ),
#("reposetup", doRepoSetup, ),
- #("basepkgsel", doBasePackageSelect, ),
#("tasksel", ),
#("group-selection", ),
#("postselection", doPostSelection, ),
+++ /dev/null
-# this is the prototypical class for workstation, server, and kickstart
-# installs
-#
-# The interface to BaseInstallClass is *public* -- ISVs/OEMs can customize the
-# install by creating a new derived type of this class.
-#
-# Copyright 1999-2006 Red Hat, Inc.
-#
-# This software may be freely redistributed under the terms of the GNU
-# library public license.
-#
-# You should have received a copy of the GNU Library Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-
-import os, sys, inutil
-import string
-import language
-import imputil
-
-from instdata import InstallData
-from partitioning import *
-from autopart import getAutopartitionBoot, autoCreatePartitionRequests
-#import pakfireinstall
-
-from pyfire.translate import _, N_
-
-import logging
-log = logging.getLogger("pomona")
-
-from flags import flags
-from constants import *
-
-class BaseInstallClass:
- # default to not being hidden
- hidden = 0
- pixmap = None
- showMinimal = 1
- showLoginChoice = 0
- _description = ""
- _descriptionFields = ()
- regkeydesc = None
- name = "base"
- pkgstext = ""
- # default to showing the upgrade option
- showUpgrade = True
-
- # list of of (txt, grplist) tuples for task selection screen
- tasks = []
-
- # dict of repoid: (baseurl, mirrorurl) tuples for additional repos
- repos = {}
-
- # don't select this class by default
- default = 0
-
- # don't force text mode
- forceTextMode = 0
-
- # allow additional software repositories beyond the base to be configured
- allowExtraRepos = True
-
- # by default, place this under the "install" category; it gets it's
- # own toplevel category otherwise
- parentClass = ( _("Install on System"), "install.png" )
-
- # we can use a different install data class
- installDataClass = InstallData
-
- # install key related bits
- skipkeytext = None
- instkeyname = None
- allowinstkeyskip = True
- instkeydesc = None
- installkey = None
- skipkey = False
-
- def setBootloader(self, id, location=None, forceLBA=0, password=None,
- md5pass=None, appendLine="", driveorder = []):
- if appendLine:
- id.bootloader.args.set(appendLine)
- id.bootloader.setForceLBA(forceLBA)
- if password:
- id.bootloader.setPassword(password, isCrypted = 0)
- if md5pass:
- id.bootloader.setPassword(md5pass)
- if location != None:
- id.bootloader.defaultDevice = location
- else:
- id.bootloader.defaultDevice = -1
-
- # XXX throw out drives specified that don't exist. anything else
- # seems silly
- if driveorder and len(driveorder) > 0:
- new = []
- for drive in driveorder:
- if drive in id.bootloader.drivelist:
- new.append(drive)
- else:
- log.warning("requested drive %s in boot drive order "
- "doesn't exist" %(drive,))
- id.bootloader.drivelist = new
-
- def setIgnoredDisks(self, id, drives):
- diskset = id.diskset
- for drive in drives:
- if not drive in diskset.skippedDisks:
- diskset.skippedDisks.append(drive)
-
- def setClearParts(self, id, clear, drives = None, initAll = False):
- id.partitions.autoClearPartType = clear
- id.partitions.autoClearPartDrives = drives
- if initAll:
- id.partitions.reinitializeDisks = initAll
-
- def setSteps(self, pomona):
- dispatch = pomona.dispatch
- dispatch.setStepList(
- "language",
- "keyboard",
- "welcome",
- "findrootparts",
- "betanag",
- "installtype",
- "partitionobjinit",
- "parttype",
- "autopartitionexecute",
- "partition",
- "partitiondone",
- "bootloadersetup",
- "bootloader",
- "networkdevicecheck",
- "network",
- "timezone",
- "accounts",
- "reposetup",
- "basepkgsel",
- "tasksel",
- "postselection",
- "confirminstall",
- "install",
- "enablefilesystems",
- "migratefilesystems",
- "setuptime",
- "preinstallconfig",
- "installpackages",
- "postinstallconfig",
- "writeconfig",
- "firstboot",
- "instbootloader",
- "dopostaction",
- "postscripts",
- "writexconfig",
- "writeksconfig",
- "writeregkey",
- "methodcomplete",
- "copylogs",
- "setfilecon",
- "complete"
- )
-
- def setZeroMbr(self, id, zeroMbr):
- id.partitions.zeroMbr = zeroMbr
-
- def setKeyboard(self, id, kb):
- id.keyboard.set(kb)
-
- def setTimezoneInfo(self, id, timezone, asUtc = 0, asArc = 0):
- id.timezone.setTimezoneInfo(timezone, asUtc, asArc)
-
- def setLanguageDefault(self, id, default):
- id.instLanguage.setDefault(default)
-
- def setLanguage(self, id, nick):
- id.instLanguage.setRuntimeLanguage(nick)
-
- def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_ALL,
- doClear = 1):
- autorequests = [ ("/", None, 1024, None, 1, 1, 1) ]
-
- bootreq = getAutopartitionBoot()
- if bootreq:
- autorequests.extend(bootreq)
-
- (minswap, maxswap) = inutil.swapSuggestion()
- autorequests.append((None, "swap", minswap, maxswap, 1, 1, 1))
-
- if doClear:
- partitions.autoClearPartType = clear
- partitions.autoClearPartDrives = []
-
- partitions.autoPartitionRequests = autoCreatePartitionRequests(autorequests)
-
- def setInstallData(self, pomona):
- pomona.id.reset(pomona)
- pomona.id.instClass = self
-
- def getMethod(self, methodstr):
- if methodstr.startswith('cdrom://'):
- from image import CdromInstallMethod
- return CdromInstallMethod
- elif methodstr.startswith('ftp://') or methodstr.startswith('http://'):
- from urlinstall import UrlInstallMethod
- return UrlInstallMethod
- ### XXX Currently out of order :)
- #elif methodstr.startswith('hd://'):
- # from harddrive import HardDriveInstallMethod
- # return HardDriveInstallMethod
- else:
- return None
-
- def getBackend(self):
- #return pakfireinstall.PakfireBackend
- return None ### XXX
-
- # Classes should call these on __init__ to set up install data
- #id.setKeyboard()
- #id.setLanguage()
- #id.setLanguageDefault()
- #id.setTimezone()
-
- def __init__(self, expert):
- pass
-
- def postAction(self, pomona):
- pomona.backend.postAction(pomona)
-
-# we need to be able to differentiate between this and custom
-class DefaultInstall(BaseInstallClass):
- def __init__(self, expert):
- BaseInstallClass.__init__(self, expert)
-
-# custom installs are easy :-)
-class InstallClass(BaseInstallClass):
- # name has underscore used for mnemonics, strip if you dont need it
- id = "ipfire"
- name = N_("IPFire")
-
- def setInstallData(self, pomona):
- BaseInstallClass.setInstallData(self, pomona)
- BaseInstallClass.setDefaultPartitioning(self, pomona.id.partitions,
- CLEARPART_TYPE_ALL)
-
- def setSteps(self, pomona):
- dispatch = pomona.dispatch
- BaseInstallClass.setSteps(self, dispatch)
- dispatch.skipStep("partition")
-
- def __init__(self, expert):
- BaseInstallClass.__init__(self, expert)
# #
###############################################################################
-import sys, os, re
-import users
+import os
+import sys
+import re
+import signal
+import warnings
from optparse import OptionParser
-import inutil, isys, dispatch
+
+import isys
+import users
+import inutil
+import dispatch
from flags import flags
from constants import *
-import signal
+
+from tui import InstallInterface
+from pakfireinstall import PakfireBackend
+from instdata import InstallData
+from autopart import getAutopartitionBoot, autoCreatePartitionRequests
# Make sure messages sent through python's warnings module get logged.
def PomonaShowWarning(message, category, filename, lineno, file=sys.stderr):
log.warning("%s" % warnings.formatwarning(message, category, filename, lineno))
-def setupEnvironment():
- if not os.environ.has_key("LANG"):
- os.environ["LANG"] = "en_US.UTF-8"
- os.environ['HOME'] = '/tmp'
- os.environ['LC_NUMERIC'] = 'C'
-
- signal.signal(signal.SIGINT, signal.SIG_DFL)
- signal.signal(signal.SIGSEGV, isys.handleSegv)
-
-def getInstClass():
- from installclass import DefaultInstall
- return DefaultInstall(flags.expert)
+warnings.showwarning = PomonaShowWarning
def parseOptions():
else:
logger.addSysLogHandler(log, opts.syslog)
-def expandFTPMethod(opts):
- filename = opts.method[1:]
- opts.method = open(filename, "r").readline()
- opts.method = opts.method[:len(opts.method) - 1]
- os.unlink(filename)
-
def checkMemory():
if inutil.memInstalled() < isys.MIN_RAM:
from snack import SnackScreen, ButtonChoiceWindow
self.intf = None
self.id = None
self.rootPath = HARDDISK_PATH
- self.backend = None
-
- def setDispatch(self):
self.dispatch = dispatch.Dispatcher(self)
- def setBackend(self):
- from pakfireinstall import PakfireBackend
self.backend = PakfireBackend(self.rootPath)
+ def setDefaultPartitioning(self, partitions, clear = CLEARPART_TYPE_ALL, doClear = 1):
+ autorequests = [ ("/", None, 1024, None, 1, 1, 1) ]
+
+ bootreq = getAutopartitionBoot()
+ if bootreq:
+ autorequests.extend(bootreq)
+
+ (minswap, maxswap) = inutil.swapSuggestion()
+ autorequests.append((None, "swap", minswap, maxswap, 1, 1, 1))
+
+ if doClear:
+ partitions.autoClearPartType = clear
+ partitions.autoClearPartDrives = []
+
+ partitions.autoPartitionRequests = autoCreatePartitionRequests(autorequests)
+
+ def setZeroMbr(self, zeroMbr):
+ self.id.partitions.zeroMbr = zeroMbr
+
+ def setKeyboard(self, kb):
+ self.id.keyboard.set(kb)
+
+ def setTimezoneInfo(self, timezone, asUtc = 0, asArc = 0):
+ self.id.timezone.setTimezoneInfo(timezone, asUtc, asArc)
+
+ def setLanguageDefault(self, default):
+ self.id.instLanguage.setDefault(default)
+
+ def setLanguage(self, nick):
+ self.id.instLanguage.setRuntimeLanguage(nick)
+
if __name__ == "__main__":
pomona = Pomona()
- ### Set up logging
- #
+ # Set up logging
import logging
from pomona_log import logger, logLevelMap
log.info("pomona called with cmdline = %s" %(sys.argv,))
- ### Set up environment
- #
- setupEnvironment()
+ # Set up environment
+ if not os.environ.has_key("LANG"):
+ os.environ["LANG"] = "en_US.UTF-8"
+ os.environ['HOME'] = '/tmp'
+ os.environ['LC_NUMERIC'] = 'C'
- ### Set up i18n
- #
+ signal.signal(signal.SIGINT, signal.SIG_DFL)
+ signal.signal(signal.SIGSEGV, isys.handleSegv)
+
+ # Set up i18n
from pyfire.translate import _, textdomain
textdomain("pomona")
- ### Reading command line options
- #
+ # Reading command line options
(opts, args) = parseOptions()
setupLoggingFromOpts(opts)
log.info (_("Starting text installation..."))
- instClass = getInstClass()
-
checkMemory()
- from tui import InstallInterface
pomona.intf = InstallInterface()
- import warnings, signal
- warnings.showwarning = PomonaShowWarning
+ pomona.id = InstallData(pomona)
+ pomona.id.reset(pomona)
+ pomona.setDefaultPartitioning(pomona.id.partitions, CLEARPART_TYPE_ALL)
+
+ if flags.expert:
+ pomona.dispatch.setStepList(
+ "language",
+ "keyboard",
+ "welcome",
+ "betanag",
+ "installtype",
+ "partitionobjinit",
+ "parttype",
+ "autopartitionexecute",
+ "partition",
+ "partitiondone",
+ "bootloadersetup",
+ "bootloader",
+ "networkdevicecheck",
+ "network",
+ "timezone",
+ "accounts",
+ "reposetup",
+ "basepkgsel",
+ "tasksel",
+ "postselection",
+ "confirminstall",
+ "install",
+ "enablefilesystems",
+ "migratefilesystems",
+ "setuptime",
+ "preinstallconfig",
+ "installpackages",
+ "postinstallconfig",
+ "writeconfig",
+ "firstboot",
+ "instbootloader",
+ "dopostaction",
+ "postscripts",
+ "writexconfig",
+ "writeksconfig",
+ "writeregkey",
+ "methodcomplete",
+ "copylogs",
+ "setfilecon",
+ "complete"
+ )
+ else:
+ pomona.dispatch.setStepList(
+ "language",
+ "keyboard",
+ "welcome",
+ "betanag",
+ "installtype",
+ "partitionobjinit",
+ "parttype",
+ "autopartitionexecute",
+ "partition",
+ "partitiondone",
+ "bootloadersetup",
+ "bootloader",
+ "networkdevicecheck",
+ "network",
+ "timezone",
+ "accounts",
+ "reposetup",
+ "basepkgsel",
+ "tasksel",
+ "postselection",
+ "confirminstall",
+ "install",
+ "enablefilesystems",
+ "migratefilesystems",
+ "setuptime",
+ "preinstallconfig",
+ "installpackages",
+ "postinstallconfig",
+ "writeconfig",
+ "firstboot",
+ "instbootloader",
+ "dopostaction",
+ "postscripts",
+ "writexconfig",
+ "writeksconfig",
+ "writeregkey",
+ "methodcomplete",
+ "copylogs",
+ "setfilecon",
+ "complete"
+ )
- # reset python's default SIGINT handler
- signal.signal(signal.SIGINT, signal.SIG_DFL)
-
- pomona.setBackend()
-
- pomona.id = instClass.installDataClass(pomona)
- instClass.setInstallData(pomona)
users.createLuserConf(pomona.rootPath)
- pomona.setDispatch()
-
- #if opts.lang:
- # anaconda.dispatch.skipStep("language", permanent = 1)
- # instClass.setLanguage(anaconda.id, opts.lang)
- # instClass.setLanguageDefault(anaconda.id, opts.lang)
- # anaconda.id.timezone.setTimezoneInfo(anaconda.id.instLanguage.getDefaultTimeZone())
+ if opts.lang:
+ pomona.dispatch.skipStep("language", permanent = 1)
+ pomona.setLanguage(opts.lang)
+ pomona.setLanguageDefault(opts.lang)
+ pomona.id.timezone.setTimezoneInfo(pomona.id.instLanguage.getDefaultTimeZone())
- #if opts.keymap:
- # anaconda.dispatch.skipStep("keyboard", permanent = 1)
- # instClass.setKeyboard(anaconda.id, opts.keymap)
+ if opts.keymap:
+ pomona.dispatch.skipStep("keyboard", permanent = 1)
+ pomona.setKeyboard(opts.keymap)
from exception import handleException
sys.excepthook = lambda type, value, tb, pomona=pomona: handleException(pomona, (type, value, tb))
# - The install language
# - The keyboard
- self.instClass = None
self.network = network.Network()
self.timezone = timezone.Timezone()
self.timezone.setTimezoneInfo(self.instLanguage.getDefaultTimeZone())
self.beenset = 0
self.info = {}
- # default to us
- self.info["KEYTABLE"] = "us"
- self.info["KEYBOARDTYPE"] = "pc"
+ # default to us and unicode enabled
+ self.info["KEYMAP"] = "us"
+ self.info["UNICODE"] = "yes"
self._mods = keyboard_models.KeyboardModels()
modelDict = property(_get_models)
def set(self, keytable):
- self.info["KEYTABLE"] = keytable
+ self.info["KEYMAP"] = keytable
def get(self):
- return self.info["KEYTABLE"]
+ return self.info["KEYMAP"]
def getKeymapName(self):
kbd = self.modelDict[self.get()]
return name
def __getitem__(self, item):
- table = self.info["KEYTABLE"]
+ table = self.info["KEYMAP"]
if not self.modelDict.has_key(table):
raise KeyError, "No such keyboard type %s" % (table,)
else:
raise KeyError, item
- #def read(self, instPath = "/"):
- # ConfigFile.read(self, instPath + "/etc/sysconfig/keyboard")
- # self.beenset = 1
+ def read(self, instPath = "/"):
+ ConfigFile.read(self, instPath + "/etc/sysconfig/console")
+ self.beenset = 1
def write(self, instPath = "/"):
- ConfigFile.write(self, instPath + "/etc/sysconfig/keyboard")
+ ConfigFile.write(self, instPath + "/etc/sysconfig/console")
def activate(self):
console_kbd = self.get()
self.info['LANG'] = dispLang
if self.localeInfo[dispLang][2] == "none":
- self.info['SYSFONT'] = None
+ self.info['FONT'] = None
else:
- self.info['SYSFONT'] = self.localeInfo[dispLang][2]
-
- # XXX hack - because of exceptional cases on the var - zh_CN.GB2312
- if nick == "zh_CN.GB18030":
- self.info['LANGUAGE'] = "zh_CN.GB18030:zh_CN.GB2312:zh_CN"
+ self.info['FONT'] = self.localeInfo[dispLang][2]
def setRuntimeDefaults(self, nick):
canonNick = self.fixLang(self.canonLangNick(nick))
# Try to determine what the hostname should be for this system
def getDefaultHostname(pomona):
- return pomona.id.network.hostname
+ return pomona.id.network.hostname
# sanity check an IP string.
def sanityCheckIPString(ip_string):
self.isConfigured = 0
self.hostname = sname + ".localdomain"
- # now initialize devices
+ # now initialize devices
self.available()
def getDevice(self, device):
return self.netdevices
def setHostname(self, hn):
- self.hostname = hn
+ self.hostname = hn
def setDNS(self, ns):
dns = ns.split(',')
log = logging.getLogger("pomona")
def doPostAction(pomona):
- pomona.id.instClass.postAction(pomona)
+ pomona.backend.postAction(pomona)
def copyPomonaLogs(pomona):
log.info("Copying pomona logs")