When anaconda halts, return a code so init knows what to do (#525615).
Also, do the appropriate shutdown/halt/reboot kickstart action at the end of
anaconda as well.
---
anaconda | 31 ++++++++++++++++++++++---------
1 files changed, 22 insertions(+), 9 deletions(-)
+ rc = 0
+
try:
anaconda.intf.run(anaconda)
except SystemExit, code:
- anaconda.intf.shutdown()
-
- if anaconda.isKickstart and anaconda.id.ksdata.reboot.eject:
- for drive in anaconda.id.storage.devicetree.devices.values():
- if drive.type != "cdrom":
- continue
-
- log.info("attempting to eject %s" % drive.path)
- drive.eject()
+ rc = code
+ anaconda.intf.shutdown()
del anaconda.intf
+ if anaconda.isKickstart:
+ from pykickstart.constants import KS_HALT, KS_POWEROFF
+
+ if anaconda.id.ksdata.reboot.eject:
+ for drive in anaconda.id.storage.devicetree.getDevicesByType("c drom"):
+ log.info("attempting to eject %s" % drive.path)
+ drive.eject()
+
+ # Only perform these actions if anaconda properly finished up. The
+ # default action for anaconda is to reboot, so we don't need to do
+ # that here.
+ if rc == 0 and anaconda.id.ksdata.reboot.action == KS_HALT:
+ iutil.execWithRedirect("halt", [], searchPath=1)
+ elif rc == 0 and anaconda.id.ksdata.reboot.action == KS_POWEROFF:
+ iutil.execWithRedirect("poweroff", [], searchPath=1)
+
+ sys.exit(rc)
+
# vim:tw=78:ts=4:et:sw=4
--
1.6.5.1
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
12-01-2009, 08:32 PM
Chris Lumens
When anaconda halts, return a code so init knows what to do (#525615).
Also, do the appropriate shutdown/halt/reboot kickstart action at the end of
anaconda as well.
---
anaconda | 31 ++++++++++++++++++++++---------
1 files changed, 22 insertions(+), 9 deletions(-)
+ rc = 0
+
try:
anaconda.intf.run(anaconda)
except SystemExit, code:
- anaconda.intf.shutdown()
-
- if anaconda.isKickstart and anaconda.id.ksdata.reboot.eject:
- for drive in anaconda.id.storage.devicetree.devices.values():
- if drive.type != "cdrom":
- continue
-
- log.info("attempting to eject %s" % drive.path)
- drive.eject()
+ rc = code
+ anaconda.intf.shutdown()
del anaconda.intf
+ if anaconda.isKickstart:
+ from pykickstart.constants import KS_HALT, KS_POWEROFF
+
+ if anaconda.id.ksdata.reboot.eject:
+ for drive in anaconda.id.storage.devicetree.getDevicesByType("c drom"):
+ log.info("attempting to eject %s" % drive.path)
+ drive.eject()
+
+ # Only perform these actions if anaconda properly finished up. The
+ # default action for anaconda is to reboot, so we don't need to do
+ # that here.
+ if rc == 0 and anaconda.id.ksdata.reboot.action == KS_HALT:
+ iutil.execWithRedirect("halt", [], searchPath=1)
+ elif rc == 0 and anaconda.id.ksdata.reboot.action == KS_POWEROFF:
+ iutil.execWithRedirect("poweroff", [], searchPath=1)
+
+ sys.exit(rc)
+
# vim:tw=78:ts=4:et:sw=4
--
1.6.5.1
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list