#!/bin/bash
#
# boot-m68k v 1.11 (c) Steve McIntyre <stevem@chiark.greenend.org.uk>
# and Chris Lawrence <lawrencc@debian.org>
# Released under GPL 28 Feb 1999
# See the file COPYING for license details
# Released as part of the slink_cd package, not much use standalone
#
# Do install stuff for sparc, including making bootable CDs
#
# $1 is Debian-mirror location
# $2 is start directory location (where the scripts live)
# $3 is tmpdir location
# $4 is the binary arch
# $5 is debug level
# $6 is $BOOTDIR
#
# Enjoy!  This is all completely free.
# - Chris Lawrence <lawrencc@debian.org>
#
# Rewritten by Steve McIntyre <stevem@chiark.greenend.org.uk> in sh to
# interface better with the slink_cd package and cope with the mirror
# layout, 28 Feb 1999.
# Hopefully this will do the same job as the python map stuff did, it
# appears to...
#
# If you're burning a CD, use the mkhybrid in potato (HFS is broken in the
# slink version of mkhybrid; at least it is for me).  Please don't use Joliet
# extensions; some Mac kernels have apparently been known to choke on them
# (and you really shouldn't be supporting a Microsoft Standard anyway :-)
#
# You may also want the following:
# * A copy of the Linux/m68k FAQ
# * A copy of my m68k-specific README and m68k-tools directories
# * The m68k kernel sources from sunsite.auc.dk:/projects/680x0
#   (Sunsite-Denmark is rsync-capable at sunsite.auc.dk::ftp)
#   I recommend getting the 2.0.36 and 2.2.1-pre2 sources at least.
#   (Actually 2.0.36 is non-essential since it's on the CDs already;
#    you probably DO want the 2.2.1-pre2 tree however [under v2.1!]).
#
# MVME/BVME users will love you if you also include the "tools" directory
# from the FTP site, since they may want/need rawwrite for MS-DOS.
#
# The first two items are in a tar file at master.debian.org:~lawrencc, along
# with a silly rsync script that will accomplish the last item.

MIRROR=$1
BASEDIR=$2
TDIR=$3
ARCH=$4
VERBOSE=$5
BOOTDIR=$6

. $BASEDIR/vecho # Include local definitions for vecho, vvecho, vvvecho

rm -fr boot1

DISKSROOT="$MIRROR/dists/slink/main/disks-m68k/current"
CDROOT="$TDIR/slink1"
INSTALLDIR="$CDROOT/install"

rm -rf $INSTALLDIR
mkdir -p $INSTALLDIR
cd $INSTALLDIR

vecho Installing Amiga files
lha xqf $DISKSROOT/amiga/amigainstall.lha
mv debian amiga
mv debian.info amiga.info
cp $DISKSROOT/amiga/* amiga

# Needs to be executable
chmod a+x amiga/amiboot-5.6

# Add .info files for amiga
tar -C .. -xzf $BASEDIR/cts_amiga_info.tar.gz
for file in `tar tzf $BASEDIR/cts_amiga_info.tar.gz`
do
	chmod a+r ../$file
done

vecho Installing Atari files
lha xqf $DISKSROOT/atari/install.lzh
mv debian atari
cp $DISKSROOT/atari/* atari

vecho Installing Mac files
tar -C .. -zxf $DISKSROOT/source/macinstall.tar.gz
cp $DISKSROOT/mac/* mac

for TYPE in common bvme6000 mvme162 mvme167 source
do
	vecho Installing $TYPE files
	mkdir $TYPE
	cp $DISKSROOT/$TYPE/* $TYPE
done

vecho hexbin Mac files
cd $INSTALLDIR/mac
hexbin *.hqx

vecho Installing m68k FAQ and tools
mkdir $CDROOT/tmp
cd $CDROOT/tmp
tar xzf $BASEDIR/m68k-cd-misc.tar.gz
mv m68k-faq m68k-tools ..
mv update-kernels ../update-kernels.m68k
cd ..
rm -rf foo

