dab557dd39e99d4cf6f2cb49465c49a0d9fd09d3
[anna.git] / example / diameter / launcher / DEPLOY_setups.sh
1 #!/bin/sh
2
3 #############
4 # VARIABLES #
5 #############
6 DEPLOY_SCR=`dirname $0`/DEPLOY.sh
7
8 #############
9 # FUNCTIONS #
10 #############
11 _exit() {
12   echo
13   echo $1
14   echo
15   exit 1
16 }
17
18 #############
19 # EXECUTION #
20 #############
21 type=$1
22 target=$2
23
24 echo
25 echo "               ----------------------------"
26 echo "               SETUPS DEPLOYMENT AUTOMATION"
27 echo "               ----------------------------"
28 echo
29 echo "-----------------------------------------------------------"
30 echo "Usage: $0 [type] [target_directory]"
31 echo
32 echo "          type:"
33 echo "                1. Client and server"
34 echo "                2. Ft-client and server"
35 echo "                3. St-client and servers"
36 echo
37 echo "          target_directory:"
38 echo
39 echo "                Non existing directory to install the stuff"
40 echo
41 echo "-----------------------------------------------------------"
42 echo
43 [ "$type" = "" ] && { echo "Which one you want to deploy [1]:" ; read type ; }
44 [ "$type" = "" ] && type=1
45
46 case $type in
47   1)
48     echo "Selected Client-Server"
49     DEPLOY_DIR__dflt=$HOME/ADML-clientAndServer
50   ;;
51
52   2)
53     echo "Selected Client-Server FT"
54     DEPLOY_DIR__dflt=$HOME/ADML-ftclientAndServer
55   ;;
56
57   3)
58     echo "Selected Client-Servers ST"
59     DEPLOY_DIR__dflt=$HOME/ADML-stclientAndServers
60   ;;
61
62   *)
63     echo "Unknown option!"
64     exit 1
65   ;;
66 esac
67 echo
68
69
70 [ "$target" = "" ] && { echo "Directory for deploy [$DEPLOY_DIR__dflt]:" ; read target ; }
71 [ "$target" = "" ] && target=$DEPLOY_DIR__dflt
72 [ -d $target ] && _exit "The directory '$target' already exists !"
73 echo "Target directory: $target"
74
75 case $type in
76   1)
77     $DEPLOY_SCR b $target/ADML-client
78     $DEPLOY_SCR b $target/ADML-server
79     echo "Configuring ..."
80     cd $target/ADML-client
81     echo c | ./configure.sh >/dev/null
82     cd - >/dev/null
83     cd $target/ADML-server
84     echo s | ./configure.sh >/dev/null
85     cd - >/dev/null
86   ;;
87
88   2)
89     $DEPLOY_SCR f $target/ADML-ft-client
90     $DEPLOY_SCR b $target/ADML-server
91     echo "Configuring ..."
92     cd $target/ADML-server
93     echo s | ./configure.sh >/dev/null
94     cd - >/dev/null
95   ;;
96
97   3)
98     $DEPLOY_SCR s $target/ADML-st-client
99     $DEPLOY_SCR b $target/ADML-serverGx
100     $DEPLOY_SCR b $target/ADML-serverRx
101     echo "Configuring ..."
102 #    cd $target/ADML-st-client
103 #    ln -s services_example services
104 #    mv run.sh .run-one.sh
105 #    mv run_all.sh run.sh
106 #    mv operation.sh .operation-one.sh
107 #    mv operation_all.sh operation.sh
108 #    rm dictionary.xml
109 #    cd - >/dev/null
110     cd $target/ADML-serverGx
111     echo s | ./configure.sh >/dev/null
112     sed -i 's/3868/3869/' services.xml
113     # Gx dictionary:
114     ln -sf stacks/other_examples/16777238.xml dictionary.xml
115     cd - >/dev/null
116     cd $target/ADML-serverRx
117     echo s | ./configure.sh >/dev/null
118     # Rx dictionary:
119     ln -sf stacks/other_examples/16777236.xml dictionary.xml
120     cd - >/dev/null
121   ;;
122 esac
123
124 echo
125 echo "Done!"
126 echo
127