1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
#! /bin/sh
# (c) 2001-2002, Thomas Lange
#
# set link for tftpboot in /boot/fai to an image for a host
# or for all hosts with prefix and a number
# examples:
# tlink installimage bigfoot
# tlink installimage ant06
# tlink installimage all ant
# tlink nodeimage all ant
#
# tlink shows all file in /boot/fai
# tlink ant01 shows syslink for ant01
version="Version 1.1 10-jan-2002"
# define the range for client numbers using prefix
startnum=1
endnum=25
image=$1
host=$2
prefix=$3
tftpdir=/boot/fai
# - - - - - - - - - - - - - - - - - - - -
usage() {
cat <<EOF
tlink: make symbolic link for booting network card via TFTP and BOOTP. $version
Copyright (C) 2001-2002 by Thomas Lange
Usage: tlink [bootimage] [all] [hostname|prefix]
The list of all hosts is specified in the script itself.
Examples:
tlink shows all files in /boot/fai
tlink atom02 shows symlink of host atom02
tlink atom_install atom02 host atom02 will boot image atom_install
tlink atom_local atom02 host atom02 will boot image atom_local
tlink atom_install all atom all hosts with prefix atom will use atom_install
EOF
exit 0
}
# - - - - - - - - - - - - - - - - - - - -
link() {
rm -f $ $tftpdir/$1
ln -s $image $tftpdir/$1 && echo $1 now booting $image
}
# - - - - - - - - - - - - - - - - - - - -
showlink() {
# show current link for host
ls -l $tftpdir/$1
exit 0
}
# - - - - - - - - - - - - - - - - - - - -
[ X"$1" = X ] && usage
# create list of host numbers
hostnums=`seq -w $starnum 1 $endnum`
# show one or all files
[ X"$host" = X ] && showlink $1
if [ $host = "all" ];then
for i in $hostnums
do
link $prefix$i
done
exit
else
link $host
fi
|