[PATCH 4/4] Make s390 shutdown/reboot/halt more like other systems.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We don't need to do the reipl signal passing game when we could just have
anaconda check a value and take the appropriate action at the end of
installation.  This also gets linuxrc.s390 out of the reboot game entirely
and makes it shutdown only in cases where anaconda exits abnormally.
---
 anaconda            |   18 ++++++++++++++++--
 iutil.py            |   13 -------------
 loader/linuxrc.s390 |   26 +++-----------------------
 3 files changed, 19 insertions(+), 38 deletions(-)

diff --git a/anaconda b/anaconda
index f404f14..be5785c 100755
--- a/anaconda
+++ b/anaconda
@@ -1088,9 +1088,23 @@ if __name__ == "__main__":
         # 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)
+            if iutil.isS390():
+                iutil.execWithRedirect("shutdown", [], searchPath=1)
+            else:
+                iutil.execWithRedirect("halt", [], searchPath=1)
         elif rc == 0 and anaconda.id.ksdata.reboot.action == KS_POWEROFF:
-            iutil.execWithRedirect("poweroff", [], searchPath=1)
+            if iutil.isS390():
+                iutil.execWithRedirect("shutdown", ["-P"], searchPath=1)
+            else:
+                iutil.execWithRedirect("poweroff", [], searchPath=1)
+    elif rc == 0 and iutil.isS390():
+        # Only perform these actions if anaconda properly finished up.  If
+        # anaconda has crashed, linuxrc.s390 will take care of how to shutdown
+        # the machine.
+        if anaconda.canReIPL:
+            iutil.execWithRedirect("shutdown", ["-r"], searchPath=1)
+        else:
+            iutil.execWithRedirect("shutdown", [], searchPath=1)
 
     sys.exit(rc)
 
diff --git a/iutil.py b/iutil.py
index 82a8f9a..15c7868 100644
--- a/iutil.py
+++ b/iutil.py
@@ -981,17 +981,6 @@ def reIPLonFCP(iplsubdev, reipl_path):
 
     return None
 
-
-def reIPLtrigger(anaconda):
-    if not isS390():
-        return
-    if anaconda.canReIPL:
-        log.info("reipl configuration successful => reboot")
-        os.kill(os.getppid(), signal.SIGUSR2)
-    else:
-        log.info("reipl configuration failed => halt")
-        os.kill(os.getppid(), signal.SIGUSR1)
-
 def reIPL(anaconda, loader_pid):
     instruction = _("After shutdown, please perform a manual IPL from the device "
                     "now containing /boot to continue installation")
@@ -1019,8 +1008,6 @@ def reIPL(anaconda, loader_pid):
     else:
         anaconda.canReIPL = False
 
-    reIPLtrigger(anaconda)
-
     # the final return is either None if reipl configuration worked (=> reboot),
     # or a two-item list with errorMessage and rebootInstr (=> shutdown)
     return message
diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390
index a3ee665..acde20f 100644
--- a/loader/linuxrc.s390
+++ b/loader/linuxrc.s390
@@ -93,24 +93,7 @@ function checkipv4()
 function doshutdown()
 {
     echo $"about to exec shutdown"
-    exec /sbin/shutdown
-    exit 0
-}
-
-function doreboot()
-{
-    if [ -e "/sys/firmware/reipl" ]; then
-        read REIPL_TYPE < /sys/firmware/reipl/reipl_type
-        echo "reipl_type=$REIPL_TYPE"
-        pushd /sys/firmware/reipl/$REIPL_TYPE >/dev/null 2>&1
-        for i in *; do
-            echo "$i=`cat $i`"
-        done
-        popd >/dev/null 2>&1
-    fi
-
-    echo $"about to exec shutdown -r"
-    exec /sbin/shutdown -r
+    exec /sbin/shutdown -h
     exit 0
 }
 
@@ -3054,17 +3037,14 @@ EOF
 
     echo -n $$ > /var/run/init.pid
 
-    # shutdown (halt) on SIGUSR1
-    trap doshutdown SIGUSR1
-    # reboot on SIGUSR2
-    trap doreboot SIGUSR2
-
     startinetd
 
     if [ -n "$RUNKS" ]; then
         /sbin/loader
     fi
 
+    # We only ever get here if anaconda exits abnormally, as usually anaconda
+    # handles calling shutdown for us.
     doshutdown
 
 fi # testing
-- 
1.6.5.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux