shithub: rc

Download patch

ref: 51d90b621f61c838b10b5d49598b6668559e3c2e
parent: ab56f96c115e380768bb57e091155d35381ec20c
author: sl <sl@x1yg3>
date: Sun Jul 6 18:47:31 EDT 2025

add mountcwfs

--- a/INDEX
+++ b/INDEX
@@ -36,6 +36,7 @@
 mkufont - Borrow from other fonts to create unicode.font (by cinap_lenrek)
 ml - Print commands to search or read mailing list archives.
 mlchmod - chmod mailing list messages so they can be read by remote 9p users.
+mountcwfs - Bind over /bin/inst/mountcwfs and run the installer for cwfs without the dump.
 n700 - Set preferred X11 mouse acceleration for Lenovo N700 wireless mouse.
 nauth - rcpu to or rimport from auth.inri.net
 nn - run webcookies/webfs, populate factotum from secstore, perform some binds, run plumber.
--- /dev/null
+++ b/mountcwfs
@@ -1,0 +1,96 @@
+#!/bin/rc
+
+# desc: choose and mount file system partition
+
+sname=cwfs.newfs
+
+switch($1){
+case go
+	echo
+	echo Please choose your $fstype partitions
+	echo
+
+	files=(`{ls /dev/sd*/fsmain* /dev/fs/fsmain* >[2]/dev/null})
+	if(! ~ $#files 0)
+		ls -l $files
+	echo
+	if(~ $#files 1)
+		default=(-d $files)
+	if not
+		default=()
+	prompt $default 'Cwfs main partition' $files
+	fs=$rd
+	export fsother
+
+	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){
+		if(! test -f /tmp/fsconfig){
+			{
+				echo service cwfs
+				echo config $fs
+				echo noauth
+				echo filsys main ($fs)
+				echo ream main
+				echo end
+			} >/tmp/fsconfig
+		}
+		echo 'Reaming filesystem'
+		if(! $fstype -n $sname -f $fs -c </tmp/fsconfig){
+			mountfs=ready
+			export mountfs
+			exit oops
+		}
+	}
+	if not {
+		echo 'Entering manual configuration mode. when done, type end'
+		if(! $fstype -n $sname -f $fs -c){
+			mountfs=ready
+			export mountfs
+			exit oops
+		}
+	}
+
+	log Configuring $fstype file server for $fs
+	{
+		echo noattach
+		echo allow
+		echo users default
+		echo cfs main
+		echo create /adm adm adm 775 d
+		echo create /adm/users adm adm 664
+		echo create /dist sys sys 775 d
+		echo create /usr sys sys 775 d
+		echo newuser $user
+		echo newuser adm +$user
+		echo newuser sys +$user
+		echo newuser upas +$user
+		echo noattach
+		sleep 2
+	} >>/srv/$sname.cmd
+
+	log Mounting $fstype file server for $fs
+	while(! logprog mount -c /srv/$sname /n/newfs)
+		sleep 2
+
+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
+}
--