summaryrefslogtreecommitdiffstats
path: root/loader2
diff options
context:
space:
mode:
authorJeremy Katz <katzj@redhat.com>2006-02-09 03:53:50 +0000
committerJeremy Katz <katzj@redhat.com>2006-02-09 03:53:50 +0000
commit4d86d214e743f9588704f715527cdf2329b6d40e (patch)
tree86f8e5728eda8aa7664f0cadc03cbaa0a800876c /loader2
parent57e7f2ec73fe1b0326870f7999fb8361a1e35516 (diff)
downloadanaconda-4d86d214e743f9588704f715527cdf2329b6d40e.tar.gz
anaconda-4d86d214e743f9588704f715527cdf2329b6d40e.tar.xz
anaconda-4d86d214e743f9588704f715527cdf2329b6d40e.zip
2006-02-08 Jeremy Katz <katzj@redhat.com>
* loader2/loader.c (doShell): Add support for exec'ing busybox in msh mode if it's present on suspend. We won't include it in standard initrds, but for debugging, the ability to chain multiple initrds is going to be beautiful.
Diffstat (limited to 'loader2')
-rw-r--r--loader2/loader.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/loader2/loader.c b/loader2/loader.c
index f3fd40ba6..f3408d93f 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -126,6 +126,20 @@ void doSuspend(void) {
exit(1);
}
+void doShell(void) {
+ /* this lets us debug the loader just by having a second initramfs
+ * containing /sbin/busybox */
+ int child, status;
+
+ newtSuspend();
+ if (!(child = fork())) {
+ execl("/sbin/busybox", "msh", NULL);
+ _exit(1);
+ }
+ waitpid(child, &status, 0);
+ newtResume();
+}
+
void startNewt(int flags) {
if (!newtRunning) {
char *buf = sdupprintf(_("Welcome to %s"), getProductName());
@@ -139,6 +153,8 @@ void startNewt(int flags) {
newtRunning = 1;
if (FL_TESTING(flags))
newtSetSuspendCallback((void *) doSuspend, NULL);
+ else if (!access("/sbin/busybox", X_OK)) {
+ newtSetSuspendCallback((void *) doShell, NULL);
}
}