#!/bin/sh # # Copyright 1994, 1998 Patrick Volkerding, Moorhead, Minnesota USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # #TMP=/var/log/setup/tmp TMP=/tmp # Set color menu mode by default: COLOR=on # This is a different 'probe' than the function below. if [ -x /sbin/probe ]; then PROBE=/sbin/probe else PROBE=/sbin/fdisk fi # check device map for grub T_RX=/mnt if [ -f /tmp/SeTrootdev ] ; then ROOT_DEVICE=`cat /tmp/SeTrootdev` else ROOT_DEVICE="" fi if [ "$ROOT_DEVICE" = "" ] ; then T_RX=/ fi grub_shell=$T_RX/usr/sbin/grub device_map=$T_RX/boot/grub/device.map $grub_shell --batch --device-map=$device_map < $TMP/reply if [ $? = 1 -o $? = 255 ]; then exit fi TG="`cat $TMP/reply`" rm -r $TMP/reply if [ "$ROOT_DEVICE" = "" ] ; then dialog --title "rootパーティションの入力" --inputbox \ "カーネル起動直後に / にマウントするパーティションを \n\ 入力してください。 \n\ [例: /dev/hda2 ]\n" \ 10 62 2> /tmp/grubConfig_rootDev$$ ROOT_DEVICE=`cat /tmp/grubConfig_rootDev$$` rm -f /tmp/grubConfig_rootDev$$ fi if [ "$ROOT_DEVICE" = "" ] ; then echo "中止しました。" exit fi dialog --title "カーネルパラメータの入力" --inputbox \ "カーネル起動時に与えるカーネルパラメータをここで指定できます。\n\ 不要な場合は、単に Enter キーを押してください。\n\ [例: ide0=dma ide1=dma (IDE デバイスの DMA を ON にする)] \n\ [例: max_scsi_luns=1 (検出を行う SCSI の LUN の最大数を指定)]\n\ [例: nosmp (SMP マシンをシングルプロセッサで動作)]\n" \ 13 72 2> /tmp/grubConfig_append$$ if [ $? = 1 -o $? = 255 ] ; then echo "中止しました。" rm -f /tmp/grubConfig_append$$ exit fi APPEND=`cat /tmp/grubConfig_append$$` rm -f /tmp/grubConfig_append$$ # if $ROOT_DEVICE is /dev/sdc3, # $tmp_disk is /dev/sdc, $tmp_part is 3 tmp_disk=`echo $ROOT_DEVICE | sed 's%[0-9]*$%%'` tmp_part=`echo $ROOT_DEVICE | sed "s%$tmp_disk%%"` tmp_drive=`grep -v '^#' $device_map | grep $tmp_disk \ | sed 's%.*\(([hf]d[0-9][a-g0-9,]*)\).*%\1%'` echo $tmp_drive | sed "s%)$%,`expr $tmp_part - 1`)%" > /tmp/grubdrv GRUB_ROOT=`cat /tmp/grubdrv` if [ "$TG" = "MBR" ]; then GRUB_TARGET="(hd0)" elif [ "$TG" = "Root" ]; then GRUB_TARGET=$GRUB_ROOT elif [ "$TG" = "Floppy" ]; then GRUB_TARGET="(fd0)" fi #echo "tmp_disk = $tmp_disk" #echo "tmp_part = $tmp_part" #echo "tmp_drive = $tmp_drive" #echo "GRUB_TARGET= $GRUB_TARGET" cat << EOF > $T_RX/etc/grub.conf # GRUB configuration file # generated by 'grubconfig' # # Start GRUB global section default 0 timeout 30 fallback 1 splashimage $GRUB_ROOT/boot/grub/grubimg.xpm.gz title Plamo-3.1 root $GRUB_ROOT kernel $GRUB_ROOT/vmlinuz root=$ROOT_DEVICE ro $APPEND EOF # OK, now let's look for DOS partitions: DOSP="`$PROBE -l | grep "DOS Win95"`" DOSP="`echo $DOSP | cut -f 1 -d ' '`" if [ ! "$DOSP" = "" ]; then TABLE="`echo $DOSP | cut -b1-8`" cat << EOF >> $T_PX/etc/grub.conf # DOS bootable partition config begins title = $DOSP rootnoverify $GRUB_ROOT makeactive chainloader +1 EOF fi # Done, now we must install grub dialog --infobox "\nGRUBをインストール中..." 5 40 $grub_shell --batch <