debian-cd-clone/tools/boot/potato/boot-sparc

77 lines
1.9 KiB
Bash
Executable File

#!/bin/bash -e
#
# boot-sparc v 2.00 (c) Steve Dunham <dunham@cse.msu.edu>, Eric
# Delaunay <delaunay@lix.polytechnique.fr>, Steve McIntyre
# <stevem@chiark.greenend.org.uk>, Ben Collins <bcollins@debian.org>
# Released under GPL 31 Mar 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 first CD bootable
set -e
N=$1
CDDIR=$2
cd $CDDIR/..
:> $N.mkisofs_opts
# Disk 1 only
[ "$N" = 1 ] || exit 0
echo "-B boot/second.b boot1" > $N.mkisofs_opts
rm -rf boot1
inst=boot1
# Setup directories
mkdir -p $inst/{boot/sun4{u,cdm},etc}
# put the relevant parts of SILO boot loader
(ar p $CDDIR/dists/$CODENAME/main/binary-sparc/base/silo_* data.tar.gz | \
tar zxf - -C $inst/ boot/{cd,second}.b)
# Some custom etc files
cp -p $BASEDIR/tools/boot/potato/sparc-etc/{boot-msg.txt,debian.txt,silo.conf} \
$inst/etc/
# linux kernel & co are fetched directly from the rescue disks
tmp=/var/tmp/debian_cd
mnt=$tmp/mnt
if [ -d $mnt/ ]; then
umount $mnt >/dev/null 2>&1 || true
else
mkdir -p $mnt
fi
for suba in sun4cdm sun4u; do
cp -f $CDDIR/dists/$CODENAME/main/disks-$ARCH/current/$suba/images-1.44/rescue.bin \
$tmp/rescue.bin
mount -o loop,ro $tmp/rescue.bin $mnt
cp $mnt/linux $inst/boot/$suba/linux
umount $mnt
rm -f $tmp/rescue.bin
done
# Unpack the root tree into the directory. we use the tftp root.tar.gz
tar zxf $CDDIR/dists/$CODENAME/main/disks-$ARCH/current/root.tar.gz -C $tmp/
cp -a $tmp/debian-sparc-root/* $inst/.
# no longer need this
rm -rf $tmp
# Get rid of some junk
rm -f $inst/{boot_message,type.txt}
# Make writable areas point to /tmp
rmdir $inst/var/{log,run}
ln -s ../tmp/log $inst/var/log
ln -s ../tmp/run $inst/var/run
# Hack...need a better way
ln -s ../tmp/resolv.conf $inst/etc/resolv.conf
ln -s ../../target/usr/bin/whiptail $inst/usr/bin/whiptail
rmdir $inst/lib/modules
ln -s ../target/lib/modules $inst/lib/modules