:
#!/bin/sh
# @(#) $Id: scogen.sh,v 1.6 1991/12/09 16:58:18 ronald Exp $
# simple script to generate a set of custom(ADM) format diskettes
PATH=/usr/local/bin:/bin:/usr/bin:/etc:/mnt/bin
dotflag=
nflag=
while
	case "$1" in
		-n) nflag=-n; true;;
		-.) dotflag=-.; true;;
		*) false;;
	esac
do
	shift
done
test "$dotflag" || cd /
set=$1
die() { echo "$*" >&2; exit 1; }
test $# != 1 && die "usage: `basename $0` package-name"
test ./etc/perms/$1 || die "/etc/perms/$1 not found"
trap "cd /tmp ; rm -f $1.[0-9][0-9] $1.[0-9][0-9].log; exit 0" 1 2 3 15
# add -p to fixperm args if under SCO UNIX.
(set -x; fixperm -c -v ./etc/perms/$1 2>&1) | grep -v 'not fixed stack'
(set -x; scopaksiz $1 | (trap '' 1 2 3 15 ; ed - ./etc/perms/$1))
vols="`sed -n	-e '/^[ 	]*#/d'				\
		-e 's/.*[ 	]\([0-9][0-9]\)$/ \1/p'		\
		./etc/perms/$1 | sort -u`"
echo About to generate volumes $vols
for vol in $vols ; do
    (set -x; scovol $1 $vol |
     scotar $nflag 2>&1 1>/tmp/$1.$vol | tee /tmp/$1.$vol.log)
done
echo Volumes $vols of $1 are in /tmp/$1.n with logfiles in /tmp/$1.n.log
