summaryrefslogtreecommitdiffstats
path: root/rescue.py
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2006-03-03 19:10:07 +0000
committerDavid Cantrell <dcantrell@redhat.com>2006-03-03 19:10:07 +0000
commitb8886ea358afc3903784742f4c3eb31054af0192 (patch)
tree47e9d294e4aa9ae62241736bd65bbef292d7a4c3 /rescue.py
parent19143c92472f171b7ba4a5407bca4b10dc1696be (diff)
downloadanaconda-b8886ea358afc3903784742f4c3eb31054af0192.tar.gz
anaconda-b8886ea358afc3903784742f4c3eb31054af0192.tar.xz
anaconda-b8886ea358afc3903784742f4c3eb31054af0192.zip
* rescue.py: Added runShell() to handle spawning the tty1 shell for
rescue mode and set the controlling tty (#182222). * loader2/init.c: Do not disable Ctrl+C, Ctrl+Z, and friends if we're starting in rescue mode. Set controlling tty before dup2() calls.
Diffstat (limited to 'rescue.py')
-rw-r--r--rescue.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/rescue.py b/rescue.py
index a7a8c80ab..e2855aae5 100644
--- a/rescue.py
+++ b/rescue.py
@@ -24,6 +24,8 @@ import isys
import iutil
import fsset
import shutil
+import fcntl
+import termios
from rhpl.translate import _
@@ -162,7 +164,15 @@ def startNetworking(network, intf):
f.close()
-
+def runShell():
+ shpid = os.fork()
+ if shpid == 0:
+ os.setsid()
+ fcntl.ioctl(0, termios.TIOCSCTTY)
+ os.execv("/bin/sh", ["-/bin/sh"])
+ else:
+ os.waitpid(shpid, 0)
+
def runRescue(instPath, mountroot, id):
for file in [ "services", "protocols", "group", "joe", "man.config",
@@ -245,7 +255,7 @@ def runRescue(instPath, mountroot, id):
print _("When finished please exit from the shell and your "
"system will reboot.")
print
- os.system("/bin/sh")
+ runShell()
sys.exit(0)
# lets create some devices
@@ -281,7 +291,7 @@ def runRescue(instPath, mountroot, id):
print _("When finished please exit from the shell and your "
"system will reboot.")
print
- os.execv("/bin/sh", [ "-/bin/sh" ])
+ runShell()
elif rc == string.lower(_("Read-Only")):
readOnly = 1
else:
@@ -449,5 +459,5 @@ def runRescue(instPath, mountroot, id):
print _("When finished please exit from the shell and your "
"system will reboot.")
print
- os.system("/bin/sh")
+ runShell()
sys.exit(0)