:
# $Id: mkvfloppy.sh,v 1.3 2003/06/05 22:31:28 rwb Exp $ 
# SCCSID(@(#)mkvfloppy.sh	1.7) Modified 00:38:17 12/17/99
#****************************************************************************/
#	Copyright (c) 1987-1999 TreLOS, Inc.
#****************************************************************************/
#
#  Create virtual floppy disk.
#  This is done by copying an already formatted virtual floppy disk.
#  The optional "-s" option makes it a system disk (i.e. bootable).
#

# Get the STATICMERGE, VARMERGE and DOSWINBINDIR settings.
. /etc/mrgssv.sh

KOPT="+kmerge-internal-config:snap"

unset ONUNIX

Error()
{
	# The script "set_nls.sh" sets MFILE
	. $STATICMERGE/set_nls.sh
	# DM is the domain for messages for this script.
	DM="LCC.MERGE.UNIX.MKVFLP"
	lmfmsg $MFILE $DM.USAGE $0 > /dev/null 2> /dev/null
	if [ $? -eq 0 ]
	then
		lmfmsg $MFILE $DM.USAGE $0
	else
		echo "USAGE: $0 fullpath-filename [-s]"
	fi
	exit 1
}

ERROR=noerror
BOOTABLE=notbootable
FILE=$1

if [ -n "$2" ]
then
	if [ "$2" = "-s" ]
	then
		BOOTABLE=bootable
	else
		Error
	fi
fi

[ -z "$FILE" ] && Error
[ -d "$FILE" -o -c "$FILE" -o -b "$FILE" -o -p "$FILE" ] && Error

rm -f $FILE
[ -f "$FILE" ] && Error

cp $STATICMERGE/diskimages/f.dsk $FILE
chmod +w $FILE
[ ! -w $FILE ] && Error
	

if [ "$BOOTABLE" = "bootable" ]
then
					# Hardwired drive letter J:
					# Hardwired DOS path
	$DOSWINBINDIR/dos $KOPT +aa:=$FILE +b -e +m1 -p -t +c 'j:\\dos\\sys a:'
fi
exit 0
