-
Notifications
You must be signed in to change notification settings - Fork 158
/
offline.sh
215 lines (180 loc) · 6.43 KB
/
offline.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
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
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#===============================================================================
# SYSTEM REQUIRED: Linux
# DESCRIPTION: automatic deploy your linux
# AUTHOR: Zhu Maohai.
# website: http://www.centos.bz/ezhttp/
#===============================================================================
cur_dir=`pwd`
#初始化
if [ -f $cur_dir/function/config.sh ];then
. $cur_dir/function/config.sh
else
echo "/config.sh file not found.shell script can't be executed."
exit 1
fi
#载入常用函数
if [ -f $cur_dir/function/public.sh ];then
. $cur_dir/function/public.sh
else
echo "public.sh file not found.shell script can't be executed."
exit 1
fi
#显示各软件菜单
display_menu nginx
display_menu apache
display_menu mysql
display_menu php
echo "which software you'd install:"
for ((i=1;i<=${#other_soft_arr[@]};i++ )); do echo -e "$i) ${other_soft_arr[$i-1]}"; done
echo
other_prompt="please input a number: "
while true
do
read -p "${other_prompt}" other_soft
other_soft=(${other_soft})
unset other_soft_install wrong
for j in ${other_soft[@]}
do
if [ "${other_soft_arr[$j-1]}" == "" ];then
other_soft_prompt="input errors,please input number a number: ";
wrong=1
break
elif [ "${other_soft_arr[$j-1]}" == "do_not_install" ];then
unset other_soft_install
other_soft_install="do_not_install"
break 2
else
other_soft_install="$other_soft_install ${other_soft_arr[$j-1]}"
wrong=0
fi
done
[ "$wrong" == 0 ] && break
done
echo -e "your other software selection ${other_soft_install}"
#开始下载软件
#下载nginx
if [ "$nginx" != "do_not_install" ];then
download_file "${pcre_filename}.tar.gz"
download_file "${openssl_filename}.tar.gz"
download_file "${zlib_filename}.tar.gz"
if [ "$nginx" == "${nginx_filename}" ];then
download_file "${nginx_filename}.tar.gz"
elif [ "$nginx" == "${tengine_filename}" ];then
download_file "${tengine_filename}.tar.gz"
elif [ "$nginx" == "${openresty_filename}" ];then
download_file "${openresty_filename}.tar.gz"
fi
fi
#下载apache
if [ "$apache" != "do_not_install" ];then
download_file "${zlib_filename}.tar.gz"
download_file "${openssl_filename}.tar.gz"
if [ "$apache" == "${apache2_2_filename}" ];then
download_file "${apache2_2_filename}.tar.gz"
elif [ "$apache" == "${apache2_4_filename}" ];then
download_file "${pcre_filename}.tar.gz"
#下载apr和apr-util
download_file "${apr_filename}.tar.gz"
download_file "${apr_util_filename}.tar.gz"
download_file "${apache2_4_filename}.tar.gz"
fi
fi
#下载mysql
if [ "$mysql" != "do_not_install" ];then
if [ "$mysql" == "${mysql5_1_filename}" ];then
download_file "${ncurses_filename2}.tar.gz"
download_file "${mysql5_1_filename}.tar.gz"
elif [ "$mysql" == "${mysql5_5_filename}" ] || [ "$mysql" == "libmysqlclient18" ];then
download_file "${ncurses_filename}.tar.gz"
download_file "${cmake_filename}.tar.gz"
download_file "${m4_filename}.tar.gz"
download_file "${bison_filename}.tar.gz"
download_file "${mysql5_5_filename}.tar.gz"
elif [ "$mysql" == "${mysql5_6_filename}" ];then
download_file "${ncurses_filename}.tar.gz"
download_file "${cmake_filename}.tar.gz"
download_file "${m4_filename}.tar.gz"
download_file "${bison_filename}.tar.gz"
download_file "${mysql5_6_filename}.tar.gz"
fi
fi
#下载php
if [ "$php" != "do_not_install" ];then
download_file "${freetype_filename}.tar.gz"
download_file "${libiconv_filename}.tar.gz"
download_file "${m4_filename}.tar.gz"
download_file "${autoconf_filename}.tar.gz"
download_file "${libxml2_filename}.tar.gz"
download_file "${openssl_filename}.tar.gz"
download_file "${zlib_filename}.tar.gz"
download_file "${libcurl_filename}.tar.gz"
download_file "${pcre_filename}.tar.gz"
download_file "${libtool_filename}.tar.gz"
download_file "${libjpeg_filename}.tar.gz"
download_file "${libpng_filename}.tar.gz"
download_file "${mhash_filename}.tar.gz"
download_file "${libmcrypt_filename}.tar.gz"
if [ "$php" == "${php5_2_filename}" ];then
download_file "${patch_filename}.tar.gz"
download_file "${php5_2_filename}.tar.gz"
elif [ "$php" == "${php5_3_filename}" ];then
download_file "${php5_3_filename}.tar.gz"
elif [ "$php" == "${php5_4_filename}" ];then
download_file "${php5_4_filename}.tar.gz"
fi
#下载php模块
if if_in_array "${ZendOptimizer_filename}" "$php_modules_install";then
download_file "${ZendOptimizer64_filename}.tar.gz"
download_file "${ZendOptimizer32_filename}.tar.gz"
fi
if if_in_array "${eaccelerator_filename}" "$php_modules_install";then
download_file "${m4_filename}.tar.gz"
download_file "${autoconf_filename}.tar.gz"
download_file "${eaccelerator_filename}.tar.bz2"
fi
if if_in_array "${php_memcache_filename}" "$php_modules_install";then
download_file "${zlib_filename}.tar.gz"
download_file "${m4_filename}.tar.gz"
download_file "${autoconf_filename}.tar.gz"
download_file "${php_memcache_filename}.tgz"
fi
if if_in_array "${php_imagemagick_filename}" "$php_modules_install";then
download_file "${ImageMagick_filename}.tar.gz"
download_file "${pkgconfig_filename}.tar.gz"
download_file "${m4_filename}.tar.gz"
download_file "${autoconf_filename}.tar.gz"
download_file "${php_imagemagick_filename}.tgz"
fi
if if_in_array "${ZendGuardLoader_filename}" "$php_modules_install";then
download_file "${ZendGuardLoader53_64_filename}.tar.gz"
download_file "${ZendGuardLoader54_64_filename}.tar.gz"
download_file "${ZendGuardLoader53_32_filename}.tar.gz"
download_file "${ZendGuardLoader54_32_filename}.tar.gz"
fi
if if_in_array "${ionCube_filename}" "$php_modules_install";then
download_file "${ionCube64_filename}.tar.gz"
download_file "${ionCube32_filename}.tar.gz"
fi
fi
#下载soft
if if_in_array "${memcached_filename}" "$other_soft_install";then
download_file "${libevent_filename}.tar.gz"
download_file "${memcached_filename}.tar.gz"
fi
if if_in_array "${PureFTPd_filename}" "$other_soft_install";then
download_file "${PureFTPd_filename}.tar.gz"
fi
if if_in_array "${phpMyAdmin_filename}" "$other_soft_install";then
download_file "${phpMyAdmin_filename}.tar.gz"
fi
#开始打包
cd $cur_dir
if [[ -s ezhttp_offline.tar.gz ]];then
echo "file ezhttp_offline.tar.gz had already exsit,please rename or remove."
exit 1
else
tar czvf ezhttp_offline.tar.gz * && echo "offline package has sucessfully made."
fi