56 lines · 1.1 KB · Text
RawDownload
#!/bin/rc# DANGER! This script obliterates fossils and resets them to a different score# fosreset rootscore [fossil] [venti] rfork escore=$1if(! ~ $score ???????????????????????????*){	echo $1 is not a fossil root score	exit no.rootscore}fossil=$2if(~ $fossil ''){	fossil=`{ls /dev/fs/fossil* /dev/sd*/fossil* >[2]/dev/null}	if(~ $fossil ''){		echo 'no fossil partition found, please specify a target fossil' >[1=2]		exit no.fossil	}	if(! ~ $#fossil 1){		echo 'found multiple partitions named fossil, please specify which is the target' >[1=2]		exit toomany.fossils}if(! ~ $3 '')	venti=$3if(~ $venti ''){	echo 'please set a venti target for your fossil!'	exit no.venti}if(~ $fossil tcp*){	echo not disk	exit no.disk} if(! test -e /bin/foshalt)	fshaltif not	foshaltkill fossil |rcsleep 1Kill fossil |rcsleep 2slay fossil |rcsleep 1stillhere=`{ps |grep fossil}if(! ~ $stillhere ''){	echo 'fossil processes still running! exiting'	exit fossilzombie} if(~ $score vac*)	score=`{echo $score |sed 's/vac://g'}if(test -e /bin/flfmt)	flfmt -y -v $score $fossilif not	fossil/flfmt -y -v $score $fossil exit ''