forked from PawseySC/maali
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathibs2maali
executable file
·34 lines (27 loc) · 1.12 KB
/
ibs2maali
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
#!/bin/bash
TOOLNAME=`basename $1 .ibs`
IBS_DIR=`dirname $1`
MAALI_DIR=`echo $IBS_DIR | sed -e 's/\.ibs/\.maali/g' | sed -e 's/ibs_files/cygnet_files/g'`
# chek whether there is a module defintion in the file
IBS_MODULE=`grep ibs_module $1 | wc -l`
if [ $IBS_MODULE -eq 0 ]; then
sed -e 's/IBS/MAALI/g' $1 | sed -e 's/ibs_/maali_/g' | grep -v Id | uniq > $MAALI_DIR/$TOOLNAME.cyg
sed -i -e 's/ibs config file/maali cygnet file/g' $MAALI_DIR/$TOOLNAME.cyg
IBS_SETENV=`grep MAALI_MODULE_SET_SETENV $MAALI_DIR/$TOOLNAME.cyg | wc -l`
if [ $IBS_SETENV -eq 1 ]; then
. $MAALI_DIR/$TOOLNAME.cyg
REPLACEMENT=""
for KEY_VALUE_PAIR in $MAALI_MODULE_SET_SETENV ; do
KEY=`echo $KEY_VALUE_PAIR | cut -d '=' -f 1`
VALUE=`echo $KEY_VALUE_PAIR | cut -d '=' -f 2`
if [ "$REPLACEMENT" == "" ]; then
REPLACEMENT="MAALI_MODULE_SET_${KEY}='$VALUE'"
else
REPLACEMENT="$REPLACEMENT\nMAALI_MODULE_SET_${KEY}='$VALUE'"
fi
done
sed -i -e "s;MAALI_MODULE_SET_SETENV;$REPLACEMENT\n#MAALI_MODULE_SET_SETENV;g" $MAALI_DIR/$TOOLNAME.cyg
fi
else
echo "Please remove ibs_module from $1"
fi