forked from chezbas/lisha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pack
executable file
·237 lines (190 loc) · 5.02 KB
/
pack
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
#!/bin/sh
###################################################
# Functions section
###################################################
help_message()
{
echo ""
}
###################################################
nb_param=$#
###################################################
# Check if release directory exists
# Name of release directory
###################################################
release_version="d"
while !(test -d $release_version -a -n $release_version )
do
echo -n "Release directory name (lisha1.00): "
read release_version
if (test -z $release_version)
then
release_version="lisha1.00"
else
if !(test -d $release_version )
then
echo "ERROR : $release_version is not a directory... try again"
fi
fi
done
###################################################
pack_name="package"
###################################################
# Build mode
###################################################
build_mode="-"
while !([ $build_mode = "f" ] || [ $build_mode = "t" ] || [ $build_mode = "c" ] )
do
echo -n "Build mode (f)ull/(t)hin/(c)ustom (c): "
read build_mode
if (test -z $build_mode)
then
build_mode="c"
fi
done
#exit $?
if test $build_mode = "c"
then
echo "---- CUSTOM MODE ----"
echo -n "include documentation (y)/n: "
read documentation
if !(test $documentation)
then
documentation="y"
fi
echo -n "include tickets (y)/n: "
read tickets
if !(test $tickets)
then
tickets="y"
fi
echo -n "include demo (y)/n: "
read demo
if !(test $demo)
then
demo="y"
fi
echo -n "Keep configuration table (y)/n: "
read table_conf
if !(test $table_conf)
then
table_conf="y"
fi
fi
if test $build_mode = "t"
then
echo "---- Thin Build ----"
echo "include documentation : no"
documentation="n"
echo "include tickets : no"
tickets="n"
echo "include demo : no"
echo "no demo"
demo="n"
echo "include configuration table : yes"
table_conf="y"
fi
if test $build_mode = "f"
then
echo "---- Full Build ----"
echo "include documentation : yes"
documentation="y"
echo "include tickets : yes"
tickets="y"
echo "include demo : yes"
demo="y"
echo "include configuration table : yes"
table_conf="y"
fi
###################################################
###################################################
# Clean up and make working directory pack_name
###################################################
if (test -d $release_version.7z )
then
rm -R $release_version.7z
fi
if (test -d $pack_name )
then
rm -R $pack_name
fi
mkdir $pack_name
###################################################
# Copie all files to temporary directory
cp -R $release_version $pack_name
base_tmp=$pack_name/$release_version
# Remove always sources
rm -R $base_tmp/theme/all.psd
if test $documentation = "y"
then
echo "Keep documentation files"
# tables doc
table_doc="lisha_mt_doc_tech lisha_mt_doc_tech_caption lisha_mt_doc_user lisha_mt_doc_user_caption mt_conf mt_lang mt_text lisha_extra_screen_text"
else
echo "Remove documentation files"
rm -R $base_tmp/doc_tech
rm -R $base_tmp/doc_user
rm -R $base_tmp/ajax/doc
rm -R $base_tmp/css/home
rm -R $base_tmp/js/home
rm -R $base_tmp/MT0.10
rm $base_tmp/indextech.php # technical doc home page
rm $base_tmp/indextech.php # user doc home page
# no tables doc
table_doc=""
fi
if test $tickets = "y"
then
echo "Keep tickets files"
# tables tickets
table_tickets="bugsclass bugsreports bugstexts"
else
echo "Remove tickets files"
rm -R $base_tmp/bugs
# tables tickets
table_tickets=""
fi
if test $demo = "y"
then
echo "Keep demo files"
cp -R demo $pack_name
table_demo="demo_table demo_screen_texts"
else
echo "Remove demo files"
table_demo=""
fi
if test $table_conf = "y"
then
echo "Keep configuration table"
table_conf="lisha_config lisha_language lisha_filter"
else
echo "Remove configuration table"
table_conf=""
fi
# Readme
cp readme.txt $pack_name
# Replace generic directory name by true value
sed -i 's/\$package_directory_name\$/'$release_version'/' $pack_name/readme.txt
# Main includes setup
mkdir $pack_name/includes
mkdir $pack_name/includes/lishaSetup
cp includes/lishaSetup/main_configuration.php $pack_name/includes/lishaSetup/main_configuration.php
###################################################
# Database dump
###################################################
mysqldump --databases lisha --tables $table_conf $table_demo $table_doc $table_tickets lisha_text lisha_internal --add-drop-table --quick -u root --password=demo > $pack_name/MySQL_lisha.sql
###################################################
###################################################
# Compress package
###################################################
string_compression="$release_version.7z $pack_name"
7z a $string_compression
###################################################
#Remove temporary directory
rm -R $pack_name
###################################################
# Set Rights
###################################################
chown -R gwuser $release_version.7z
chmod -R 777 $release_version.7z
###################################################