[PATCH] Add rescue command to kickstart

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

 



Hello,
this patch adds a rescue command to kickstart. Syntax is:
rescue [--nomount|--romount]

See anaconda-devel-list for more info:
https://www.redhat.com/archives/anaconda-devel-list/2008-July/msg00074.html

---
Alexander.
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..5929a40
--- /dev/null
+++ b/pykickstart/commands/rescue.py
@@ -0,0 +1,60 @@
+#
+# 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.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..f6bf738 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,
_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/kickstart-list

[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux