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
.options
import *
17 class FC3_Firstboot(KickstartCommand
):
18 def __init__(self
, writePriority
=0, firstboot
=None):
19 KickstartCommand
.__init
__(self
, writePriority
)
20 self
.firstboot
= firstboot
23 if self
.firstboot
is None:
26 if self
.firstboot
== FIRSTBOOT_SKIP
:
27 return "firstboot --disable\n"
28 elif self
.firstboot
== FIRSTBOOT_DEFAULT
:
29 return "# Run the Setup Agent on first boot\nfirstboot --enable\n"
30 elif self
.firstboot
== FIRSTBOOT_RECONFIG
:
31 return "# Run the Setup Agent on first boot\nfirstboot --reconfig\n"
33 def parse(self
, args
):
34 op
= KSOptionParser(lineno
=self
.lineno
)
35 op
.add_option("--disable", "--disabled", dest
="firstboot",
36 action
="store_const", const
=FIRSTBOOT_SKIP
)
37 op
.add_option("--enable", "--enabled", dest
="firstboot",
38 action
="store_const", const
=FIRSTBOOT_DEFAULT
)
39 op
.add_option("--reconfig", dest
="firstboot", action
="store_const",
40 const
=FIRSTBOOT_RECONFIG
)
42 (opts
, extra
) = op
.parse_args(args
=args
)
43 self
.firstboot
= opts
.firstboot