#!/bin/sh

# groove disk-type unit ...

myname="`basename $0`"

case $# in
1)
	echo "usage: $myname disk-type unit ..." 1>&2
	exit 1
	;;
esac

partitions="c a b d e f g h"

#
# file-system layout:
#
#     a    /
#     b    swap+dump
#     c    whole disk
#     d    tmp
#     e    f+g
#     f    usr
#     g    udir
#     h    unused

# so we have file-systems for /, tmp, usr and udir
fs="a d f g"

disk="$1" ; shift

for unit
do
	case "$disk" in
	rz57)
		dev=/dev/rrz
		a="      0  106500"	# /	50Mb
		b=" 106500  272640"	# swap 128Mb
		c="      0 1954050"
		d=" 379140   42600"	# tmp   20Mb
		e=" 421740 1532310"	# f+g  740Mb
		f=" 421740 766800"	# usr  370Mb
		g="1188540 765510"	# udir 370Mb
		h="0 0"
		;;

	rz58)
		dev=/dev/rrz
		a="      0  127500"	# /	50Mb
		b=" 127500  326400"	# swap 150Mb
		c="      0 2698061"
		d=" 453900   40800"	# tmp	20Mb
		e=" 494700 2203361"	# f+g  1.1Gb
		f=" 494700 1101600"	# usr  550Mb
		g="1596300 1101761"	# udir 550Mb
		h="      0       0"
		;;

	*)
		echo "$myname: Unknown disk type \"$disk\"." 1>&2
		exit 1
		;;
	esac

	for p in $partitions
	do
		sizes="`eval echo \$\`eval echo $p\``"

		case "$sizes" in
		"")
			continue
			;;
		esac

		echo "chpt -p$p $sizes $dev${unit}c || exit 1"
	done | sh -x

	for p in $fs
	do
		echo "newfs -v $dev${unit}$p $disk || exit 1"
	done | sh -x
done


© 1998, Boyd Roberts: boyd@fr.inter.net