| 1 |
#! /bin/bash
|
| 2 |
|
| 3 |
# $Id$
|
| 4 |
#*********************************************************************
|
| 5 |
#
|
| 6 |
# subroutines-sunos
|
| 7 |
#
|
| 8 |
# useful subroutines for SunOS installation with FAI on Sun systems
|
| 9 |
#
|
| 10 |
# This script is part of FAI (Fully Automatic Installation)
|
| 11 |
# (c) 2000-2003 by Thomas Lange, lange@informatik.uni-koeln.de
|
| 12 |
# Universitaet zu Koeln
|
| 13 |
#
|
| 14 |
#*********************************************************************
|
| 15 |
# This program is free software; you can redistribute it and/or modify
|
| 16 |
# it under the terms of the GNU General Public License as published by
|
| 17 |
# the Free Software Foundation; either version 2 of the License, or
|
| 18 |
# (at your option) any later version.
|
| 19 |
#
|
| 20 |
# This program is distributed in the hope that it will be useful, but
|
| 21 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 22 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 23 |
# General Public License for more details.
|
| 24 |
#
|
| 25 |
# A copy of the GNU General Public License is available as
|
| 26 |
# `/usr/share/common-licences/GPL' in the Debian GNU/Linux distribution
|
| 27 |
# or on the World Wide Web at http://www.gnu.org/copyleft/gpl.html. You
|
| 28 |
# can also obtain it by writing to the Free Software Foundation, Inc.,
|
| 29 |
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
| 30 |
#*********************************************************************
|
| 31 |
|
| 32 |
# source this file, then you have these function available in the shell
|
| 33 |
|
| 34 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
| 35 |
task_partition() {
|
| 36 |
|
| 37 |
if [ -s $SI_PROFILE ]; then
|
| 38 |
|
| 39 |
echo "SI_PROFILE already exists."
|
| 40 |
return
|
| 41 |
fi
|
| 42 |
# we have to create the SI_PROFILE which contains information about the
|
| 43 |
# partitioning and the list of software that will be installed
|
| 44 |
|
| 45 |
# first read one disk_config file
|
| 46 |
for class in $classes; do
|
| 47 |
revclasses="$class $revclasses"
|
| 48 |
done
|
| 49 |
for c in $revclasses ; do
|
| 50 |
if [ -f $FAI/disk_config/$c ]; then
|
| 51 |
echo "Using disk_config/$c"
|
| 52 |
cat $FAI/disk_config/$c >> $SI_PROFILE
|
| 53 |
break
|
| 54 |
fi
|
| 55 |
done
|
| 56 |
|
| 57 |
# now read all package_config matching a class name
|
| 58 |
for c in $classes; do
|
| 59 |
if [ -f $FAI/package_config/$c ]; then
|
| 60 |
echo "Using package_config/$c"
|
| 61 |
cat $FAI/package_config/$c >> $SI_PROFILE
|
| 62 |
fi
|
| 63 |
done
|
| 64 |
|
| 65 |
cp $SI_PROFILE $LOGDIR
|
| 66 |
}
|
| 67 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
| 68 |
task_confdir() {
|
| 69 |
|
| 70 |
if [ ! -d /fai/class ]; then
|
| 71 |
mount -F lofs $SI_CONFIG_DIR/fai /fai
|
| 72 |
fi
|
| 73 |
|
| 74 |
mount -F lofs $SI_CONFIG_DIR/scripts/usr-local /usr/local
|
| 75 |
# define_fai_flags
|
| 76 |
}
|
| 77 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
| 78 |
jobsrunning() {
|
| 79 |
|
| 80 |
# test if jobs are running
|
| 81 |
ps -el | egrep ' O | R ' | egrep -v 'TIME CMD|grep|ps'
|
| 82 |
}
|
| 83 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
| 84 |
fai_init() {
|
| 85 |
|
| 86 |
# default classes before calling task defvar. Will be overwritten by task defvar
|
| 87 |
# the type of operating system (linux, sunos)
|
| 88 |
oclass=$(uname -s | tr /a-z/ /A-Z/)
|
| 89 |
classes="DEFAULT $oclass $HOSTNAME LAST"
|
| 90 |
|
| 91 |
umask 022
|
| 92 |
target=/a
|
| 93 |
FAI_ROOT=$target
|
| 94 |
stamp=/tmp/FAI_INSTALLATION_IN_PROGRESS
|
| 95 |
FAI_VERSION=FAIVERSIONSTRING
|
| 96 |
osname="Sun Solaris"
|
| 97 |
ROOTCMD="chroot $target"
|
| 98 |
FAI=/fai
|
| 99 |
debug=
|
| 100 |
verbose=1
|
| 101 |
# createvt=1
|
| 102 |
[ -z "$LOGDIR" ] && LOGDIR=/tmp/fai
|
| 103 |
mkdir -p $LOGDIR
|
| 104 |
rcslog=$LOGDIR/rcS.log
|
| 105 |
|
| 106 |
PATH=$SI_CONFIG_DIR/bin:/usr/local/bin:$PATH
|
| 107 |
LD_LIBRARY_PATH=$SI_CONFIG_DIR/lib:$LD_LIBRARY_PATH
|
| 108 |
|
| 109 |
if [ -z "$IPADDR" ]; then
|
| 110 |
IPADDR=`ifconfig $_INIT_NET_IF | grep inet | awk '{ print $2 }'`
|
| 111 |
fi
|
| 112 |
|
| 113 |
# commands that are not used on solaris
|
| 114 |
defnop openvt wait_for_jobs save_dmesg task_mountdisks task_extrbase sndmon
|
| 115 |
defnop task_mirror task_updatebase task_instsoft task_finish task_chboot
|
| 116 |
cat <<-EOF
|
| 117 |
|
| 118 |
-----------------------------------------------------
|
| 119 |
Fully Automatic Installation for $osname
|
| 120 |
$FAI_VERSION
|
| 121 |
|
| 122 |
Copyright (c) 1999-2003 Thomas Lange
|
| 123 |
<lange@informatik.uni-koeln.de>
|
| 124 |
-----------------------------------------------------
|
| 125 |
|
| 126 |
EOF
|
| 127 |
}
|
| 128 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
| 129 |
task_sysinfo() {
|
| 130 |
|
| 131 |
constype >> $LOGDIR/prtconf.log
|
| 132 |
fai-savelog -r
|
| 133 |
task_faiend
|
| 134 |
}
|
| 135 |
# - - - - - - - - - - - - - - - - - - - - - - - - - - -
|