| 5 |
# fai-do-scripts - call configuration scripts for every defined class |
# fai-do-scripts - call configuration scripts for every defined class |
| 6 |
# |
# |
| 7 |
# This script is part of FAI (Fully Automatic Installation) |
# This script is part of FAI (Fully Automatic Installation) |
| 8 |
# (c) 2003-2005 by Thomas Lange, lange@informatik.uni-koeln.de |
# (c) 2003-2006 by Thomas Lange, lange@informatik.uni-koeln.de |
| 9 |
# Universitaet zu Koeln |
# Universitaet zu Koeln |
| 10 |
# |
# |
| 11 |
#********************************************************************* |
#********************************************************************* |
| 26 |
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 27 |
#********************************************************************* |
#********************************************************************* |
| 28 |
|
|
| 29 |
version="version 1.3.1, 5-apr-2005" |
version="version 1.4.2, 7-april-2006" |
| 30 |
|
|
| 31 |
# variables needed: $classes, $cfclasses, $LOGDIR |
# variables needed: $classes, $cfclasses, $LOGDIR |
| 32 |
# |
# |
| 60 |
for class in $classes ; do |
for class in $classes ; do |
| 61 |
[ -x $class -a -f $class ] && do_script $class |
[ -x $class -a -f $class ] && do_script $class |
| 62 |
if [ -d $class ]; then |
if [ -d $class ]; then |
| 63 |
for f in $(echo $class/{S,}[0-9][0-9]* | grep -v ~$) ; do |
for f in $(echo $class/{S,}[0-9][0-9]* ) ; do |
| 64 |
[ -x $f -a -f $f ] && do_script $f |
[ -x $f -a -f $f ] && do_script $f |
| 65 |
done |
done |
| 66 |
fi |
fi |
| 71 |
|
|
| 72 |
# execute scripts and save their output in log files |
# execute scripts and save their output in log files |
| 73 |
# cfengine, shell, perl and expect scripts are known types |
# cfengine, shell, perl and expect scripts are known types |
| 74 |
local shelldebug file filetype |
local shelldebug file filetype name |
| 75 |
|
|
| 76 |
file=$1 |
file=$1 |
| 77 |
|
|
| 78 |
# may be remove some day |
# may be remove some day |
| 79 |
case $file in |
case $file in |
| 80 |
S*) echo "Script, matching S* will not be executed in the future. Please use names matching [0-9][0-9]*" ;; |
*~) echo "Skipping backup file $file" ; return ;; |
| 81 |
|
esac |
| 82 |
|
|
| 83 |
|
name=$(basename $file) |
| 84 |
|
case $name in |
| 85 |
|
S[0-9][0-9]*) echo -e "WARNING: The script $name does not match [0-9][0-9]*.\nIt's not executed. Please rename it."; return ;; |
| 86 |
esac |
esac |
| 87 |
|
|
| 88 |
filetype=$(file $file) |
filetype=$(file $file) |
| 119 |
*"cfengine script"*) |
*"cfengine script"*) |
| 120 |
echo "Executing cfengine: $file" |
echo "Executing cfengine: $file" |
| 121 |
echo "===== cfengine: $file =====" >> $LOGDIR/cfengine.log 2>&1 |
echo "===== cfengine: $file =====" >> $LOGDIR/cfengine.log 2>&1 |
| 122 |
./$file --no-lock -v -f $file -D${cfclasses} >> $LOGDIR/cfengine.log 2>&1 |
./$file -K -v -f $file -D${cfclasses} >> $LOGDIR/cfengine.log 2>&1 |
| 123 |
fc_check_status $file $? | tee -a $LOGDIR/cfengine.log |
fc_check_status $file $? | tee -a $LOGDIR/cfengine.log |
| 124 |
;; |
;; |
| 125 |
|
|