diff options
Diffstat (limited to 'scripts/lib/mic/kickstart/custom_commands')
6 files changed, 403 insertions, 0 deletions
diff --git a/scripts/lib/mic/kickstart/custom_commands/__init__.py b/scripts/lib/mic/kickstart/custom_commands/__init__.py new file mode 100644 index 0000000000..5f4c440369 --- /dev/null +++ b/scripts/lib/mic/kickstart/custom_commands/__init__.py | |||
@@ -0,0 +1,12 @@ | |||
1 | from desktop import Mic_Desktop | ||
2 | from micrepo import Mic_Repo, Mic_RepoData | ||
3 | from partition import Mic_Partition | ||
4 | from installerfw import Mic_installerfw | ||
5 | |||
6 | __all__ = ( | ||
7 | "Mic_Desktop", | ||
8 | "Mic_Repo", | ||
9 | "Mic_RepoData", | ||
10 | "Mic_Partition", | ||
11 | "Mic_installerfw", | ||
12 | ) | ||
diff --git a/scripts/lib/mic/kickstart/custom_commands/desktop.py b/scripts/lib/mic/kickstart/custom_commands/desktop.py new file mode 100644 index 0000000000..c8bd647ae3 --- /dev/null +++ b/scripts/lib/mic/kickstart/custom_commands/desktop.py | |||
@@ -0,0 +1,95 @@ | |||
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 new file mode 100644 index 0000000000..2466f1dc07 --- /dev/null +++ b/scripts/lib/mic/kickstart/custom_commands/installerfw.py | |||
@@ -0,0 +1,63 @@ | |||
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/micboot.py b/scripts/lib/mic/kickstart/custom_commands/micboot.py new file mode 100644 index 0000000000..66d1678aa7 --- /dev/null +++ b/scripts/lib/mic/kickstart/custom_commands/micboot.py | |||
@@ -0,0 +1,49 @@ | |||
1 | #!/usr/bin/python -tt | ||
2 | # | ||
3 | # Copyright (c) 2008, 2009, 2010 Intel, Inc. | ||
4 | # | ||
5 | # Anas Nashif | ||
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.bootloader import * | ||
24 | |||
25 | class Mic_Bootloader(F8_Bootloader): | ||
26 | def __init__(self, writePriority=10, appendLine="", driveorder=None, | ||
27 | forceLBA=False, location="", md5pass="", password="", | ||
28 | upgrade=False, menus=""): | ||
29 | F8_Bootloader.__init__(self, writePriority, appendLine, driveorder, | ||
30 | forceLBA, location, md5pass, password, upgrade) | ||
31 | |||
32 | self.menus = "" | ||
33 | self.ptable = "msdos" | ||
34 | |||
35 | def _getArgsAsStr(self): | ||
36 | ret = F8_Bootloader._getArgsAsStr(self) | ||
37 | |||
38 | if self.menus == "": | ||
39 | ret += " --menus=%s" %(self.menus,) | ||
40 | if self.ptable: | ||
41 | ret += " --ptable=\"%s\"" %(self.ptable,) | ||
42 | return ret | ||
43 | |||
44 | def _getParser(self): | ||
45 | op = F8_Bootloader._getParser(self) | ||
46 | op.add_option("--menus", dest="menus") | ||
47 | op.add_option("--ptable", dest="ptable", type="string") | ||
48 | return op | ||
49 | |||
diff --git a/scripts/lib/mic/kickstart/custom_commands/micrepo.py b/scripts/lib/mic/kickstart/custom_commands/micrepo.py new file mode 100644 index 0000000000..b31576e400 --- /dev/null +++ b/scripts/lib/mic/kickstart/custom_commands/micrepo.py | |||
@@ -0,0 +1,127 @@ | |||
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 | ||
diff --git a/scripts/lib/mic/kickstart/custom_commands/partition.py b/scripts/lib/mic/kickstart/custom_commands/partition.py new file mode 100644 index 0000000000..59a87fb486 --- /dev/null +++ b/scripts/lib/mic/kickstart/custom_commands/partition.py | |||
@@ -0,0 +1,57 @@ | |||
1 | #!/usr/bin/python -tt | ||
2 | # | ||
3 | # Marko Saukko <marko.saukko@cybercom.com> | ||
4 | # | ||
5 | # Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). | ||
6 | # | ||
7 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
8 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
9 | # General Public License v.2. This program is distributed in the hope that it | ||
10 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
11 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
12 | # See the GNU General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License along with | ||
15 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
16 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | |||
18 | from pykickstart.commands.partition import * | ||
19 | |||
20 | class Mic_PartData(FC4_PartData): | ||
21 | removedKeywords = FC4_PartData.removedKeywords | ||
22 | removedAttrs = FC4_PartData.removedAttrs | ||
23 | |||
24 | def __init__(self, *args, **kwargs): | ||
25 | FC4_PartData.__init__(self, *args, **kwargs) | ||
26 | self.deleteRemovedAttrs() | ||
27 | self.align = kwargs.get("align", None) | ||
28 | self.extopts = kwargs.get("extopts", None) | ||
29 | self.part_type = kwargs.get("part_type", None) | ||
30 | |||
31 | def _getArgsAsStr(self): | ||
32 | retval = FC4_PartData._getArgsAsStr(self) | ||
33 | |||
34 | if self.align: | ||
35 | retval += " --align" | ||
36 | if self.extopts: | ||
37 | retval += " --extoptions=%s" % self.extopts | ||
38 | if self.part_type: | ||
39 | retval += " --part-type=%s" % self.part_type | ||
40 | |||
41 | return retval | ||
42 | |||
43 | class Mic_Partition(FC4_Partition): | ||
44 | removedKeywords = FC4_Partition.removedKeywords | ||
45 | removedAttrs = FC4_Partition.removedAttrs | ||
46 | |||
47 | def _getParser(self): | ||
48 | op = FC4_Partition._getParser(self) | ||
49 | # The alignment value is given in kBytes. e.g., value 8 means that | ||
50 | # the partition is aligned to start from 8096 byte boundary. | ||
51 | op.add_option("--align", type="int", action="store", dest="align", | ||
52 | default=None) | ||
53 | op.add_option("--extoptions", type="string", action="store", dest="extopts", | ||
54 | default=None) | ||
55 | op.add_option("--part-type", type="string", action="store", dest="part_type", | ||
56 | default=None) | ||
57 | return op | ||