summaryrefslogtreecommitdiffstats
path: root/scripts/lib/mic/3rdparty/pykickstart/commands/reboot.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/mic/3rdparty/pykickstart/commands/reboot.py')
-rw-r--r--scripts/lib/mic/3rdparty/pykickstart/commands/reboot.py79
1 files changed, 79 insertions, 0 deletions
diff --git a/scripts/lib/mic/3rdparty/pykickstart/commands/reboot.py b/scripts/lib/mic/3rdparty/pykickstart/commands/reboot.py
new file mode 100644
index 0000000000..391af14c22
--- /dev/null
+++ b/scripts/lib/mic/3rdparty/pykickstart/commands/reboot.py
@@ -0,0 +1,79 @@
1#
2# Chris Lumens <clumens@redhat.com>
3#
4# Copyright 2005, 2006, 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#
20from pykickstart.base import *
21from pykickstart.constants import *
22from pykickstart.errors import *
23from pykickstart.options import *
24
25class FC3_Reboot(KickstartCommand):
26 removedKeywords = KickstartCommand.removedKeywords
27 removedAttrs = KickstartCommand.removedAttrs
28
29 def __init__(self, writePriority=0, *args, **kwargs):
30 KickstartCommand.__init__(self, writePriority, *args, **kwargs)
31 self.action = kwargs.get("action", None)
32
33 def __str__(self):
34 retval = KickstartCommand.__str__(self)
35
36 if self.action == KS_REBOOT:
37 retval += "# Reboot after installation\nreboot\n"
38 elif self.action == KS_SHUTDOWN:
39 retval += "# Shutdown after installation\nshutdown\n"
40
41 return retval
42
43 def parse(self, args):
44 if self.currentCmd == "reboot":
45 self.action = KS_REBOOT
46 else:
47 self.action = KS_SHUTDOWN
48
49 return self
50
51class FC6_Reboot(FC3_Reboot):
52 removedKeywords = FC3_Reboot.removedKeywords
53 removedAttrs = FC3_Reboot.removedAttrs
54
55 def __init__(self, writePriority=0, *args, **kwargs):
56 FC3_Reboot.__init__(self, writePriority, *args, **kwargs)
57 self.op = self._getParser()
58
59 self.eject = kwargs.get("eject", False)
60
61 def __str__(self):
62 retval = FC3_Reboot.__str__(self).rstrip()
63
64 if self.eject:
65 retval += " --eject"
66
67 return retval + "\n"
68
69 def _getParser(self):
70 op = KSOptionParser()
71 op.add_option("--eject", dest="eject", action="store_true",
72 default=False)
73 return op
74
75 def parse(self, args):
76 FC3_Reboot.parse(self, args)
77 (opts, extra) = self.op.parse_args(args=args, lineno=self.lineno)
78 self._setToSelf(self.op, opts)
79 return self