61 lines · 1.2 KB · Text
RawDownload
#!/bin/rc# THIS FILE IS AUTOMATICALLY GENERATED# FROM /sys/src/cmd/venti/conf.rc.  DO NOT EDIT.# EDITED BY MYCROFTIV # the venti configuration is stored at the 248kB offset in the first index# partition and extends for at most 8 kB. rfork efn usage {	echo 'usage: venti/conf [-w] /dev/sdC0/v.arenas' >[1=2]	exit usage} wflag=nowhile(! ~ $#* 0 && ~ $1 -* && ! ~ $1 --){	switch($1){	case -w		wflag=yes	case *		usage	}	shift}if(~ $1 --)	shift if(~ $wflag no && ! ~ $#* 1)	usageif(~ $wflag yes && ! ~ $#* 1 2)	usage disk=$1if(! test -f $disk){	echo 'unknown disk' $1 >[1=2]	exit nodisk} fn sigexit {	#rm -f /tmp/venticonf.$pid} if(~ $wflag yes){	{echo venti config; cat $2} >/tmp/venticonf.$pid || exit oops	if(! test -s /tmp/venticonf.$pid){		echo 'config is empty; will not install' >[1=2]		exit emptyconfig	}	dd -quiet 1 -bs 1024 -count 8 -if $disk -iseek 248 \		>/tmp/_venticonf.old || exit backup	dd -quiet 1 -count 2 </dev/zero >> /tmp/venticonf.$pid || exit dd	dd -quiet 1 -bs 1024 -count 8 -if /tmp/venticonf.$pid \		-of $disk -trunc 0 -oseek 248 || exit dd2	exit 0} dd -quiet 1 -bs 1024 -count 8 -if $disk -iseek 248 |	zerotrunc >/tmp/venticonf.$pid sed 1d /tmp/venticonf.$pidexit ''