shithub: riscv

Download patch

ref: 7d1b9e39f7b1dac4c2ed6e3771585548ccd9e2d4
parent: caddc9a6ea0c8aeb2510ec9eda67eb4f2e82a00c
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Aug 5 10:30:48 EDT 2017

inst: don't hardcode /net/ether0, might have usb ethernet

--- a/rc/bin/inst/confignet
+++ b/rc/bin/inst/confignet
@@ -4,9 +4,12 @@
 
 switch($1){
 case checkready checkdone
+	netdev=/net/ether*
+	netdev=$netdev(1)
 	if(~ $netisfrom none){
+		netdev=/dev/null
 		confignet=done
-		export confignet
+		export confignet netdev
 		exit
 	}
 	if(~ $netisfrom ether){
@@ -14,15 +17,15 @@
 		$x=done
 		./config$netisfrom checkdone
 		confignet=$$x
-		export confignet
+		export confignet netdev
 		exit
 	}
 	confignet=ready
-	export confignet
+	export confignet netdev
 	exit
 
 case go
-	if(! test -d /net/ether0 >[2]/dev/null){
+	if(! test -d $netdev >[2]/dev/null){
 		echo
 		echo 'Could not find ethernet card.'
 		echo
--- a/rc/bin/inst/ndbsetup
+++ b/rc/bin/inst/ndbsetup
@@ -3,7 +3,7 @@
 # desc: setup network configuration
 # prereq: confignet copydist
 
-etheraddr=`{cat /net/ether0/addr >[2]/dev/null}
+etheraddr=`{cat $netdev/addr >[2]/dev/null}
 
 switch($1){
 case checkready checkdone
--- a/rc/bin/inst/startether
+++ b/rc/bin/inst/startether
@@ -5,25 +5,25 @@
 
 switch($1) {
 case checkready
-	if(isipdevup /net/ether0) {
+	if(isipdevup $netdev) {
 		startether=done
 		export startether
 	}
 
 case go
-	if(isipdevup /net/ether0)
+	if(isipdevup $netdev)
 		exit
 
 	log starting ethernet $ethermethod config
 	switch($ethermethod) {
 	case manual
-		ip/ipconfig -g $gwaddr ether /net/ether0 $ipaddr $ipmask >>[2]/srv/log
+		ip/ipconfig -g $gwaddr ether $netdev $ipaddr $ipmask >>[2]/srv/log
 	case dhcp
 		ip/ipconfig >>[2]/srv/log
 	}
 
 case checkdone
-	if(! isipdevup /net/ether0) {
+	if(! isipdevup $netdev) {
 		startether=notdone
 		export startether
 	}