: "mkbf ss/ds"
: "	Make a boot floppy. Arg = ss ==> single-sided, else double-sided."
:
: " These floppies have only enough on them to initialize a wini with enough"
: " stuff to bring the rest of Xenix to the wini."
:
:
: " Figure parameters based on argument."
:
if test F$1 = Fss; then
	dev=/dev/xf0
	rdev=/dev/rxf0
	size=400
	sides=1
	bdev="0 28"
elif test F$1 = Fds; then
	dev=/dev/dxf0
	rdev=/dev/rdxf0
	size=900
	sides=2
	bdev="0 36"
else
	echo "Usage: mkbf ss OR mkbf ds.  Use ss for single-sided, ds for double."
	exit 1
fi
:
: " Format track 0, single-density, 128-byte sectors."
: " Install bootstrap (floppy version)."
:
echo "Formatting track 0..."
/etc/format /dev/rsft0
/etc/ib215 -r $sides /dev/sft0
:
: " Format the rest of the floppy, 256-byte sectors, double-density."
: " Make a file-system on this part."
:
echo "Formatting rest of disk $rdev..."
/etc/format $rdev
echo "Making file system..."
/etc/mkfs $rdev $size
:
: "Copy a bunch of stuff to the floppy..."
:
echo "Mounting floppy on /mnt..."
/etc/mount $dev /mnt
cd /mnt
echo Copying...
mkdir bin etc tmp dev mnt
echo /xenix;          cp /gold/xenix       /mnt
echo /xenix.f;      cp /gold/xenix.f   /mnt
echo /xenix.gen;  ln /mnt/xenix.f /mnt/xenix.gen
echo /bin/cat;        cp /gold/bin/cat     /mnt/bin
echo /bin/chgrp;      cp /gold/bin/chgrp   /mnt/bin
echo /bin/chmod;      cp /gold/bin/chmod   /mnt/bin
echo /bin/chown;      cp /gold/bin/chown   /mnt/bin
echo /bin/cp;         cp /gold/bin/cp      /mnt/bin
echo /bin/echo;       cp /gold/bin/echo    /mnt/bin
echo /bin/ed;         cp /gold/bin/ed      /mnt/bin
echo /bin/fsck;       cp /gold/bin/fsck    /mnt/bin
echo /bin/ln;         cp /gold/bin/ln      /mnt/bin
echo /bin/ls;         cp /gold/bin/ls      /mnt/bin
ln /mnt/bin/ls /mnt/bin/l
echo /bin/fsck;       cp /gold/bin/fsck    /mnt/bin
echo /bin/make;      cp /gold/bin/make    /mnt/bin
echo /bin/mkdir;      cp /gold/bin/mkdir   /mnt/bin
echo /bin/mv;         cp /gold/bin/mv      /mnt/bin
echo /bin/pwd;        cp /gold/bin/pwd     /mnt/bin
echo /bin/expr;     cp /gold/bin/expr /mnt/bin
echo /bin/rm;         cp /gold/bin/rm      /mnt/bin
echo /bin/sh;         cp /gold/bin/sh      /mnt/bin
echo /bin/stty;       cp /gold/bin/stty    /mnt/bin
echo /bin/sync;       cp /gold/bin/sync    /mnt/bin
echo /bin/tar;        cp /gold/bin/tar     /mnt/bin
echo /bin/test;       cp /gold/bin/test    /mnt/bin
chmod u-t /mnt/bin/*
chmod o+x /mnt/bin/*
chmod o-x /mnt/xenix /mnt/xenix.f /mnt/bin/fsck /mnt/bin/sync /mnt/bin/tar
echo /etc/b215stage2; cp /gold/etc/b215stage2 /mnt/etc/
echo /etc/firsttime; cp /gold/etc/firsttime /mnt/etc
echo /etc/format;     cp /gold/etc/format  /mnt/etc
echo /etc/ib215;      cp /gold/etc/ib215   /mnt/etc
echo /etc/init;       cp /gold/etc/init    /mnt/etc
echo /etc/inir;       ln /mnt/etc/init /mnt/etc/inir
echo /etc/install; cp /gold/etc/install /mnt/etc
echo /etc/mkbf;       cp /gold/etc/mkbf    /mnt/etc
echo /etc/mkfs;       cp /gold/etc/mkfs    /mnt/etc
echo /etc/mknod;      cp /gold/etc/mknod   /mnt/etc
echo /etc/mkwini;     cp /gold/etc/mkwini  /mnt/etc
echo /etc/mksys.gen;      cp /gold/etc/mksys.gen /mnt/etc
echo /etc/mksys.wini; cp /gold/etc/mksys.wini /mnt/etc
echo /etc/mksys
ln /mnt/etc/mksys.gen /mnt/etc/mksys
echo /etc/mount;      cp /gold/etc/mount   /mnt/etc
echo /etc/passwd;	cp /gold/etc/passwd	/mnt/etc
echo /etc/mtab;       >/mnt/etc/mtab
echo /etc/haltsys;    cp /gold/etc/haltsys /mnt/etc
ln /mnt/etc/haltsys /mnt/etc/shutdown
echo /etc/umount;     cp /gold/etc/umount  /mnt/etc
cat >/mnt/.profile <<PROF
stty erase "^h" kill "^x" -tabs
PS1="<bootsys> "        ; export PS1
echo
echo "  XENIX-286 X100 Distribution System   (Floppy)"
echo "      (backspace is ^h, erase line is ^x)   "
echo
echo "To install xenix, type '/etc/mksys' at the <bootsys> prompt"
echo
PROF
:
: "Make device-nodes."
:
echo "Making /dev..."
cd /mnt/dev
cp /gold/dev/makefile .
make standard priam priamroot pertec floppy
:
: "Finish up."
:
cd /
/etc/umount $dev
echo "Boot from :wf0:xenix.f"
