code: 9ferno

Download patch

ref: 704bb70108b5c1d673ba28c8f16b7b63207fce49
parent: b2509ed78c437b8f49637c39279b8fb0a417e826
author: 9ferno <gophone2015@gmail.com>
date: Sun Oct 24 03:54:56 EDT 2021

skip authentication when noauth is set

--- a/dis/init
+++ b/dis/init
@@ -148,7 +148,7 @@
 		x=`{read}
 		echo bind ether /net/ether0 > /net/ipifc/^$x^/ctl
 	}
-	ip/dhcp -p /net/ipifc/$x
+	ip/dhcp -d -p /net/ipifc/$x
 	for tuple in `{cat /net/ndb}{
 		(name value)=${split '=' $tuple}
 		if{~ $name sys}{
@@ -167,9 +167,24 @@
 	cat /dev/sysname
 }
 
+# 9front uses the $bootargs to gather
+#	the ether device to bind
+#	the ether device ip address
+#	fs address
+#	port
+# 9ferno takes the following shortcuts, for now
+#	hardcoded the ether device to be /net/ether0
+#	use $bootargs for the ethernet ip address, mask and gateway
+#	use $fs for the fs address
+#	use $noauth to avoid authentication
+#	hardcoded the ports
 fn mountfs {
 	if{! ~ $"fs ''}{
-		mount -v -c tcp!$"fs!6666 /n/remote
+		if{~ $"noauth 1}{
+			mount -A -v -c tcp!$"fs!17001 /n/remote
+		}{
+			mount -v -c tcp!$"fs!6666 /n/remote
+		}
 		bind /n/remote/dis /dis
 		bind -c -a /n/remote/ /
 	}
@@ -192,6 +207,7 @@
 			usedhcp
 			mountfs
 		}{
+			# check the notes above for details
 			echo binding /net/ether0
 			<>/net/ipifc/clone {
 				x=`{read}
@@ -208,6 +224,10 @@
 		sysname=`{ndb/query ether `{cat '#l0/ether0/addr'} sys}
 	}
 
+	# for machine specific initialization
+	#	use /lib/init/$sysname
+	#	special networking setup, disk setup
+	#	avoids putting machine specific stuff in devroot
 	and {! ~ $"sysname ''} {
 			ftest -f /lib/init/$sysname }{
 			/lib/init/$sysname
--- a/lib/init/bootcd
+++ b/lib/init/bootcd
@@ -1,10 +1,8 @@
 #!/dis/sh
 
 load std
-# machine specific initialization
-#	called by /dis/init when sysname=bootcd
-#	special networking setup, disk setup
-#	avoids putting machine specific stuff in devroot
+# this is the most generic boot script when booting from the cd
+#	sets up the network with dhcp and is done
 
 <>/net/ipifc/clone {
 	x=`{read}
--- a/lib/sh/daemon
+++ b/lib/sh/daemon
@@ -15,7 +15,7 @@
 
 # until I sort out the authentication
 #	but this is killing /mnt/keys, so do not start it here
-# styxlisten -A 'tcp!*!17001' export /
+styxlisten -A 'tcp!*!17001' export /
 
 ls -l /mnt/keys
 netstat
--- a/os/init/disinit.b
+++ b/os/init/disinit.b
@@ -65,9 +65,9 @@
 	sh := load Sh "/dis/sh.dis";
 	(s, nil) := sys->stat("/dis/init");
 	if(s == 0){
-		sys->print("spawn sh -x -n /dis/init\n");
+		sys->print("spawn sh /dis/init\n");
 		{
-			sh->init(nil, "sh" :: "-x" :: "-n" :: "/dis/init" :: nil);
+			sh->init(nil, "sh" :: "/dis/init" :: nil);
 		} exception e {
 			"*" =>
 				sys->fprint(stderr, "dis/init status: %s\nStarting fallback shell\n", e);