#!/bin/bash
#
# boot-sparc v 1.08 (c) Steve Dunham <dunham@cse.msu.edu>, Eric
# Delaunay <delaunay@lix.polytechnique.fr>, Steve McIntyre
# <stevem@chiark.greenend.org.uk>
# Released under GPL 24 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 i386, 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 (not needed for i386, but let's stay consistent)

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

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


rm -fr boot1

# put the relevant parts of SILO boot loader
mkdir -p boot1/boot
cp -p $BOOTDIR/cd.b $BOOTDIR/second.b boot1/boot
cat - > boot1/boot/silo.conf << __EOF__
message=!cd1
timeout=300
root=/dev/ram
image[sun4c,sun4d,sun4m]=!cd2
   label=linux
   initrd=!cd5
image[sun4u]=!cd4
   label=linux
   initrd=!cd5
image[sun4c,sun4d,sun4m]=!cd3
   label=linux-2.2
   initrd=!cd5
image[sun4u]=!cd4
   label=linux-2.2
   initrd=!cd5
__EOF__

# linux kernel & co are fetched directly from the install dir
# ... put the message banner in boot/debian.txt

(cd slink1/dists/slink/main/disks-$ARCH/current/ ; \
	cp -p linux-a.out linux-2.2.1-sun4u-a.out \
	linux-2.2.1-a.out root.bin sparc_release_note.txt \
	$TMPDIR/slink1/install )

mount -o loop \
	$MIRROR/dists/slink/main/disks-$ARCH/current/resc1440.bin \
	$mountpoint
cp -p $mountpoint/debian.txt boot1/boot/debian.txt
umount $mountpoint