shithub: riscv

ref: 1a81fb86eb713f3e98a71522259d843e8cc14995
dir: /rc/bin/pc/setup.9fat/

View raw version
#!/bin/rc

rfork e
if(! ~ $#* 2) {
	echo 'usage: setup.9fat /dev/sdC0/9fat plan9.ini' >[1=2]
	exit usage
}

. /rc/bin/pc/defs
fat=$1
ini=$2
if(! test -f  $fat) {
	echo fat partition not found >[1=2]
	exit fat
}
if(! test -f $ini) {
	echo plan9.ini not found >[1=2]
	exit ini
}

if(pc/isfat $fat) {
	echo 'Already a FAT partition in '^$fat^'; ream it?'
	prompt 'ream 9fat' y n
	switch($rd) {
	case n
		exit
	}
}

disk/format -r 2 -d -b /386/pbs $fat /386/9load /386/9pcdisk
mount -c /srv/dos /n/9fat $fat
cp $ini /n/9fat/plan9.ini
unmount /n/9fat