| 1 |
lange |
79 |
#! /bin/sh |
| 2 |
|
|
|
| 3 |
|
|
# $Id$ |
| 4 |
|
|
#********************************************************************* |
| 5 |
|
|
# |
| 6 |
|
|
# make-fai-bootfloppy -- create a boot floppy for FAI |
| 7 |
|
|
# |
| 8 |
|
|
# This script is part of FAI (Fully Automatic Installation) |
| 9 |
|
|
# (c) 2000 by Thomas Lange, lange@informatik.uni-koeln.de |
| 10 |
|
|
# Universitaet zu Koeln |
| 11 |
|
|
# |
| 12 |
|
|
#********************************************************************* |
| 13 |
|
|
# This program is free software; you can redistribute it and/or modify |
| 14 |
|
|
# it under the terms of the GNU General Public License as published by |
| 15 |
|
|
# the Free Software Foundation; either version 2 of the License, or |
| 16 |
|
|
# (at your option) any later version. |
| 17 |
|
|
# |
| 18 |
|
|
# This program is distributed in the hope that it will be useful, but |
| 19 |
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 |
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 21 |
|
|
# General Public License for more details. |
| 22 |
|
|
# |
| 23 |
|
|
# A copy of the GNU General Public License is available as |
| 24 |
|
|
# `/usr/share/common-licences/GPL' in the Debian GNU/Linux distribution |
| 25 |
|
|
# or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html. You |
| 26 |
|
|
# can also obtain it by writing to the Free Software Foundation, Inc., |
| 27 |
|
|
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 28 |
|
|
#********************************************************************* |
| 29 |
|
|
# Thomas Lange, Universitaet Koeln, 10/2000 |
| 30 |
|
|
|
| 31 |
|
|
set -e |
| 32 |
|
|
|
| 33 |
lange |
322 |
version="version 1.2, january 2001" |
| 34 |
lange |
321 |
|
| 35 |
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 36 |
|
|
die() { |
| 37 |
|
|
|
| 38 |
|
|
|
| 39 |
|
|
echo -e $* |
| 40 |
|
|
exit 99 |
| 41 |
|
|
} |
| 42 |
|
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 43 |
|
|
usage() { |
| 44 |
|
|
|
| 45 |
|
|
cat <<EOF |
| 46 |
|
|
make-fai-bootfloppy, create a boot floppy for FAI. $version |
| 47 |
|
|
|
| 48 |
|
|
Copyright (C) 2000, 2001 by Thomas Lange |
| 49 |
|
|
|
| 50 |
lange |
322 |
Usage: make-fai-bootfloppy [parameter] |
| 51 |
lange |
321 |
|
| 52 |
|
|
-h print this message. |
| 53 |
|
|
|
| 54 |
|
|
DESCRIPTION |
| 55 |
|
|
Creates a boot floppy for booting a FAI install client. |
| 56 |
|
|
No arguments are needed but you must be root. |
| 57 |
lange |
322 |
All parameters are passed to the kernel via append in lilo.conf. |
| 58 |
lange |
321 |
|
| 59 |
lange |
322 |
EXAMPLE |
| 60 |
|
|
To make a boot floppy for my old SMC EtherCard Plus Elite 16T I use |
| 61 |
|
|
|
| 62 |
|
|
# make-fai-bootfloppy "reserve=0x300,32,0x200,32 ether=10,0x300,eth0" |
| 63 |
|
|
|
| 64 |
lange |
321 |
EOF |
| 65 |
|
|
exit 0 |
| 66 |
|
|
} |
| 67 |
|
|
|
| 68 |
|
|
|
| 69 |
|
|
while getopts h opt ; do |
| 70 |
|
|
case "$opt" in |
| 71 |
|
|
h) usage ;; |
| 72 |
|
|
esac |
| 73 |
|
|
done |
| 74 |
|
|
|
| 75 |
|
|
|
| 76 |
lange |
132 |
if [ "$UID" -ne 0 ]; then |
| 77 |
|
|
echo "You must be root!" |
| 78 |
|
|
exit 9 |
| 79 |
|
|
fi |
| 80 |
|
|
|
| 81 |
lange |
322 |
# additional kernel parameter |
| 82 |
|
|
params=$* |
| 83 |
|
|
|
| 84 |
lange |
79 |
. /etc/fai.conf |
| 85 |
|
|
|
| 86 |
|
|
SERVERIP=`ifconfig eth0 | perl -ne '/inet addr:([0-9\.]+)/ && print $1'` |
| 87 |
|
|
|
| 88 |
|
|
grep -q ic_bootp $NFSROOT/boot/System.map-$KERNELVERSION && TYPE=BOOTP |
| 89 |
|
|
grep -q ic_dhcp $NFSROOT/boot/System.map-$KERNELVERSION && TYPE=DHCP |
| 90 |
|
|
|
| 91 |
lange |
321 |
[ "$TYPE" ] || die "Can't determine kernel boot protocol.\nMaybe there's no $NFSROOT/boot/System.map-$KERNELVERSION" |
| 92 |
|
|
|
| 93 |
lange |
322 |
mke2fs -q -i 8192 -m 0 /dev/fd0 || exit |
| 94 |
lange |
79 |
mount /floppy || mount /dev/fd0 /floppy || exit |
| 95 |
|
|
cp -dpR $NFSROOT/boot /floppy |
| 96 |
|
|
mkdir -p /floppy/etc |
| 97 |
|
|
ln -s boot/vmlinuz-$KERNELVERSION /floppy/vmlinuz |
| 98 |
|
|
|
| 99 |
lange |
185 |
cat > /floppy/etc/lilo.conf <<-EOF |
| 100 |
|
|
boot=/dev/fd0 |
| 101 |
|
|
root=$NFSROOT/dev/boot255 |
| 102 |
|
|
install=/floppy/boot/boot.b |
| 103 |
|
|
map=/floppy/boot/map |
| 104 |
lange |
322 |
append = "NFSROOT=$SERVERIP:$NFSROOT $*" |
| 105 |
lange |
185 |
delay=10 |
| 106 |
|
|
compact |
| 107 |
|
|
image=/floppy/vmlinuz |
| 108 |
lange |
216 |
label=FAI-$TYPE |
| 109 |
lange |
79 |
read-only |
| 110 |
|
|
EOF |
| 111 |
|
|
|
| 112 |
|
|
echo now writing boot data to floppy |
| 113 |
lange |
321 |
$NFSROOT/sbin/lilo -C /floppy/etc/lilo.conf |
| 114 |
lange |
79 |
cd / |
| 115 |
|
|
umount /floppy |
| 116 |
|
|
|
| 117 |
|
|
cat <<EOF |
| 118 |
lange |
321 |
FAI boot floppy created. |
| 119 |
lange |
79 |
boot protocol : $TYPE |
| 120 |
|
|
server : $SERVERIP |
| 121 |
|
|
nfsroot : $SERVERIP:$NFSROOT |
| 122 |
lange |
322 |
parameters : $params |
| 123 |
lange |
321 |
The kernel configuration is $NFSROOT/boot/config-$KERNELVERISON-$TYPE. |
| 124 |
lange |
79 |
EOF |