mariadb/storage/ndb/test/run-test/make-config.sh

102 lines
2.3 KiB
Bash
Raw Normal View History

2004-04-14 10:53:21 +02:00
#!/bin/sh
baseport=""
basedir=""
proc_no=1
node_id=1
2004-04-14 10:53:21 +02:00
2005-05-07 13:23:38 +02:00
d_file=/tmp/d.$$
dir_file=/tmp/dirs.$$
config_file=/tmp/config.$$
cluster_file=/tmp/cluster.$$
2004-04-14 10:53:21 +02:00
add_procs(){
2004-04-14 10:53:21 +02:00
type=$1; shift
while [ $# -ne 0 ]
do
add_proc $type $1
shift
done
2004-04-14 10:53:21 +02:00
}
add_proc (){
case $type in
mgm)
echo "$proc_no.ndb_mgmd" >> $dir_file
echo "[ndb_mgmd]" >> $config_file
echo "Id: $node_id" >> $config_file
echo "HostName: $2" >> $config_file
node_id=`expr $node_id + 1`
;;
api)
echo "$proc_no.ndb_api" >> $dir_file
echo "[api]" >> $config_file
echo "Id: $node_id" >> $config_file
echo "HostName: $2" >> $config_file
node_id=`expr $node_id + 1`
;;
ndb)
echo "$proc_no.ndbd" >> $dir_file
echo "[ndbd]" >> $config_file
echo "Id: $node_id" >> $config_file
echo "HostName: $2" >> $config_file
node_id=`expr $node_id + 1`
;;
mysqld)
echo "$proc_no.mysqld" >> $dir_file
echo "[mysqld]" >> $config_file
echo "Id: $node_id" >> $config_file
echo "HostName: $2" >> $config_file
node_id=`expr $node_id + 1`
;;
mysql)
echo "$proc_no.mysql" >> $dir_file
;;
2004-04-14 10:53:21 +02:00
esac
proc_no=`expr $proc_no + 1`
2004-04-14 10:53:21 +02:00
}
cnf=/dev/null
cat $1 | while read line
2004-04-14 10:53:21 +02:00
do
case $line in
baseport:*) baseport=`echo $line | sed 's/baseport[ ]*:[ ]*//g'`;;
basedir:*) basedir=`echo $line | sed 's/basedir[ ]*:[ ]*//g'`;;
mgm:*) add_procs mgm `echo $line | sed 's/mgm[ ]*:[ ]*//g'`;;
api:*) add_procs api `echo $line | sed 's/api[ ]*:[ ]*//g'`;;
ndb:*) add_procs ndb `echo $line | sed 's/ndb[ ]*:[ ]*//g'`;;
mysqld:*) add_procs mysqld `echo $line | sed 's/mysqld[ ]*:[ ]*//g'`;;
mysql:*) add_procs mysql `echo $line | sed 's/mysql[ ]*:[ ]*//g'`;;
"-- cluster config")
if [ "$cnf" = "/dev/null" ]
then
cnf=$cluster_file
else
cnf=/dev/null
fi
2005-05-07 13:23:38 +02:00
line="";;
*) echo $line >> $cnf; line="";;
esac
2005-05-07 13:23:38 +02:00
if [ "$line" ]
then
echo $line >> $d_file
fi
2004-04-14 10:53:21 +02:00
done
cat $dir_file | xargs mkdir -p
2004-04-14 10:53:21 +02:00
if [ -f $cluster_file ]
then
cat $cluster_file $config_file >> /tmp/config2.$$
mv /tmp/config2.$$ $config_file
2004-04-14 10:53:21 +02:00
fi
for i in `find . -type d -name '*.ndb_mgmd'`
do
cp $config_file $i/config.ini
2004-04-14 10:53:21 +02:00
done
2005-05-07 13:23:38 +02:00
mv $d_file d.txt
rm -f $config_file $dir_file $cluster_file