This repository has been archived by the owner on Dec 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkettle_launcher.sh
executable file
·148 lines (117 loc) · 3.25 KB
/
kettle_launcher.sh
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/bin/bash
DIRECTORY='Kettle/'
KETTLE_HOME=~/.kettle/
if [ -d "$DIRECTORY" ]
then
KETTLE_DIR="${DIRECTORY}"
else
echo "ERROR: No Kettle dir found"
fi
echo "Projects"
echo -e "-----------------------\n"
COUNTER=0
shopt -s nullglob
for d in */ ; do
if [ $d != "Kettle/" ]
then
let COUNTER=COUNTER+1
echo "${COUNTER}" : "${d%/}"
PROJECTS[COUNTER]=$d
fi
done
echo -e "\nchoose a project :"
read PROJECTNUMBER
echo -e "\n"
cd "${PROJECTS[${PROJECTNUMBER}]}"
#check if there is a config file on the top level else check if there are subprojects
if [ -e "config.cfg" ]
then
KETTLE_VERSION=`awk -F"=" '/^KETTLE_VERSION/ { print $2 }' config.cfg`
if [ -z "$KETTLE_VERSION" ]
then
echo "ERROR: could not load kettle version from config file"
exit
fi
if [ -d "../${KETTLE_DIR}${KETTLE_VERSION}" ]
then
echo "INFO: starting Kettle version ${KETTLE_VERSION}"
else
echo "ERROR: can not find specified kettle version"
exit
fi
if [ -e "jdbc.properties" ]
then
cp jdbc.properties "../${KETTLE_DIR}${KETTLE_VERSION}/simple-jndi/"
else
echo "INFO: No JDBC file for project: ${PROJECTS[${PROJECTNUMBER}]} creating empty file"
>"../${KETTLE_DIR}${KETTLE_VERSION}/simple-jndi/jdbc.properties"
fi
if [ -d "./pwd" ]
then
rm -r "../${KETTLE_DIR}${KETTLE_VERSION}/pwd"
cp -R "./pwd" "../${KETTLE_DIR}${KETTLE_VERSION}"
else
echo "INFO: No carte configuration found will use what is present in kettle directory"
fi
export KETTLE_HOME=$PWD
cd ../${KETTLE_DIR}${KETTLE_VERSION}
./spoon.sh
else
#do the folder loop again to find the subprojects
echo "Subprojecs/Environment"
echo -e "-----------------------\n"
SUBCOUNTER=0
shopt -s nullglob
for dd in */ ; do
let SUBCOUNTER=SUBCOUNTER+1
echo "${SUBCOUNTER}" : "${dd%/}"
SUBPROJECTS[SUBCOUNTER]=$dd
done
#check if there are any folders in the array
if [ -z "${SUBPROJECTS[1]}" ]
then
echo "ERROR: this project either contains no subprojects or no config.cfg file"
exit
fi
echo "choose a subproject :"
read SUBPROJECTNUMBER
echo -e "\n"
cd "${SUBPROJECTS[${SUBPROJECTNUMBER}]}"
#check if the subproject has a config file else fail
if [ -e "config.cfg" ]
then
KETTLE_VERSION=`awk -F"=" '/^KETTLE_VERSION/ { print $2 }' config.cfg`
if [ -z "$KETTLE_VERSION" ]
then
echo "ERROR: could not load kettle version from config file"
exit
fi
if [ -d "../../${KETTLE_DIR}${KETTLE_VERSION}" ]
then
echo "INFO: starting Kettle version ${KETTLE_VERSION}"
else
echo "ERROR: can not find specified kettle version"
exit
fi
if [ -e "jdbc.properties" ]
then
cp jdbc.properties ../../${KETTLE_DIR}${KETTLE_VERSION}/simple-jndi/
else
echo "INFO: No JDBC file for project: ${PROJECTS[${PROJECTNUMBER}]} creating empty file"
>"../../${KETTLE_DIR}${KETTLE_VERSION}/simple-jndi/jdbc.properties"
fi
if [ -d "./pwd" ]
then
rm -r "../../${KETTLE_DIR}${KETTLE_VERSION}/pwd"
cp -R "./pwd" "../../${KETTLE_DIR}${KETTLE_VERSION}"
else
echo "INFO: No carte configuration found will use what is present in kettle directory"
fi
export KETTLE_HOME=$PWD
cd "../../${KETTLE_DIR}${KETTLE_VERSION}"
./spoon.sh
else
echo "ERROR: could not find subproject"
exit
fi
fi