diff options
Diffstat (limited to 'scripts/lib')
| -rw-r--r-- | scripts/lib/mic/kickstart/__init__.py | 6 | ||||
| -rw-r--r-- | scripts/lib/mic/kickstart/custom_commands/__init__.py | 7 | ||||
| -rw-r--r-- | scripts/lib/mic/kickstart/custom_commands/desktop.py | 95 | ||||
| -rw-r--r-- | scripts/lib/mic/kickstart/custom_commands/installerfw.py | 63 | ||||
| -rw-r--r-- | scripts/lib/mic/kickstart/custom_commands/micrepo.py | 127 |
5 files changed, 1 insertions, 297 deletions
diff --git a/scripts/lib/mic/kickstart/__init__.py b/scripts/lib/mic/kickstart/__init__.py index 72f3ca6849..11cdf63279 100644 --- a/scripts/lib/mic/kickstart/__init__.py +++ b/scripts/lib/mic/kickstart/__init__.py | |||
| @@ -32,7 +32,7 @@ from pykickstart.handlers.control import dataMap | |||
| 32 | 32 | ||
| 33 | from mic import msger | 33 | from mic import msger |
| 34 | from mic.utils import errors, misc, runner, fs_related as fs | 34 | from mic.utils import errors, misc, runner, fs_related as fs |
| 35 | from custom_commands import desktop, micrepo, wicboot, partition, installerfw | 35 | from custom_commands import wicboot, partition |
| 36 | 36 | ||
| 37 | 37 | ||
| 38 | AUTH_URL_PTN = r"(?P<scheme>.*)://(?P<username>.*)(:?P<password>.*)?@(?P<url>.*)" | 38 | AUTH_URL_PTN = r"(?P<scheme>.*)://(?P<username>.*)(:?P<password>.*)?@(?P<url>.*)" |
| @@ -96,13 +96,9 @@ def read_kickstart(path): | |||
| 96 | #ks = ksparser.KickstartParser(version) | 96 | #ks = ksparser.KickstartParser(version) |
| 97 | 97 | ||
| 98 | using_version = ksversion.DEVEL | 98 | using_version = ksversion.DEVEL |
| 99 | commandMap[using_version]["desktop"] = desktop.Mic_Desktop | ||
| 100 | commandMap[using_version]["repo"] = micrepo.Mic_Repo | ||
| 101 | commandMap[using_version]["bootloader"] = wicboot.Wic_Bootloader | 99 | commandMap[using_version]["bootloader"] = wicboot.Wic_Bootloader |
| 102 | commandMap[using_version]["part"] = partition.Wic_Partition | 100 | commandMap[using_version]["part"] = partition.Wic_Partition |
| 103 | commandMap[using_version]["partition"] = partition.Wic_Partition | 101 | commandMap[using_version]["partition"] = partition.Wic_Partition |
| 104 | commandMap[using_version]["installerfw"] = installerfw.Mic_installerfw | ||
| 105 | dataMap[using_version]["RepoData"] = micrepo.Mic_RepoData | ||
| 106 | dataMap[using_version]["PartData"] = partition.Wic_PartData | 102 | dataMap[using_version]["PartData"] = partition.Wic_PartData |
| 107 | superclass = ksversion.returnClassForVersion(version=using_version) | 103 | superclass = ksversion.returnClassForVersion(version=using_version) |
| 108 | 104 | ||
diff --git a/scripts/lib/mic/kickstart/custom_commands/__init__.py b/scripts/lib/mic/kickstart/custom_commands/__init__.py index 6aed0ff6fa..f84c6d9e00 100644 --- a/scripts/lib/mic/kickstart/custom_commands/__init__.py +++ b/scripts/lib/mic/kickstart/custom_commands/__init__.py | |||
| @@ -1,17 +1,10 @@ | |||
| 1 | from desktop import Mic_Desktop | ||
| 2 | from micrepo import Mic_Repo, Mic_RepoData | ||
| 3 | from micpartition import Mic_Partition | 1 | from micpartition import Mic_Partition |
| 4 | from micpartition import Mic_PartData | 2 | from micpartition import Mic_PartData |
| 5 | from installerfw import Mic_installerfw | ||
| 6 | from partition import Wic_Partition | 3 | from partition import Wic_Partition |
| 7 | 4 | ||
| 8 | __all__ = ( | 5 | __all__ = ( |
| 9 | "Mic_Desktop", | ||
| 10 | "Mic_Repo", | ||
| 11 | "Mic_RepoData", | ||
| 12 | "Mic_Partition", | 6 | "Mic_Partition", |
| 13 | "Mic_PartData", | 7 | "Mic_PartData", |
| 14 | "Mic_installerfw", | ||
| 15 | "Wic_Partition", | 8 | "Wic_Partition", |
| 16 | "Wic_PartData", | 9 | "Wic_PartData", |
| 17 | ) | 10 | ) |
diff --git a/scripts/lib/mic/kickstart/custom_commands/desktop.py b/scripts/lib/mic/kickstart/custom_commands/desktop.py deleted file mode 100644 index c8bd647ae3..0000000000 --- a/scripts/lib/mic/kickstart/custom_commands/desktop.py +++ /dev/null | |||
| @@ -1,95 +0,0 @@ | |||
| 1 | #!/usr/bin/python -tt | ||
| 2 | # | ||
| 3 | # Copyright (c) 2008, 2009, 2010 Intel, Inc. | ||
| 4 | # | ||
| 5 | # Yi Yang <yi.y.yang@intel.com> | ||
| 6 | # | ||
| 7 | # This program is free software; you can redistribute it and/or modify it | ||
| 8 | # under the terms of the GNU General Public License as published by the Free | ||
| 9 | # Software Foundation; version 2 of the License | ||
| 10 | # | ||
| 11 | # This program is distributed in the hope that it will be useful, but | ||
| 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
| 13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | # for more details. | ||
| 15 | # | ||
| 16 | # You should have received a copy of the GNU General Public License along | ||
| 17 | # with this program; if not, write to the Free Software Foundation, Inc., 59 | ||
| 18 | # Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 19 | |||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | class Mic_Desktop(KickstartCommand): | ||
| 25 | def __init__(self, writePriority=0, | ||
| 26 | defaultdesktop=None, | ||
| 27 | defaultdm=None, | ||
| 28 | autologinuser=None, | ||
| 29 | session=None): | ||
| 30 | |||
| 31 | KickstartCommand.__init__(self, writePriority) | ||
| 32 | |||
| 33 | self.__new_version = False | ||
| 34 | self.op = self._getParser() | ||
| 35 | |||
| 36 | self.defaultdesktop = defaultdesktop | ||
| 37 | self.autologinuser = autologinuser | ||
| 38 | self.defaultdm = defaultdm | ||
| 39 | self.session = session | ||
| 40 | |||
| 41 | def __str__(self): | ||
| 42 | retval = "" | ||
| 43 | |||
| 44 | if self.defaultdesktop != None: | ||
| 45 | retval += " --defaultdesktop=%s" % self.defaultdesktop | ||
| 46 | if self.session != None: | ||
| 47 | retval += " --session=\"%s\"" % self.session | ||
| 48 | if self.autologinuser != None: | ||
| 49 | retval += " --autologinuser=%s" % self.autologinuser | ||
| 50 | if self.defaultdm != None: | ||
| 51 | retval += " --defaultdm=%s" % self.defaultdm | ||
| 52 | |||
| 53 | if retval != "": | ||
| 54 | retval = "# Default Desktop Settings\ndesktop %s\n" % retval | ||
| 55 | |||
| 56 | return retval | ||
| 57 | |||
| 58 | def _getParser(self): | ||
| 59 | try: | ||
| 60 | op = KSOptionParser(lineno=self.lineno) | ||
| 61 | except TypeError: | ||
| 62 | # the latest version has not lineno argument | ||
| 63 | op = KSOptionParser() | ||
| 64 | self.__new_version = True | ||
| 65 | |||
| 66 | op.add_option("--defaultdesktop", dest="defaultdesktop", | ||
| 67 | action="store", | ||
| 68 | type="string", | ||
| 69 | nargs=1) | ||
| 70 | op.add_option("--autologinuser", dest="autologinuser", | ||
| 71 | action="store", | ||
| 72 | type="string", | ||
| 73 | nargs=1) | ||
| 74 | op.add_option("--defaultdm", dest="defaultdm", | ||
| 75 | action="store", | ||
| 76 | type="string", | ||
| 77 | nargs=1) | ||
| 78 | op.add_option("--session", dest="session", | ||
| 79 | action="store", | ||
| 80 | type="string", | ||
| 81 | nargs=1) | ||
| 82 | return op | ||
| 83 | |||
| 84 | def parse(self, args): | ||
| 85 | if self.__new_version: | ||
| 86 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 87 | else: | ||
| 88 | (opts, extra) = self.op.parse_args(args=args) | ||
| 89 | |||
| 90 | if extra: | ||
| 91 | m = _("Unexpected arguments to %(command)s command: %(options)s") \ | ||
| 92 | % {"command": "desktop", "options": extra} | ||
| 93 | raise KickstartValueError, formatErrorMsg(self.lineno, msg=m) | ||
| 94 | |||
| 95 | self._setToSelf(self.op, opts) | ||
diff --git a/scripts/lib/mic/kickstart/custom_commands/installerfw.py b/scripts/lib/mic/kickstart/custom_commands/installerfw.py deleted file mode 100644 index 2466f1dc07..0000000000 --- a/scripts/lib/mic/kickstart/custom_commands/installerfw.py +++ /dev/null | |||
| @@ -1,63 +0,0 @@ | |||
| 1 | #!/usr/bin/python -tt | ||
| 2 | # | ||
| 3 | # Copyright (c) 2013 Intel, Inc. | ||
| 4 | # | ||
| 5 | # This program is free software; you can redistribute it and/or modify it | ||
| 6 | # under the terms of the GNU General Public License as published by the Free | ||
| 7 | # Software Foundation; version 2 of the License | ||
| 8 | # | ||
| 9 | # This program is distributed in the hope that it will be useful, but | ||
| 10 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
| 11 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 12 | # for more details. | ||
| 13 | # | ||
| 14 | # You should have received a copy of the GNU General Public License along | ||
| 15 | # with this program; if not, write to the Free Software Foundation, Inc., 59 | ||
| 16 | # Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 17 | |||
| 18 | from pykickstart.base import * | ||
| 19 | from pykickstart.options import * | ||
| 20 | |||
| 21 | class Mic_installerfw(KickstartCommand): | ||
| 22 | """ This class implements the "installerfw" KS option. The argument | ||
| 23 | of the option is a comman-separated list of MIC features which have to be | ||
| 24 | disabled and instead, will be done in the installer. For example, | ||
| 25 | "installerfw=extlinux" disables all the MIC code which installs extlinux to | ||
| 26 | the target images, and instead, the extlinux or whatever boot-loader will | ||
| 27 | be installed by the installer instead. | ||
| 28 | |||
| 29 | The installer is a tool which is external to MIC, it comes from the | ||
| 30 | installation repositories and can be executed by MIC in order to perform | ||
| 31 | various configuration actions. The main point here is to make sure MIC has | ||
| 32 | no hard-wired knoledge about the target OS configuration. """ | ||
| 33 | |||
| 34 | removedKeywords = KickstartCommand.removedKeywords | ||
| 35 | removedAttrs = KickstartCommand.removedAttrs | ||
| 36 | |||
| 37 | def __init__(self, *args, **kwargs): | ||
| 38 | KickstartCommand.__init__(self, *args, **kwargs) | ||
| 39 | self.op = self._getParser() | ||
| 40 | self.features = kwargs.get("installerfw", None) | ||
| 41 | |||
| 42 | def __str__(self): | ||
| 43 | retval = KickstartCommand.__str__(self) | ||
| 44 | |||
| 45 | if self.features: | ||
| 46 | retval += "# Enable installer framework features\ninstallerfw\n" | ||
| 47 | |||
| 48 | return retval | ||
| 49 | |||
| 50 | def _getParser(self): | ||
| 51 | op = KSOptionParser() | ||
| 52 | return op | ||
| 53 | |||
| 54 | def parse(self, args): | ||
| 55 | (_, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 56 | |||
| 57 | if len(extra) != 1: | ||
| 58 | msg = "Kickstart command \"installerfw\" requires one " \ | ||
| 59 | "argumet - a list of legacy features to disable" | ||
| 60 | raise KickstartValueError, formatErrorMsg(self.lineno, msg = msg) | ||
| 61 | |||
| 62 | self.features = extra[0].split(",") | ||
| 63 | return self | ||
diff --git a/scripts/lib/mic/kickstart/custom_commands/micrepo.py b/scripts/lib/mic/kickstart/custom_commands/micrepo.py deleted file mode 100644 index b31576e400..0000000000 --- a/scripts/lib/mic/kickstart/custom_commands/micrepo.py +++ /dev/null | |||
| @@ -1,127 +0,0 @@ | |||
| 1 | #!/usr/bin/python -tt | ||
| 2 | # | ||
| 3 | # Copyright (c) 2008, 2009, 2010 Intel, Inc. | ||
| 4 | # | ||
| 5 | # Yi Yang <yi.y.yang@intel.com> | ||
| 6 | # | ||
| 7 | # This program is free software; you can redistribute it and/or modify it | ||
| 8 | # under the terms of the GNU General Public License as published by the Free | ||
| 9 | # Software Foundation; version 2 of the License | ||
| 10 | # | ||
| 11 | # This program is distributed in the hope that it will be useful, but | ||
| 12 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
| 13 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | # for more details. | ||
| 15 | # | ||
| 16 | # You should have received a copy of the GNU General Public License along | ||
| 17 | # with this program; if not, write to the Free Software Foundation, Inc., 59 | ||
| 18 | # Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 19 | |||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | from pykickstart.commands.repo import * | ||
| 24 | |||
| 25 | class Mic_RepoData(F8_RepoData): | ||
| 26 | |||
| 27 | def __init__(self, baseurl="", mirrorlist=None, name="", priority=None, | ||
| 28 | includepkgs=(), excludepkgs=(), save=False, proxy=None, | ||
| 29 | proxy_username=None, proxy_password=None, debuginfo=False, | ||
| 30 | source=False, gpgkey=None, disable=False, ssl_verify="yes", | ||
| 31 | nocache=False): | ||
| 32 | kw = {} | ||
| 33 | # F8_RepoData keywords | ||
| 34 | if includepkgs: | ||
| 35 | kw['includepkgs'] = includepkgs | ||
| 36 | if excludepkgs: | ||
| 37 | kw['excludepkgs'] = excludepkgs | ||
| 38 | |||
| 39 | #FC6_RepoData keywords | ||
| 40 | if baseurl: | ||
| 41 | kw['baseurl'] = baseurl | ||
| 42 | if mirrorlist: | ||
| 43 | kw['mirrorlist'] = mirrorlist | ||
| 44 | if name: | ||
| 45 | kw['name'] = name | ||
| 46 | |||
| 47 | F8_RepoData.__init__(self, **kw) | ||
| 48 | self.save = save | ||
| 49 | self.proxy = proxy | ||
| 50 | self.proxy_username = proxy_username | ||
| 51 | self.proxy_password = proxy_password | ||
| 52 | self.debuginfo = debuginfo | ||
| 53 | self.disable = disable | ||
| 54 | self.source = source | ||
| 55 | self.gpgkey = gpgkey | ||
| 56 | self.ssl_verify = ssl_verify.lower() | ||
| 57 | self.priority = priority | ||
| 58 | self.nocache = nocache | ||
| 59 | |||
| 60 | def _getArgsAsStr(self): | ||
| 61 | retval = F8_RepoData._getArgsAsStr(self) | ||
| 62 | |||
| 63 | if self.save: | ||
| 64 | retval += " --save" | ||
| 65 | if self.proxy: | ||
| 66 | retval += " --proxy=%s" % self.proxy | ||
| 67 | if self.proxy_username: | ||
| 68 | retval += " --proxyuser=%s" % self.proxy_username | ||
| 69 | if self.proxy_password: | ||
| 70 | retval += " --proxypasswd=%s" % self.proxy_password | ||
| 71 | if self.debuginfo: | ||
| 72 | retval += " --debuginfo" | ||
| 73 | if self.source: | ||
| 74 | retval += " --source" | ||
| 75 | if self.gpgkey: | ||
| 76 | retval += " --gpgkey=%s" % self.gpgkey | ||
| 77 | if self.disable: | ||
| 78 | retval += " --disable" | ||
| 79 | if self.ssl_verify: | ||
| 80 | retval += " --ssl_verify=%s" % self.ssl_verify | ||
| 81 | if self.priority: | ||
| 82 | retval += " --priority=%s" % self.priority | ||
| 83 | if self.nocache: | ||
| 84 | retval += " --nocache" | ||
| 85 | |||
| 86 | return retval | ||
| 87 | |||
| 88 | class Mic_Repo(F8_Repo): | ||
| 89 | def __init__(self, writePriority=0, repoList=None): | ||
| 90 | F8_Repo.__init__(self, writePriority, repoList) | ||
| 91 | |||
| 92 | def __str__(self): | ||
| 93 | retval = "" | ||
| 94 | for repo in self.repoList: | ||
| 95 | retval += repo.__str__() | ||
| 96 | |||
| 97 | return retval | ||
| 98 | |||
| 99 | def _getParser(self): | ||
| 100 | def list_cb (option, opt_str, value, parser): | ||
| 101 | for d in value.split(','): | ||
| 102 | parser.values.ensure_value(option.dest, []).append(d) | ||
| 103 | |||
| 104 | op = F8_Repo._getParser(self) | ||
| 105 | op.add_option("--save", action="store_true", dest="save", | ||
| 106 | default=False) | ||
| 107 | op.add_option("--proxy", type="string", action="store", dest="proxy", | ||
| 108 | default=None, nargs=1) | ||
| 109 | op.add_option("--proxyuser", type="string", action="store", | ||
| 110 | dest="proxy_username", default=None, nargs=1) | ||
| 111 | op.add_option("--proxypasswd", type="string", action="store", | ||
| 112 | dest="proxy_password", default=None, nargs=1) | ||
| 113 | op.add_option("--debuginfo", action="store_true", dest="debuginfo", | ||
| 114 | default=False) | ||
| 115 | op.add_option("--source", action="store_true", dest="source", | ||
| 116 | default=False) | ||
| 117 | op.add_option("--disable", action="store_true", dest="disable", | ||
| 118 | default=False) | ||
| 119 | op.add_option("--gpgkey", type="string", action="store", dest="gpgkey", | ||
| 120 | default=None, nargs=1) | ||
| 121 | op.add_option("--ssl_verify", type="string", action="store", | ||
| 122 | dest="ssl_verify", default="yes") | ||
| 123 | op.add_option("--priority", type="int", action="store", dest="priority", | ||
| 124 | default=None) | ||
| 125 | op.add_option("--nocache", action="store_true", dest="nocache", | ||
| 126 | default=False) | ||
| 127 | return op | ||
