Skip to content

Commit 71ef2d3

Browse files
committed
Update the install options when detect already installed and some minor changes
1 parent 6b27a31 commit 71ef2d3

File tree

1 file changed

+72
-26
lines changed

1 file changed

+72
-26
lines changed

ols1clk.sh

+72-26
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function check_wget
131131
function display_license
132132
{
133133
echoY '**********************************************************************************************'
134-
echoY '* Open LiteSpeed One click installation, Version 1.5 *'
134+
echoY '* Open LiteSpeed One click installation, Version 1.6 *'
135135
echoY '* Copyright (C) 2016 LiteSpeed Technologies, Inc. *'
136136
echoY '**********************************************************************************************'
137137
}
@@ -240,25 +240,40 @@ function update_centos_hashlib
240240
fi
241241
}
242242

243+
243244
function install_ols_centos
244245
{
245246
local action=install
246247
if [ "x$1" = "xUpdate" ] ; then
248+
action=update
249+
elif [ "x$1" = "xReinstall" ] ; then
247250
action=reinstall
248251
fi
249252

250253
local ND=
251254
if [ "x$LSPHPVER" = "x70" ] ; then
252255
ND=nd
253256
if [ "x$OSVER" = "x5" ] ; then
254-
rpm -ivh http://repo.mysql.com/mysql-community-release-el5.rpm
257+
rpm -Uvh http://repo.mysql.com/mysql-community-release-el5.rpm
255258
fi
256259
fi
257260

258261
yum -y $action epel-release
259-
rpm -ivh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el$OSVER.noarch.rpm
262+
rpm -Uvh http://rpms.litespeedtech.com/centos/litespeed-repo-1.1-1.el$OSVER.noarch.rpm
260263
yum -y $action openlitespeed
264+
265+
if [ ! -e $SERVER_ROOT/lsphp$LSPHPVER/bin/lsphp ] ; then
266+
action=install
267+
fi
268+
269+
#special case for lsphp56
270+
if [ "x$action" = "xreinstall" ] && [ "x$LSPHPVER" = "x56" ] ; then
271+
yum -y remove lsphp56-mysql
272+
yum -y install lsphp56-mysql
273+
fi
274+
261275
yum -y $action lsphp$LSPHPVER lsphp$LSPHPVER-common lsphp$LSPHPVER-gd lsphp$LSPHPVER-process lsphp$LSPHPVER-mbstring lsphp$LSPHPVER-mysql$ND lsphp$LSPHPVER-xml lsphp$LSPHPVER-mcrypt lsphp$LSPHPVER-pdo lsphp$LSPHPVER-imap
276+
262277
if [ $? != 0 ] ; then
263278
echoR "An error occured during openlitespeed installation."
264279
ALLERRORS=1
@@ -270,6 +285,10 @@ function install_ols_centos
270285
function uninstall_ols_centos
271286
{
272287
yum -y remove openlitespeed
288+
if [ $? != 0 ] ; then
289+
echoR "An error occured while uninstalling openlitespeed."
290+
ALLERRORS=1
291+
fi
273292

274293
#Need to find what is current lsphp version
275294
yum list installed | grep lsphp | grep process >/dev/null 2>&1
@@ -283,15 +302,16 @@ function uninstall_ols_centos
283302
ND=nd
284303
fi
285304

286-
yum -y remove lsphp$LSPHPVER lsphp$LSPHPVER-common lsphp$LSPHPVER-gd lsphp$LSPHPVER-process lsphp$LSPHPVER-mbstring lsphp$LSPHPVER-mysql$ND lsphp$LSPHPVER-xml lsphp$LSPHPVER-mcrypt lsphp$LSPHPVER-pdo lsphp$LSPHPVER-imap
305+
yum -y remove lsphp$LSPHPVER lsphp$LSPHPVER-common lsphp$LSPHPVER-gd lsphp$LSPHPVER-process lsphp$LSPHPVER-mbstring lsphp$LSPHPVER-mysql$ND lsphp$LSPHPVER-xml lsphp$LSPHPVER-mcrypt lsphp$LSPHPVER-pdo lsphp$LSPHPVER-imap lsphp*
287306
if [ $? != 0 ] ; then
288-
echoR "An error occured while uninstalling openlitespeed."
307+
echoR "An error occured while uninstalling lsphp$LSPHPVER"
289308
ALLERRORS=1
290309
fi
291310

292311
else
312+
yum -y remove lsphp*
293313
echoR "Uninstallation cannot get the version of the currently installed lsphp."
294-
echoR "Can not uninstall lsphp correctly."
314+
echoY "May not uninstall lsphp correctly."
295315
LSPHPVER=
296316
fi
297317

@@ -300,21 +320,34 @@ function uninstall_ols_centos
300320

301321
function install_ols_debian
302322
{
303-
local action=install
323+
local action=
304324
if [ "x$1" = "xUpdate" ] ; then
305-
action=reinstall
325+
action="--only-upgrade"
326+
elif [ "x$1" = "xReinstall" ] ; then
327+
#FIXME: action="--reinstall"
328+
action=
329+
fi
330+
331+
332+
grep -Fq "http://rpms.litespeedtech.com/debian/" /etc/apt/sources.list.d/lst_debian_repo.list
333+
if [ $? != 0 ] ; then
334+
echo "deb http://rpms.litespeedtech.com/debian/ $OSVER main" > /etc/apt/sources.list.d/lst_debian_repo.list
306335
fi
307336

308-
echo "deb http://rpms.litespeedtech.com/debian/ $OSVER main" > /etc/apt/sources.list.d/lst_debian_repo.list
309337
wget -O /etc/apt/trusted.gpg.d/lst_debian_repo.gpg http://rpms.litespeedtech.com/debian/lst_debian_repo.gpg
310338
apt-get -y update
311-
apt-get -y install openlitespeed
312-
apt-get -y install lsphp$LSPHPVER lsphp$LSPHPVER-mysql lsphp$LSPHPVER-imap
339+
apt-get -y install $action openlitespeed
340+
341+
if [ ! -e $SERVER_ROOT/lsphp$LSPHPVER/bin/lsphp ] ; then
342+
action=
343+
fi
344+
apt-get -y install $action lsphp$LSPHPVER lsphp$LSPHPVER-mysql lsphp$LSPHPVER-imap
313345

346+
314347
if [ "x$LSPHPVER" != "x70" ] ; then
315-
apt-get -y install lsphp$LSPHPVER-gd lsphp$LSPHPVER-mcrypt
348+
apt-get -y install $action lsphp$LSPHPVER-gd lsphp$LSPHPVER-mcrypt
316349
else
317-
apt-get -y install lsphp$LSPHPVER-common
350+
apt-get -y install $action lsphp$LSPHPVER-common
318351
fi
319352

320353
if [ $? != 0 ] ; then
@@ -336,21 +369,21 @@ function uninstall_ols_debian
336369
LSPHPVER=`echo $LSPHPSTR | awk '{print substr($2,6,2)}'`
337370
echoY "The installed version of lsphp is $LSPHPVER"
338371

339-
apt-get -y --purge remove lsphp$LSPHPVER lsphp$LSPHPVER-mysql lsphp$LSPHPVER-imap
340-
341372
if [ "x$LSPHPVER" != "x70" ] ; then
342373
apt-get -y --purge remove lsphp$LSPHPVER-gd lsphp$LSPHPVER-mcrypt
343374
else
344375
apt-get -y --purge remove lsphp$LSPHPVER-common
345376
fi
346-
377+
378+
apt-get -y --purge remove lsphp$LSPHPVER lsphp$LSPHPVER-mysql lsphp$LSPHPVER-imap 'lsphp*'
347379
if [ $? != 0 ] ; then
348380
echoR "An error occured while uninstalling openlitespeed/lsphp."
349381
ALLERRORS=1
350382
fi
351383
else
384+
apt-get -y --purge remove lsphp*
352385
echoR "Uninstallation cannot get the version of the currently installed lsphp."
353-
echoR "Can not uninstall lsphp correctly."
386+
echoR "May not uninstall lsphp correctly."
354387
LSPHPVER=
355388
fi
356389

@@ -507,8 +540,12 @@ END
507540
apt-get install software-properties-common
508541
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
509542
fi
510-
echo "deb [$MARIADBCPUARCH] http://mirror.jaleco.com/mariadb/repo/10.1/$OSNAME $OSVER main" > /etc/apt/sources.list.d/mariadb_repo.list
511-
543+
544+
grep -Fq "http://mirror.jaleco.com/mariadb/repo/" /etc/apt/sources.list.d/mariadb_repo.list
545+
if [ $? != 0 ] ; then
546+
echo "deb [$MARIADBCPUARCH] http://mirror.jaleco.com/mariadb/repo/10.1/$OSNAME $OSVER main" > /etc/apt/sources.list.d/mariadb_repo.list
547+
fi
548+
512549
apt-get -y -f --force-yes install mariadb-server
513550
if [ $? != 0 ] ; then
514551
echoR "An error occured during installation of MariaDB. Please fix this error and try again."
@@ -684,8 +721,17 @@ function install_ols
684721
{
685722
local STATUS=Install
686723
if [ "x$OLSINSTALLED" = "x1" ] ; then
687-
echoY "OpenLiteSpeed is already installed, will attempt to update it."
688-
STATUS=Update
724+
OLS_VERSION=$(cat "$SERVER_ROOT"/VERSION)
725+
wget -O "$SERVER_ROOT"/release.tmp http://open.litespeedtech.com/packages/release?ver=$OLS_VERSION
726+
LATEST_VERSION=$(cat "$SERVER_ROOT"/release.tmp)
727+
rm "$SERVER_ROOT"/release.tmp
728+
if [ "x$OLS_VERSION" = "x$LATEST_VERSION" ] ; then
729+
STATUS=Reinstall
730+
echoY "OpenLiteSpeed is already installed with the latest version, will attempt to reinstall it."
731+
else
732+
STATUS=Update
733+
echoY "OpenLiteSpeed is already installed and newer version is available, will attempt to update it."
734+
fi
689735
fi
690736

691737
if [ "x$OSNAME" = "xcentos" ] ; then
@@ -726,16 +772,16 @@ map wordpress $SITEDOMAIN
726772
module cache {
727773
param <<<PARAMFLAG
728774
729-
enableCache 1
775+
enableCache 0
730776
qsCache 1
731777
reqCookieCache 1
732778
respCookieCache 1
733779
ignoreReqCacheCtrl 1
734780
ignoreRespCacheCtrl 0
735-
expireInSeconds 2000
736-
maxStaleAge 1000
737-
enablePrivateCache 1
738-
privateExpireInSeconds 1000
781+
expireInSeconds 3600
782+
maxStaleAge 200
783+
enablePrivateCache 0
784+
privateExpireInSeconds 3600
739785
checkPrivateCache 1
740786
checkPublicCache 1
741787
maxCacheObjSize 100000000

0 commit comments

Comments
 (0)