bdc5bd94d8df1fa8f35b32e1817e296e6b22e2ec
[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 "                4. Single deployment"
37 echo
38 echo "          target_directory:"
39 echo
40 echo "                Non existing directory to install the stuff"
41 echo
42 echo "-----------------------------------------------------------"
43 echo
44 [ "$type" = "" ] && { echo "Which one you want to deploy [1]:" ; read type ; }
45 [ "$type" = "" ] && type=1
46
47 case $type in
48   1)
49     echo "Selected Client-Server"
50     DEPLOY_DIR__dflt=$HOME/ADML-clientAndServer
51   ;;
52
53   2)
54     echo "Selected Client-Server FT"
55     DEPLOY_DIR__dflt=$HOME/ADML-ftclientAndServer
56   ;;
57
58   3)
59     echo "Selected Client-Servers ST"
60     DEPLOY_DIR__dflt=$HOME/ADML-stclientAndServers
61   ;;
62
63   4)
64     echo "Selected single deployment"
65     DEPLOY_DIR__dflt=$HOME/ADML-single
66   ;;
67
68   *)
69     echo "Unknown option!"
70     exit 1
71   ;;
72 esac
73 echo
74
75
76 [ "$target" = "" ] && { echo "Directory for deploy [$DEPLOY_DIR__dflt]:" ; read target ; }
77 [ "$target" = "" ] && target=$DEPLOY_DIR__dflt
78 [ -d $target ] && _exit "The directory '$target' already exists !"
79 echo "Target directory: $target"
80
81 case $type in
82   1)
83     $DEPLOY_SCR b $target/ADML-client
84     $DEPLOY_SCR b $target/ADML-server
85     echo "Configuring ..."
86     cd $target/ADML-client
87     echo c | ./configure.sh >/dev/null
88     cd - >/dev/null
89     cd $target/ADML-server
90     echo s | ./configure.sh >/dev/null
91     cd - >/dev/null
92   ;;
93
94   2)
95     $DEPLOY_SCR f $target/ADML-ft-client
96     $DEPLOY_SCR b $target/ADML-server
97     echo "Configuring ..."
98     cd $target/ADML-server
99     echo s | ./configure.sh >/dev/null
100     cd - >/dev/null
101   ;;
102
103   3)
104     $DEPLOY_SCR s $target/ADML-st-client
105     $DEPLOY_SCR b $target/ADML-serverGx
106     $DEPLOY_SCR b $target/ADML-serverRx
107     echo "Configuring ..."
108     cd $target/ADML-serverGx
109     echo s | ./configure.sh >/dev/null
110     sed -i 's/3868/3869/' services.xml
111     # Gx dictionary:
112     ln -sf stack_examples/other/16777238.xml dictionary.xml
113     cd - >/dev/null
114     cd $target/ADML-serverRx
115     echo s | ./configure.sh >/dev/null
116     # Rx dictionary:
117     ln -sf stack_examples/other/16777236.xml dictionary.xml
118     cd - >/dev/null
119   ;;
120
121   4)
122     $DEPLOY_SCR b $target
123     echo "Configuring ..."
124     cd $target
125     echo d | ./configure.sh >/dev/null
126     cd - >/dev/null
127   ;;
128
129 esac
130
131 echo
132 echo "Done!"
133 echo
134