Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Ubuntu User (http://www.linux-archive.org/ubuntu-user/)
-   -   When anaconda halts, return a code so init knows what to do (#525615). (http://www.linux-archive.org/ubuntu-user/285154-when-anaconda-halts-return-code-so-init-knows-what-do-525615-a.html)

Chris Lumens 11-23-2009 07:40 PM

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(-)

diff --git a/anaconda b/anaconda
index 785fa7e..caa6dbc 100755
--- a/anaconda
+++ b/anaconda
@@ -1062,19 +1062,32 @@ if __name__ == "__main__":
else:
kickstart.setSteps(anaconda)

+ 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

Chris Lumens 12-01-2009 08:32 PM

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(-)

diff --git a/anaconda b/anaconda
index 55eaf8d..f404f14 100755
--- a/anaconda
+++ b/anaconda
@@ -1066,19 +1066,32 @@ if __name__ == "__main__":
else:
kickstart.setSteps(anaconda)

+ 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


All times are GMT. The time now is 07:41 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.