[PATCH] add rescue command to pykickstart

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All needed changes to enable rescue command in kickstart.

 pykickstart/commands/__init__.py |    2 +-
 pykickstart/commands/rescue.py   |   62 ++++++++++++++++++++++++++++++++++++++
 pykickstart/handlers/control.py  |    1 +
 3 files changed, 64 insertions(+), 1 deletions(-)

diff --git a/pykickstart/commands/__init__.py b/pykickstart/commands/__init__.py
index ce27570..a98315d 100644
--- a/pykickstart/commands/__init__.py
+++ b/pykickstart/commands/__init__.py
@@ -21,6 +21,6 @@ import authconfig, autopart, autostep, bootloader, clearpart, device
 import deviceprobe, displaymode, dmraid, driverdisk, firewall, firstboot
 import ignoredisk, interactive, iscsi, iscsiname, key, keyboard, lang
 import langsupport, lilocheck, logging, logvol, mediacheck, method, monitor
-import mouse, multipath, network, partition, raid, reboot, repo, rootpw
+import mouse, multipath, network, partition, raid, reboot, repo, rescue, rootpw
 import selinux, services, skipx, timezone, updates, upgrade, user, vnc
 import volgroup, xconfig, zerombr, zfcp
diff --git a/pykickstart/commands/rescue.py b/pykickstart/commands/rescue.py
new file mode 100644
index 0000000..87d5e36
--- /dev/null
+++ b/pykickstart/commands/rescue.py
@@ -0,0 +1,62 @@
+#
+# Alexander Todorov <atodorov@xxxxxxxxxx>
+#
+# Copyright 2008 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use, modify,
+# copy, or redistribute it subject to the terms and conditions of the GNU
+# General Public License v.2.  This program is distributed in the hope that it
+# will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the
+# implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat
+# trademarks that are incorporated in the source code or documentation are not
+# subject to the GNU General Public License and may only be used or replicated
+# with the express permission of Red Hat, Inc. 
+#
+from pykickstart.base import *
+from pykickstart.errors import *
+from pykickstart.options import *
+
+import gettext
+_ = lambda x: gettext.ldgettext("pykickstart", x)
+
+class F10_Rescue(KickstartCommand):
+    def __init__(self, writePriority=0, nomount=False, romount=False):
+        KickstartCommand.__init__(self, writePriority)
+        self.op = self._getParser()
+
+        self.rescue = False
+        self.nomount = nomount
+        self.romount = romount
+
+    def __str__(self):
+        if self.rescue:
+            retval = "rescue"
+
+            if self.nomount:
+               retval += " --nomount"
+            if self.romount:
+               retval += " --romount"
+
+            return "# Start rescue mode\n%s\n" % retval
+	else:
+            return ""
+
+    def _getParser(self):
+        op = KSOptionParser(lineno=self.lineno)
+        op.add_option("--nomount", dest="nomount", action="store_true", default=False)
+        op.add_option("--romount", dest="romount", action="store_true", default=False)
+        return op
+
+    def parse(self, args):
+        (opts, extra) = self.op.parse_args(args=args)
+
+        if opts.nomount and opts.romount:
+            raise KickstartValueError, formatErrorMsg(self.lineno, msg=_("Only one of --nomount and --romount may be specified for rescue command."))
+
+        self._setToSelf(self.op, opts)
+        self.rescue = True
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index 1278fc1..afb909b 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -449,6 +449,7 @@ commandMap = {
         "raid": raid.F9_Raid,
         "reboot": reboot.FC6_Reboot,
         "repo": repo.F8_Repo,
+        "rescue": rescue.F10_Rescue,
         "rootpw": rootpw.F8_RootPw,
         "selinux": selinux.FC3_SELinux,
         "services": services.FC6_Services,
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux