#!/bin/sh
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: package/.../elftoaout/elftoaout.setup
# Copyright (C) 2006 The T2 SDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---

#
# ROCK Linux: /etc/setup.d/10-silo
# derived from lilo package
# in rock-linux 1.5.12-2001-03*
#
# Read /etc/setup.d/00-general for details about ROCK Linux setup scripts.
#

case "$1" in
	setup)
		;;
	[a-z]*)
		exit 0 ;;
	*)
		echo "Usage: $0 setup" ; exit 1 ;;
esac

echo -n 'Would you like to run the silo setup script now? (YES/no) '
read in ; [[ "$in" == [nN]* ]] && exit 0 ; unset in

echo -e '\n==> SILO configuration <=='

echo -n 'Would you like me to create a /etc/silo.conf file? (YES/no) '
read in
case "$in" in
    [nN]*) echo ; exit ;;
    *)
	rootdev="`grep '^/dev/.* / ' /etc/fstab | tr ' ' '\t' | cut -f1`"
	# in silo.conf: if default is omitted, the first profile is used.
	echo
	{ echo -e '# silo.conf - autogenerated by rocklinux'
	  echo -e 'boot=/dev/discs/disc0/disc\ndelay=100\ndefault=rock\n'

	  echo -e '# failsafe method, for the time until both kernels work\n'
	  echo -e 'image=/boot/vmlinux32.gz\n\tlabel=rock'
	  echo -e '\troot="'$rootdev'"\n\tread-only'

	  echo -e '# autoselection sparc v.8 kernel (Sparc, MicroSparc,SuperSparc, HyperSparc)\n'
	  echo -e 'image[sun4c,sun4d,sun4m]=/boot/vmlinux32.gz\n\tlabel=rock32'
	  echo -e '\troot="'$rootdev'"\n\tread-only'

	  echo -e '# autoselection sparc v.9 kernel (Ultra Sparc)\n'
	  echo -e 'image[sun4u]=/boot/vmlinux64.gz\n\tlabel=rock64'
	  echo -e '\troot="'$rootdev'"\n\tread-only'

	} | tee /etc/silo.conf | sed 's,^,>  ,'
	echo
esac

echo -n 'Would you like me to install SILO now in the Bootblock ? (YES/no) '
read in ; echo
case "$in" in
	[nN]*) ;;
	*)     silo ; echo ;;
esac

echo -e 'Don`t forget to check your devalias and boot-device settings at the OBP.\n'
echo -e 'If you experience problems with silo devfs compatibility, add devices with mknod.'