shithub: riscv

Download patch

ref: 8be7f27b758ef9ef818f68db0d8bcb7b038eae0e
parent: 9c5fc1ce37db16f16b1b351852aa493ac002af2f
author: Ori Bernstein <ori@eigenstate.org>
date: Sat May 18 12:35:09 EDT 2024

inst: add hidden 'gefs' file system type option

one day it will graduate to experimental

--- a/rc/bin/inst/configfs
+++ b/rc/bin/inst/configfs
@@ -16,7 +16,7 @@
 	echo '	cwfs64x	the cached-worm file server'
 	echo '	hjfs	the new 9front file server (experimental!)'
 	echo
-	prompt -d cwfs64x 'File system' cwfs64x hjfs
+	prompt -d cwfs64x -h gefs 'File system' cwfs64x hjfs
 	fstype=$rd
 	export fstype
 }
--- a/rc/bin/inst/defs
+++ b/rc/bin/inst/defs
@@ -23,6 +23,7 @@
 
 fn prompt {
 	def=()
+	hide=()
 	what=()
 	if(~ $1 -d && ! ~ $#* 1){
 		def=$2
@@ -29,6 +30,11 @@
 		shift
 		shift
 	}
+	if(~ $1 -h && ! ~ $#* 1){
+		hide=$2
+		shift
+		shift
+	}
 
 	optstr=()
 	if(~ $1 -w && ! ~ $#* 1){
@@ -93,7 +99,7 @@
 				if(! ~ $rd '')
 					okay=yes
 			case *
-				if(~ $rd $opts)
+				if(~ $rd $opts $hide)
 					okay=yes
 			}
 		}
--- a/rc/bin/inst/mountfs
+++ b/rc/bin/inst/mountfs
@@ -8,6 +8,8 @@
 	exec ./mountcwfs $*
 case hjfs
 	exec ./mounthjfs $*
+case gefs
+	exec ./mountgefs $*
 case *
 	mountfs=notdone
 	export mountfs
--- /dev/null
+++ b/rc/bin/inst/mountgefs
@@ -1,0 +1,84 @@
+#!/bin/rc
+
+# desc: choose and mount file system partition
+
+sname=gefs.newfs
+userfile='-1:adm:adm:'^$user^'
+0:none::
+1:tor:tor:
+2:'^$user^':'^$user:^'
+10000:sys::'^$user^'
+10001:map:map:
+10002:doc::
+10003:upas:upas:'^$user^'
+10004:font::
+10005:bootes:bootes:'
+
+switch($1){
+case go
+	echo
+	echo Please choose your $fstype partition
+	echo
+
+	files=(`{ls /dev/sd*/fs* >[2]/dev/null})
+	if(! ~ $#files 0)
+		ls -l $files
+	echo
+	if(~ $#files 1)
+		default=(-d $files)
+	if not
+		default=()
+	prompt $default 'Gefs partition' $files
+	fs=$rd
+	export fs
+	fsflags=(-A)
+	export fsflags
+
+	ream=no
+	if(! ~ $fstype `{fstype $fs})
+		ream=yes
+	prompt -d $ream 'Ream the filesystem?' yes no
+	ream=$rd
+
+	log Starting $fstype file server for $fs
+	unmount /n/newfs >[2]/dev/null
+	echo halt >>/srv/$sname.cmd >[2]/dev/null
+	rm -f /srv/$sname /srv/$sname.cmd
+
+	if(~ $ream yes){
+		echo gefs -n $sname -r $user $fsflags -SAf $fs
+		gefs -n $sname -r $user $fsflags -SAf $fs
+	}
+	gefs -n $sname $fsflags -SAf $fs
+
+	log Mounting $fstype file server for $fs
+	while(! logprog mount -c /srv/$sname /n/newfs %main)
+		sleep 2
+	while(! logprog mount -c /srv/$sname /n/newfs.adm %adm)
+		sleep 2
+	log Configuring $fstype file server for $fs
+	echo $"userfile > /n/newfs.adm/users
+	echo sync >>/srv/$sname.cmd
+	echo users >>/srv/$sname.cmd
+	sleep 1
+	for(dir in adm dist usr){
+		logprog mkdir /n/newfs/$dir
+		usrgrp = sys
+		if(~ $dir adm)
+			usrgrp = adm
+		logprog chgrp $usrgrp /n/newfs/$dir
+		logprog chgrp -u $usrgrp /n/newfs/$dir
+	}
+
+case checkready checkdone
+	if(! ~ $fstype '' && ~ $#fs 1 && test -f $fs){
+		if(test -f /srv/$sname && test -d /n/newfs/dist){
+			mountfs=done
+			export mountfs
+			exit
+		}
+	}
+	mountfs=ready
+	export mountfs
+	exit
+}
--- a/rc/bin/inst/prepdisk
+++ b/rc/bin/inst/prepdisk
@@ -7,7 +7,7 @@
 	switch($fstype){
 	case cwfs cwfs64 cwfs64x
 		echo -a 9fat -a nvram -a fscache -a fsworm -a other
-	case hjfs
+	case hjfs gefs
 		echo -a 9fat -a nvram -a fs
 	}
 }