startup-node.sh

Philipp Haußleiter, 02/12/2009 02:17 am

Download (1.7 KB)

 
1
#!/bin/sh
2
3
IP=`ifconfig|sed -n "/inet addr:.*.255/{s/.*inet addr://; s/ .*//; p}" | head -n 1`
4
if [ -z "$IP" ] ; then
5
    IP=`ifconfig|sed -n "/inet Adresse:.*.255/{s/.*inet Adresse://; s/ .*//; p}" | head -n 1`
6
fi
7
echo setup BundleBee for ip $IP
8
echo checking tools:
9
ANT=`which ant`
10
if [ -z "$ANT" ] ; then
11
    echo need to install ANT
12
    sudo apt-get install ant
13
    ANT=`which ant`
14
fi
15
MAVEN=`which mvn`
16
if [ -z "$MAVEN" ] ; then
17
    echo need to install MAVEN
18
    sudo apt-get install maven2
19
    MAVEN=`which mvn`
20
fi
21
SUBVERSION=`which svn`
22
if [ -z "$SUBVERSION" ] ; then
23
    echo need to install SUBVERSION
24
    sudo apt-get install subversion
25
    SUBVERSION=`which svn`
26
fi
27
28
echo checking out latest Version
29
if [ ! -d /home/$LOGNAME/BundleBee  ] ; then 
30
    $SUBVERSION co https://dev.innoq.com/svn/bundle-bee/trunk/BundleBee
31
    cd BundleBee/
32
else
33
    cd BundleBee/
34
    $SUBVERSION up
35
fi
36
37
echo building latest Version
38
$ANT -f buildAndRun.xml build
39
40
if [ ! -d /home/$LOGNAME/BB-RT  ] ; then mkdir -p /home/$LOGNAME/BB-RT; fi
41
42
rm -R /home/$LOGNAME/BB-RT/*
43
cd /home/$LOGNAME/BB-RT
44
tar -zxvf ../BundleBee/Assembly/target/org.bundlebee.assembly_*-equinox.tar.gz
45
cd /home/$LOGNAME/BB-RT/plugins
46
47
echo creating backup of config.ini
48
cp config.ini config.ini.old
49
50
echo changing weaving target
51
sed 's/.testbundle/.examples\\\\.fibutest/g' config.ini > 1
52
sed 's/.TestBundleImpl/.FibuTest/g' 1 > 2
53
54
echo set local ip
55
sed "s/org.bundlebee.registry.localaddress\=w.x.y.z/org.bundlebee.registry.localaddress\="$IP"/g" 2 > 3
56
57
echo activate local ip setting
58
sed "s/#org.bundlebee.registry.localaddress/org.bundlebee.registry.localaddress/g" 3 > config.ini
59
60
echo cleaning up...
61
rm 1 2 3
62
cd /home/$LOGNAME/BB-RT
63
/home/$LOGNAME/BB-RT/run.sh