|
5 | 5 | # to update current EasyEngine from 2.x to 3.x |
6 | 6 |
|
7 | 7 | old_ee_version="2.2.3" |
| 8 | +new_ee_version="3.0.1" |
8 | 9 | branch=$1 |
9 | 10 |
|
10 | 11 | # Define echo function |
@@ -196,9 +197,27 @@ function update_to_ee3() |
196 | 197 |
|
197 | 198 | } |
198 | 199 |
|
| 200 | +function update_to_ee_latest() |
| 201 | +{ |
| 202 | + ee_lib_echo "Updating Nginx configuration" |
| 203 | + if [ -f /etc/nginx/ee-nginx.conf ]; then |
| 204 | + sed -i "s/X-Powered-By.*/X-Powered-By \"EasyEngine $new_ee_version\";/" /etc/nginx/nginx.conf &>> /dev/null |
| 205 | + elif [ -f /etc/nginx/nginx.conf ]; then |
| 206 | + sed -i "s/X-Powered-By.*/X-Powered-By \"EasyEngine $new_ee_version\";/" /etc/nginx/nginx.conf &>> /dev/null |
| 207 | + fi |
| 208 | +} |
| 209 | + |
199 | 210 | function git_init() |
200 | 211 | { |
201 | | - # Do git intialisation on EasyEngine configuration |
| 212 | + # Do git intialisation on EasyEngine adn Nginx configuration |
| 213 | + if [ -d /etc/nginx ];then |
| 214 | + cd /etc/nginx |
| 215 | + if [ ! -d /etc/nginx/.git ]; then |
| 216 | + git init > /dev/null |
| 217 | + fi |
| 218 | + git add . |
| 219 | + git commit -am "Updated Nginx" > /dev/null |
| 220 | + fi |
202 | 221 | cd /etc/ee |
203 | 222 | if [ ! -d /etc/ee/.git ]; then |
204 | 223 | git init > /dev/null |
@@ -282,6 +301,13 @@ elif [ ! -f /usr/local/bin/ee ]; then |
282 | 301 | install_ee3 | tee -ai $EE_INSTALL_LOG |
283 | 302 | git_init | tee -ai $EE_INSTALL_LOG |
284 | 303 | else |
285 | | - ee_lib_echo_fail "EasyEngine 3 allready installed on your system" | tee -ai $EE_INSTALL_LOG |
| 304 | + ee -v 2>&1 | grep $new_ee_version &>> /dev/null |
| 305 | + if [[ $? -ne 0 ]];then |
| 306 | + update_to_ee_latest | tee -ai $EE_INSTALL_LOG |
| 307 | + install_ee3 | tee -ai $EE_INSTALL_LOG |
| 308 | + git_init | tee -ai $EE_INSTALL_LOG |
| 309 | + service nginx reload &>> /dev/null |
| 310 | + fi |
| 311 | + ee_lib_echo_fail "You allready have EasyEngine $new_ee_version" | tee -ai $EE_INSTALL_LOG |
286 | 312 | exit 1 |
287 | 313 | fi |
0 commit comments