Rename command objects by inserting an underscore between the version part
[pykickstart.git] / pykickstart / commands / reboot.py
blob63fe7a107264fb4574b16efa775da9e21633b4b5
2 # Chris Lumens <clumens@redhat.com>
4 # Copyright 2005, 2006, 2007 Red Hat, Inc.
6 # This software may be freely redistributed under the terms of the GNU
7 # general public license.
9 # You should have received a copy of the GNU General Public License
10 # along with this program; if not, write to the Free Software
11 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
13 from pykickstart.base import *
14 from pykickstart.constants import *
15 from pykickstart.errors import *
16 from pykickstart.options import *
18 from rhpl.translate import _
19 import rhpl.translate as translate
21 translate.textdomain("pykickstart")
23 class FC3_Reboot(KickstartCommand):
24 def __init__(self, writePriority=0, action=KS_WAIT):
25 KickstartCommand.__init__(self, writePriority)
26 self.action = action
28 def __str__(self):
29 if self.action == KS_REBOOT:
30 return "# Reboot after installation\nreboot\n"
31 elif self.action == KS_SHUTDOWN:
32 return "# Shutdown after installation\nshutdown\n"
34 def parse(self, args):
35 if self.currentCmd == "reboot":
36 self.action = KS_REBOOT
37 else:
38 self.action = KS_SHUTDOWN
40 class FC6_Reboot(FC3_Reboot):
41 def __init__(self, writePriority=0, action=KS_WAIT, eject=False):
42 FC3_Reboot.__init__(self, writePriority, action=action)
43 self.eject = eject
45 def __str__(self):
46 retval = ""
48 if self.action == KS_REBOOT:
49 retval = "# Reboot after installation\nreboot\n"
50 elif self.action == KS_SHUTDOWN:
51 retval = "# Shutdown after installation\nshutdown\n"
53 if self.eject:
54 retval += " --eject"
56 return retval
58 def parse(self, args):
59 if self.currentCmd == "reboot":
60 self.action = KS_REBOOT
61 else:
62 self.action = KS_SHUTDOWN
64 op = KSOptionParser(lineno=self.lineno)
65 op.add_option("--eject", dest="eject", action="store_true",
66 default=False)
68 (opts, extra) = op.parse_args(args=args)
69 self._setToSelf(op, opts)