shithub: 9ferno

Download patch

ref: 84b2922214d8d61e6dfd5b28542bcfdb56bceba2
parent: 699f654ba58d833dc5c69810bff4de2011a52bf3
author: 9ferno <gophone2015@gmail.com>
date: Fri Aug 13 11:37:31 EDT 2021

provide a fallback shell console when /dis/init fails

--- a/os/init/disinit.b	Wed Aug 11 23:15:11 2021
+++ b/os/init/disinit.b	Fri Aug 13 11:37:31 2021
@@ -59,12 +59,13 @@
 	sh := load Sh "/dis/sh.dis";
 	(s, nil) := sys->stat("/dis/init");
 	if(s == 0){
-		sys->print("spawn sh -n /dis/init\n");
+		sys->print("spawn sh -x -n /dis/init\n");
 		spawn sh->init(nil, "sh" :: "-x" :: "-n" :: "/dis/init" :: nil);
-	} else {
-		sys->fprint(stderr, "init: cannot find /dis/init: %r\n");
-		spawn sh->init(nil, "-n" :: nil);
 	}
+	# fallback console
+	sh1 := load Sh "/dis/sh.dis";
+	sys->print("sh -x -n\n");
+	sh1->init(nil, "sh" :: "-x" :: "-n" :: nil);
 }
 
 srv()