diff options
Diffstat (limited to 'scripts/lib/mic/3rdparty/pykickstart/commands')
3 files changed, 0 insertions, 550 deletions
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/__init__.py b/scripts/lib/mic/3rdparty/pykickstart/commands/__init__.py deleted file mode 100644 index 2d94550935..0000000000 --- a/scripts/lib/mic/3rdparty/pykickstart/commands/__init__.py +++ /dev/null | |||
| @@ -1,20 +0,0 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2009 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | import bootloader, partition | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/bootloader.py b/scripts/lib/mic/3rdparty/pykickstart/commands/bootloader.py deleted file mode 100644 index c2b552f689..0000000000 --- a/scripts/lib/mic/3rdparty/pykickstart/commands/bootloader.py +++ /dev/null | |||
| @@ -1,216 +0,0 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2007 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.options import * | ||
| 22 | |||
| 23 | class FC3_Bootloader(KickstartCommand): | ||
| 24 | removedKeywords = KickstartCommand.removedKeywords | ||
| 25 | removedAttrs = KickstartCommand.removedAttrs | ||
| 26 | |||
| 27 | def __init__(self, writePriority=10, *args, **kwargs): | ||
| 28 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 29 | self.op = self._getParser() | ||
| 30 | |||
| 31 | self.driveorder = kwargs.get("driveorder", []) | ||
| 32 | self.appendLine = kwargs.get("appendLine", "") | ||
| 33 | self.forceLBA = kwargs.get("forceLBA", False) | ||
| 34 | self.linear = kwargs.get("linear", True) | ||
| 35 | self.location = kwargs.get("location", "") | ||
| 36 | self.md5pass = kwargs.get("md5pass", "") | ||
| 37 | self.password = kwargs.get("password", "") | ||
| 38 | self.upgrade = kwargs.get("upgrade", False) | ||
| 39 | self.useLilo = kwargs.get("useLilo", False) | ||
| 40 | |||
| 41 | self.deleteRemovedAttrs() | ||
| 42 | |||
| 43 | def _getArgsAsStr(self): | ||
| 44 | retval = "" | ||
| 45 | |||
| 46 | if self.appendLine != "": | ||
| 47 | retval += " --append=\"%s\"" % self.appendLine | ||
| 48 | if self.linear: | ||
| 49 | retval += " --linear" | ||
| 50 | if self.location: | ||
| 51 | retval += " --location=%s" % self.location | ||
| 52 | if hasattr(self, "forceLBA") and self.forceLBA: | ||
| 53 | retval += " --lba32" | ||
| 54 | if self.password != "": | ||
| 55 | retval += " --password=\"%s\"" % self.password | ||
| 56 | if self.md5pass != "": | ||
| 57 | retval += " --md5pass=\"%s\"" % self.md5pass | ||
| 58 | if self.upgrade: | ||
| 59 | retval += " --upgrade" | ||
| 60 | if self.useLilo: | ||
| 61 | retval += " --useLilo" | ||
| 62 | if len(self.driveorder) > 0: | ||
| 63 | retval += " --driveorder=\"%s\"" % ",".join(self.driveorder) | ||
| 64 | |||
| 65 | return retval | ||
| 66 | |||
| 67 | def __str__(self): | ||
| 68 | retval = KickstartCommand.__str__(self) | ||
| 69 | |||
| 70 | if self.location != "": | ||
| 71 | retval += "# System bootloader configuration\nbootloader" | ||
| 72 | retval += self._getArgsAsStr() + "\n" | ||
| 73 | |||
| 74 | return retval | ||
| 75 | |||
| 76 | def _getParser(self): | ||
| 77 | def driveorder_cb (option, opt_str, value, parser): | ||
| 78 | for d in value.split(','): | ||
| 79 | parser.values.ensure_value(option.dest, []).append(d) | ||
| 80 | |||
| 81 | op = KSOptionParser() | ||
| 82 | op.add_option("--append", dest="appendLine") | ||
| 83 | op.add_option("--linear", dest="linear", action="store_true", | ||
| 84 | default=True) | ||
| 85 | op.add_option("--nolinear", dest="linear", action="store_false") | ||
| 86 | op.add_option("--location", dest="location", type="choice", | ||
| 87 | default="mbr", | ||
| 88 | choices=["mbr", "partition", "none", "boot"]) | ||
| 89 | op.add_option("--lba32", dest="forceLBA", action="store_true", | ||
| 90 | default=False) | ||
| 91 | op.add_option("--password", dest="password", default="") | ||
| 92 | op.add_option("--md5pass", dest="md5pass", default="") | ||
| 93 | op.add_option("--upgrade", dest="upgrade", action="store_true", | ||
| 94 | default=False) | ||
| 95 | op.add_option("--useLilo", dest="useLilo", action="store_true", | ||
| 96 | default=False) | ||
| 97 | op.add_option("--driveorder", dest="driveorder", action="callback", | ||
| 98 | callback=driveorder_cb, nargs=1, type="string") | ||
| 99 | return op | ||
| 100 | |||
| 101 | def parse(self, args): | ||
| 102 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 103 | self._setToSelf(self.op, opts) | ||
| 104 | |||
| 105 | if self.currentCmd == "lilo": | ||
| 106 | self.useLilo = True | ||
| 107 | |||
| 108 | return self | ||
| 109 | |||
| 110 | class FC4_Bootloader(FC3_Bootloader): | ||
| 111 | removedKeywords = FC3_Bootloader.removedKeywords + ["linear", "useLilo"] | ||
| 112 | removedAttrs = FC3_Bootloader.removedAttrs + ["linear", "useLilo"] | ||
| 113 | |||
| 114 | def __init__(self, writePriority=10, *args, **kwargs): | ||
| 115 | FC3_Bootloader.__init__(self, writePriority, *args, **kwargs) | ||
| 116 | |||
| 117 | def _getArgsAsStr(self): | ||
| 118 | retval = "" | ||
| 119 | if self.appendLine != "": | ||
| 120 | retval += " --append=\"%s\"" % self.appendLine | ||
| 121 | if self.location: | ||
| 122 | retval += " --location=%s" % self.location | ||
| 123 | if hasattr(self, "forceLBA") and self.forceLBA: | ||
| 124 | retval += " --lba32" | ||
| 125 | if self.password != "": | ||
| 126 | retval += " --password=\"%s\"" % self.password | ||
| 127 | if self.md5pass != "": | ||
| 128 | retval += " --md5pass=\"%s\"" % self.md5pass | ||
| 129 | if self.upgrade: | ||
| 130 | retval += " --upgrade" | ||
| 131 | if len(self.driveorder) > 0: | ||
| 132 | retval += " --driveorder=\"%s\"" % ",".join(self.driveorder) | ||
| 133 | return retval | ||
| 134 | |||
| 135 | def _getParser(self): | ||
| 136 | op = FC3_Bootloader._getParser(self) | ||
| 137 | op.remove_option("--linear") | ||
| 138 | op.remove_option("--nolinear") | ||
| 139 | op.remove_option("--useLilo") | ||
| 140 | return op | ||
| 141 | |||
| 142 | def parse(self, args): | ||
| 143 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 144 | self._setToSelf(self.op, opts) | ||
| 145 | return self | ||
| 146 | |||
| 147 | class F8_Bootloader(FC4_Bootloader): | ||
| 148 | removedKeywords = FC4_Bootloader.removedKeywords | ||
| 149 | removedAttrs = FC4_Bootloader.removedAttrs | ||
| 150 | |||
| 151 | def __init__(self, writePriority=10, *args, **kwargs): | ||
| 152 | FC4_Bootloader.__init__(self, writePriority, *args, **kwargs) | ||
| 153 | |||
| 154 | self.timeout = kwargs.get("timeout", None) | ||
| 155 | self.default = kwargs.get("default", "") | ||
| 156 | |||
| 157 | def _getArgsAsStr(self): | ||
| 158 | ret = FC4_Bootloader._getArgsAsStr(self) | ||
| 159 | |||
| 160 | if self.timeout is not None: | ||
| 161 | ret += " --timeout=%d" %(self.timeout,) | ||
| 162 | if self.default: | ||
| 163 | ret += " --default=%s" %(self.default,) | ||
| 164 | |||
| 165 | return ret | ||
| 166 | |||
| 167 | def _getParser(self): | ||
| 168 | op = FC4_Bootloader._getParser(self) | ||
| 169 | op.add_option("--timeout", dest="timeout", type="int") | ||
| 170 | op.add_option("--default", dest="default") | ||
| 171 | return op | ||
| 172 | |||
| 173 | class F12_Bootloader(F8_Bootloader): | ||
| 174 | removedKeywords = F8_Bootloader.removedKeywords | ||
| 175 | removedAttrs = F8_Bootloader.removedAttrs | ||
| 176 | |||
| 177 | def _getParser(self): | ||
| 178 | op = F8_Bootloader._getParser(self) | ||
| 179 | op.add_option("--lba32", dest="forceLBA", deprecated=1, action="store_true") | ||
| 180 | return op | ||
| 181 | |||
| 182 | class F14_Bootloader(F12_Bootloader): | ||
| 183 | removedKeywords = F12_Bootloader.removedKeywords + ["forceLBA"] | ||
| 184 | removedAttrs = F12_Bootloader.removedKeywords + ["forceLBA"] | ||
| 185 | |||
| 186 | def _getParser(self): | ||
| 187 | op = F12_Bootloader._getParser(self) | ||
| 188 | op.remove_option("--lba32") | ||
| 189 | return op | ||
| 190 | |||
| 191 | class F15_Bootloader(F14_Bootloader): | ||
| 192 | removedKeywords = F14_Bootloader.removedKeywords | ||
| 193 | removedAttrs = F14_Bootloader.removedAttrs | ||
| 194 | |||
| 195 | def __init__(self, writePriority=10, *args, **kwargs): | ||
| 196 | F14_Bootloader.__init__(self, writePriority, *args, **kwargs) | ||
| 197 | |||
| 198 | self.isCrypted = kwargs.get("isCrypted", False) | ||
| 199 | |||
| 200 | def _getArgsAsStr(self): | ||
| 201 | ret = F14_Bootloader._getArgsAsStr(self) | ||
| 202 | |||
| 203 | if self.isCrypted: | ||
| 204 | ret += " --iscrypted" | ||
| 205 | |||
| 206 | return ret | ||
| 207 | |||
| 208 | def _getParser(self): | ||
| 209 | def password_cb(option, opt_str, value, parser): | ||
| 210 | parser.values.isCrypted = True | ||
| 211 | parser.values.password = value | ||
| 212 | |||
| 213 | op = F14_Bootloader._getParser(self) | ||
| 214 | op.add_option("--iscrypted", dest="isCrypted", action="store_true", default=False) | ||
| 215 | op.add_option("--md5pass", action="callback", callback=password_cb, nargs=1, type="string") | ||
| 216 | return op | ||
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/partition.py b/scripts/lib/mic/3rdparty/pykickstart/commands/partition.py deleted file mode 100644 index 56b91aa9d9..0000000000 --- a/scripts/lib/mic/3rdparty/pykickstart/commands/partition.py +++ /dev/null | |||
| @@ -1,314 +0,0 @@ | |||
| 1 | # | ||
| 2 | # Chris Lumens <clumens@redhat.com> | ||
| 3 | # | ||
| 4 | # Copyright 2005, 2006, 2007, 2008 Red Hat, Inc. | ||
| 5 | # | ||
| 6 | # This copyrighted material is made available to anyone wishing to use, modify, | ||
| 7 | # copy, or redistribute it subject to the terms and conditions of the GNU | ||
| 8 | # General Public License v.2. This program is distributed in the hope that it | ||
| 9 | # will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the | ||
| 10 | # implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 11 | # See the GNU General Public License for more details. | ||
| 12 | # | ||
| 13 | # You should have received a copy of the GNU General Public License along with | ||
| 14 | # this program; if not, write to the Free Software Foundation, Inc., 51 | ||
| 15 | # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Any Red Hat | ||
| 16 | # trademarks that are incorporated in the source code or documentation are not | ||
| 17 | # subject to the GNU General Public License and may only be used or replicated | ||
| 18 | # with the express permission of Red Hat, Inc. | ||
| 19 | # | ||
| 20 | from pykickstart.base import * | ||
| 21 | from pykickstart.errors import * | ||
| 22 | from pykickstart.options import * | ||
| 23 | |||
| 24 | import gettext | ||
| 25 | import warnings | ||
| 26 | _ = lambda x: gettext.ldgettext("pykickstart", x) | ||
| 27 | |||
| 28 | class FC3_PartData(BaseData): | ||
| 29 | removedKeywords = BaseData.removedKeywords | ||
| 30 | removedAttrs = BaseData.removedAttrs | ||
| 31 | |||
| 32 | def __init__(self, *args, **kwargs): | ||
| 33 | BaseData.__init__(self, *args, **kwargs) | ||
| 34 | self.active = kwargs.get("active", False) | ||
| 35 | self.primOnly = kwargs.get("primOnly", False) | ||
| 36 | self.end = kwargs.get("end", 0) | ||
| 37 | self.fstype = kwargs.get("fstype", "") | ||
| 38 | self.grow = kwargs.get("grow", False) | ||
| 39 | self.maxSizeMB = kwargs.get("maxSizeMB", 0) | ||
| 40 | self.format = kwargs.get("format", True) | ||
| 41 | self.onbiosdisk = kwargs.get("onbiosdisk", "") | ||
| 42 | self.disk = kwargs.get("disk", "") | ||
| 43 | self.onPart = kwargs.get("onPart", "") | ||
| 44 | self.recommended = kwargs.get("recommended", False) | ||
| 45 | self.size = kwargs.get("size", None) | ||
| 46 | self.start = kwargs.get("start", 0) | ||
| 47 | self.mountpoint = kwargs.get("mountpoint", "") | ||
| 48 | |||
| 49 | def __eq__(self, y): | ||
| 50 | if self.mountpoint: | ||
| 51 | return self.mountpoint == y.mountpoint | ||
| 52 | else: | ||
| 53 | return False | ||
| 54 | |||
| 55 | def _getArgsAsStr(self): | ||
| 56 | retval = "" | ||
| 57 | |||
| 58 | if self.active: | ||
| 59 | retval += " --active" | ||
| 60 | if self.primOnly: | ||
| 61 | retval += " --asprimary" | ||
| 62 | if hasattr(self, "end") and self.end != 0: | ||
| 63 | retval += " --end=%s" % self.end | ||
| 64 | if self.fstype != "": | ||
| 65 | retval += " --fstype=\"%s\"" % self.fstype | ||
| 66 | if self.grow: | ||
| 67 | retval += " --grow" | ||
| 68 | if self.maxSizeMB > 0: | ||
| 69 | retval += " --maxsize=%d" % self.maxSizeMB | ||
| 70 | if not self.format: | ||
| 71 | retval += " --noformat" | ||
| 72 | if self.onbiosdisk != "": | ||
| 73 | retval += " --onbiosdisk=%s" % self.onbiosdisk | ||
| 74 | if self.disk != "": | ||
| 75 | retval += " --ondisk=%s" % self.disk | ||
| 76 | if self.onPart != "": | ||
| 77 | retval += " --onpart=%s" % self.onPart | ||
| 78 | if self.recommended: | ||
| 79 | retval += " --recommended" | ||
| 80 | if self.size and self.size != 0: | ||
| 81 | retval += " --size=%s" % self.size | ||
| 82 | if hasattr(self, "start") and self.start != 0: | ||
| 83 | retval += " --start=%s" % self.start | ||
| 84 | |||
| 85 | return retval | ||
| 86 | |||
| 87 | def __str__(self): | ||
| 88 | retval = BaseData.__str__(self) | ||
| 89 | if self.mountpoint: | ||
| 90 | mountpoint_str = "%s" % self.mountpoint | ||
| 91 | else: | ||
| 92 | mountpoint_str = "(No mount point)" | ||
| 93 | retval += "part %s%s\n" % (mountpoint_str, self._getArgsAsStr()) | ||
| 94 | return retval | ||
| 95 | |||
| 96 | class FC4_PartData(FC3_PartData): | ||
| 97 | removedKeywords = FC3_PartData.removedKeywords | ||
| 98 | removedAttrs = FC3_PartData.removedAttrs | ||
| 99 | |||
| 100 | def __init__(self, *args, **kwargs): | ||
| 101 | FC3_PartData.__init__(self, *args, **kwargs) | ||
| 102 | self.bytesPerInode = kwargs.get("bytesPerInode", 4096) | ||
| 103 | self.fsopts = kwargs.get("fsopts", "") | ||
| 104 | self.label = kwargs.get("label", "") | ||
| 105 | |||
| 106 | def _getArgsAsStr(self): | ||
| 107 | retval = FC3_PartData._getArgsAsStr(self) | ||
| 108 | |||
| 109 | if hasattr(self, "bytesPerInode") and self.bytesPerInode != 0: | ||
| 110 | retval += " --bytes-per-inode=%d" % self.bytesPerInode | ||
| 111 | if self.fsopts != "": | ||
| 112 | retval += " --fsoptions=\"%s\"" % self.fsopts | ||
| 113 | if self.label != "": | ||
| 114 | retval += " --label=%s" % self.label | ||
| 115 | |||
| 116 | return retval | ||
| 117 | |||
| 118 | class F9_PartData(FC4_PartData): | ||
| 119 | removedKeywords = FC4_PartData.removedKeywords + ["bytesPerInode"] | ||
| 120 | removedAttrs = FC4_PartData.removedAttrs + ["bytesPerInode"] | ||
| 121 | |||
| 122 | def __init__(self, *args, **kwargs): | ||
| 123 | FC4_PartData.__init__(self, *args, **kwargs) | ||
| 124 | self.deleteRemovedAttrs() | ||
| 125 | |||
| 126 | self.fsopts = kwargs.get("fsopts", "") | ||
| 127 | self.label = kwargs.get("label", "") | ||
| 128 | self.fsprofile = kwargs.get("fsprofile", "") | ||
| 129 | self.encrypted = kwargs.get("encrypted", False) | ||
| 130 | self.passphrase = kwargs.get("passphrase", "") | ||
| 131 | |||
| 132 | def _getArgsAsStr(self): | ||
| 133 | retval = FC4_PartData._getArgsAsStr(self) | ||
| 134 | |||
| 135 | if self.fsprofile != "": | ||
| 136 | retval += " --fsprofile=\"%s\"" % self.fsprofile | ||
| 137 | if self.encrypted: | ||
| 138 | retval += " --encrypted" | ||
| 139 | |||
| 140 | if self.passphrase != "": | ||
| 141 | retval += " --passphrase=\"%s\"" % self.passphrase | ||
| 142 | |||
| 143 | return retval | ||
| 144 | |||
| 145 | class F11_PartData(F9_PartData): | ||
| 146 | removedKeywords = F9_PartData.removedKeywords + ["start", "end"] | ||
| 147 | removedAttrs = F9_PartData.removedAttrs + ["start", "end"] | ||
| 148 | |||
| 149 | class F12_PartData(F11_PartData): | ||
| 150 | removedKeywords = F11_PartData.removedKeywords | ||
| 151 | removedAttrs = F11_PartData.removedAttrs | ||
| 152 | |||
| 153 | def __init__(self, *args, **kwargs): | ||
| 154 | F11_PartData.__init__(self, *args, **kwargs) | ||
| 155 | |||
| 156 | self.escrowcert = kwargs.get("escrowcert", "") | ||
| 157 | self.backuppassphrase = kwargs.get("backuppassphrase", False) | ||
| 158 | |||
| 159 | def _getArgsAsStr(self): | ||
| 160 | retval = F11_PartData._getArgsAsStr(self) | ||
| 161 | |||
| 162 | if self.encrypted and self.escrowcert != "": | ||
| 163 | retval += " --escrowcert=\"%s\"" % self.escrowcert | ||
| 164 | |||
| 165 | if self.backuppassphrase: | ||
| 166 | retval += " --backuppassphrase" | ||
| 167 | |||
| 168 | return retval | ||
| 169 | |||
| 170 | F14_PartData = F12_PartData | ||
| 171 | |||
| 172 | class FC3_Partition(KickstartCommand): | ||
| 173 | removedKeywords = KickstartCommand.removedKeywords | ||
| 174 | removedAttrs = KickstartCommand.removedAttrs | ||
| 175 | |||
| 176 | def __init__(self, writePriority=130, *args, **kwargs): | ||
| 177 | KickstartCommand.__init__(self, writePriority, *args, **kwargs) | ||
| 178 | self.op = self._getParser() | ||
| 179 | |||
| 180 | self.partitions = kwargs.get("partitions", []) | ||
| 181 | |||
| 182 | def __str__(self): | ||
| 183 | retval = "" | ||
| 184 | |||
| 185 | for part in self.partitions: | ||
| 186 | retval += part.__str__() | ||
| 187 | |||
| 188 | if retval != "": | ||
| 189 | return "# Disk partitioning information\n" + retval | ||
| 190 | else: | ||
| 191 | return "" | ||
| 192 | |||
| 193 | def _getParser(self): | ||
| 194 | def part_cb (option, opt_str, value, parser): | ||
| 195 | if value.startswith("/dev/"): | ||
| 196 | parser.values.ensure_value(option.dest, value[5:]) | ||
| 197 | else: | ||
| 198 | parser.values.ensure_value(option.dest, value) | ||
| 199 | |||
| 200 | op = KSOptionParser() | ||
| 201 | op.add_option("--active", dest="active", action="store_true", | ||
| 202 | default=False) | ||
| 203 | op.add_option("--asprimary", dest="primOnly", action="store_true", | ||
| 204 | default=False) | ||
| 205 | op.add_option("--end", dest="end", action="store", type="int", | ||
| 206 | nargs=1) | ||
| 207 | op.add_option("--fstype", "--type", dest="fstype") | ||
| 208 | op.add_option("--grow", dest="grow", action="store_true", default=False) | ||
| 209 | op.add_option("--maxsize", dest="maxSizeMB", action="store", type="int", | ||
| 210 | nargs=1) | ||
| 211 | op.add_option("--noformat", dest="format", action="store_false", | ||
| 212 | default=True) | ||
| 213 | op.add_option("--onbiosdisk", dest="onbiosdisk") | ||
| 214 | op.add_option("--ondisk", "--ondrive", dest="disk") | ||
| 215 | op.add_option("--onpart", "--usepart", dest="onPart", action="callback", | ||
| 216 | callback=part_cb, nargs=1, type="string") | ||
| 217 | op.add_option("--recommended", dest="recommended", action="store_true", | ||
| 218 | default=False) | ||
| 219 | op.add_option("--size", dest="size", action="store", type="int", | ||
| 220 | nargs=1) | ||
| 221 | op.add_option("--start", dest="start", action="store", type="int", | ||
| 222 | nargs=1) | ||
| 223 | return op | ||
| 224 | |||
| 225 | def parse(self, args): | ||
| 226 | (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno) | ||
| 227 | |||
| 228 | pd = self.handler.PartData() | ||
| 229 | self._setToObj(self.op, opts, pd) | ||
| 230 | pd.lineno = self.lineno | ||
| 231 | if extra: | ||
| 232 | pd.mountpoint = extra[0] | ||
| 233 | if pd in self.dataList(): | ||
| 234 | warnings.warn(_("A partition with the mountpoint %s has already been defined.") % pd.mountpoint) | ||
| 235 | else: | ||
| 236 | pd.mountpoint = None | ||
| 237 | |||
| 238 | return pd | ||
| 239 | |||
| 240 | def dataList(self): | ||
| 241 | return self.partitions | ||
| 242 | |||
| 243 | class FC4_Partition(FC3_Partition): | ||
| 244 | removedKeywords = FC3_Partition.removedKeywords | ||
| 245 | removedAttrs = FC3_Partition.removedAttrs | ||
| 246 | |||
| 247 | def __init__(self, writePriority=130, *args, **kwargs): | ||
| 248 | FC3_Partition.__init__(self, writePriority, *args, **kwargs) | ||
| 249 | |||
| 250 | def part_cb (option, opt_str, value, parser): | ||
| 251 | if value.startswith("/dev/"): | ||
| 252 | parser.values.ensure_value(option.dest, value[5:]) | ||
| 253 | else: | ||
| 254 | parser.values.ensure_value(option.dest, value) | ||
| 255 | |||
| 256 | def _getParser(self): | ||
| 257 | op = FC3_Partition._getParser(self) | ||
| 258 | op.add_option("--bytes-per-inode", dest="bytesPerInode", action="store", | ||
| 259 | type="int", nargs=1) | ||
| 260 | op.add_option("--fsoptions", dest="fsopts") | ||
| 261 | op.add_option("--label", dest="label") | ||
| 262 | return op | ||
| 263 | |||
| 264 | class F9_Partition(FC4_Partition): | ||
| 265 | removedKeywords = FC4_Partition.removedKeywords | ||
| 266 | removedAttrs = FC4_Partition.removedAttrs | ||
| 267 | |||
| 268 | def __init__(self, writePriority=130, *args, **kwargs): | ||
| 269 | FC4_Partition.__init__(self, writePriority, *args, **kwargs) | ||
| 270 | |||
| 271 | def part_cb (option, opt_str, value, parser): | ||
| 272 | if value.startswith("/dev/"): | ||
| 273 | parser.values.ensure_value(option.dest, value[5:]) | ||
| 274 | else: | ||
| 275 | parser.values.ensure_value(option.dest, value) | ||
| 276 | |||
| 277 | def _getParser(self): | ||
| 278 | op = FC4_Partition._getParser(self) | ||
| 279 | op.add_option("--bytes-per-inode", deprecated=1) | ||
| 280 | op.add_option("--fsprofile") | ||
| 281 | op.add_option("--encrypted", action="store_true", default=False) | ||
| 282 | op.add_option("--passphrase") | ||
| 283 | return op | ||
| 284 | |||
| 285 | class F11_Partition(F9_Partition): | ||
| 286 | removedKeywords = F9_Partition.removedKeywords | ||
| 287 | removedAttrs = F9_Partition.removedAttrs | ||
| 288 | |||
| 289 | def _getParser(self): | ||
| 290 | op = F9_Partition._getParser(self) | ||
| 291 | op.add_option("--start", deprecated=1) | ||
| 292 | op.add_option("--end", deprecated=1) | ||
| 293 | return op | ||
| 294 | |||
| 295 | class F12_Partition(F11_Partition): | ||
| 296 | removedKeywords = F11_Partition.removedKeywords | ||
| 297 | removedAttrs = F11_Partition.removedAttrs | ||
| 298 | |||
| 299 | def _getParser(self): | ||
| 300 | op = F11_Partition._getParser(self) | ||
| 301 | op.add_option("--escrowcert") | ||
| 302 | op.add_option("--backuppassphrase", action="store_true", default=False) | ||
| 303 | return op | ||
| 304 | |||
| 305 | class F14_Partition(F12_Partition): | ||
| 306 | removedKeywords = F12_Partition.removedKeywords | ||
| 307 | removedAttrs = F12_Partition.removedAttrs | ||
| 308 | |||
| 309 | def _getParser(self): | ||
| 310 | op = F12_Partition._getParser(self) | ||
| 311 | op.remove_option("--bytes-per-inode") | ||
| 312 | op.remove_option("--start") | ||
| 313 | op.remove_option("--end") | ||
| 314 | return op | ||
