Most of below is just cosmetics. But not all:
- In install.sh `source ./functions.sh bla` is a Bash thing. FreeBSD doesn't come with Bash, and if installed it comes with many dependencies. I think less software = less maintainance. The proper POSIX way should be `. ./functions.sh bla`.
Because that creates an error I posted this all in bugs.
- At many places the download detection is inconsistent (and so on FreeBSD you still need to have AND curl AND wget AND fetch).
Inspired by above problem/solution I created a seperate detect-download.sh. Also that uses the full path of a download command, using the result of $DL
Still I wonder if this simply couldn't be in functions.sh's init()
- In install.sh `source ./functions.sh bla` is a Bash thing. FreeBSD doesn't come with Bash, and if installed it comes with many dependencies. I think less software = less maintainance. The proper POSIX way should be `. ./functions.sh bla`.
Because that creates an error I posted this all in bugs.
- At many places the download detection is inconsistent (and so on FreeBSD you still need to have AND curl AND wget AND fetch).
Inspired by above problem/solution I created a seperate detect-download.sh. Also that uses the full path of a download command, using the result of $DL
Still I wonder if this simply couldn't be in functions.sh's init()
Code:
--- detect-download.sh.orig 2019-01-04 23:49:41 UTC
+++ detect-download.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+DLCMD=
+
+DL=`which wget`; if [ $? -eq 0 ]; then DLCMD="$DL -nv -O "; fi
+DL=`which curl`; if [ $? -eq 0 ]; then DLCMD="$DL -L -o "; fi
+DL=`which fetch`; if [ $? -eq 0 ]; then DLCMD="$DL -o "; fi
+
+if [ "x$DLCMD" = "x" ] ; then
+ echo "ERROR: cannot find common download method curl/wget/fetch."
+else
+ echo "DLCMD is $DLCMD"
+fi
+echo
Code:
--- dist/functions.sh.orig 2019-01-04 23:05:47 UTC
+++ dist/functions.sh
@@ -1,7 +1,5 @@
-
#!/bin/sh
-
init()
{
LSINSTALL_DIR=`pwd`
Code:
--- dist/install.sh.orig 2018-12-31 15:14:02 UTC
+++ dist/install.sh
@@ -6,36 +6,9 @@ OSVER=
OSTYPE=`getconf LONG_BIT`
MARIADBCPUARCH=
-
inst_admin_php()
{
- # detect download method
- OS=`uname -s`
-
- DLCMD=
- DL=`which wget`
- if [ $? -eq 0 ] ; then
- DLCMD="wget -nv -O "
- else
- DL=`which curl`
- if [ $? -eq 0 ] ; then
- DLCMD="curl -L -o "
- else
- if [ "x$OS" = "xFreeBSD" ] ; then
- DL=`which fetch`
- if [ $? -eq 0 ] ; then
- DLCMD="fetch -o "
- fi
- fi
- fi
- fi
-
- if [ "x$DLCMD" = "x" ] ; then
- echo "ERROR: cannot find proper download method curl/wget/fetch."
- fi
-
- echo "DLCMD is $DLCMD"
- echo
+ . ../detect-download.sh
HASADMINPHP=n
if [ -f "$LSWS_HOME/admin/fcgi-bin/admin_php" ] ; then
@@ -84,7 +57,7 @@ inst_admin_php()
chmod "$EXEC_MOD" "$LSWS_HOME/admin/fcgi-bin/admin_php"
fi
- #final checking of existence of admin_php
+ # final checking of existence of admin_php
if [ ! -f "$LSWS_HOME/admin/fcgi-bin/admin_php" ] ; then
echo -e "\033[38;5;148mFinal checking found admin_php not exists, installation abort.\033[39m"
exit 1
@@ -102,8 +75,7 @@ install_lsphp7_centos()
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
if [ ! -f "$LSWS_HOME/lsphp$LSPHPVER/bin/lsphp" ] ; then
- action=reinstall
-
+ action=reinstall
yum -y remove lsphp$LSPHPVER-mysql$ND
yum -y install lsphp$LSPHPVER-mysql$ND
yum -y $action lsphp$LSPHPVER lsphp$LSPHPVER-common lsphp$LSPHPVER-gd lsphp$LSPHPVER-process lsphp$LSPHPVER-mbstring lsphp$LSPHPVER-xml lsphp$LSPHPVER-mcrypt lsphp$LSPHPVER-pdo lsphp$LSPHPVER-imap
@@ -122,17 +94,13 @@ install_lsphp7_debian()
if [ $? != 0 ] ; then
echo "deb http://rpms.litespeedtech.com/debian/ $OSVER main" > /etc/apt/sources.list.d/lst_debian_repo.list
fi
-
wget -O /etc/apt/trusted.gpg.d/lst_debian_repo.gpg http://rpms.litespeedtech.com/debian/lst_debian_repo.gpg
wget -O /etc/apt/trusted.gpg.d/lst_repo.gpg http://rpms.litespeedtech.com/debian/lst_repo.gpg
apt-get -y update
-
- apt-get -y install lsphp$LSPHPVER lsphp$LSPHPVER-mysql lsphp$LSPHPVER-imap lsphp$LSPHPVER-common
-
+ apt-get -y install lsphp$LSPHPVER lsphp$LSPHPVER-mysql lsphp$LSPHPVER-imap lsphp$LSPHPVER-common
if [ ! -f "$LSWS_HOME/lsphp$LSPHPVER/bin/lsphp" ] ; then
- apt-get -y --reinstall install lsphp$LSPHPVER lsphp$LSPHPVER-mysql lsphp$LSPHPVER-imap lsphp$LSPHPVER-common
+ apt-get -y --reinstall install lsphp$LSPHPVER lsphp$LSPHPVER-mysql lsphp$LSPHPVER-imap lsphp$LSPHPVER-common
fi
-
if [ -f "$LSWS_HOME/lsphp$LSPHPVER/bin/lsphp" ] ; then
ln -sf "$LSWS_HOME/lsphp$LSPHPVER/bin/lsphp" "$LSWS_HOME/fcgi-bin/lsphp7"
fi
@@ -248,9 +216,9 @@ inst_lsphp7()
}
-#script start here
+# script start here
cd `dirname "$0"`
-source ./functions.sh 2>/dev/null
+. ./functions.sh 2>/dev/null
if [ $? != 0 ]; then
. ./functions.sh
if [ $? != 0 ]; then
@@ -259,7 +227,7 @@ if [ $? != 0 ]; then
fi
fi
-#If install.sh in admin/misc, need to change directory
+# If install.sh in admin/misc, need to change directory
LSINSTALL_DIR=`dirname "$0"`
#cd $LSINSTALL_DIR/
@@ -373,7 +341,7 @@ fi
if [ -f "$LSWS_HOME/conf/httpd_config.conf" ] ; then
INSTALL_TYPE="upgrade"
- #Now check if the user and group match with the conf file
+ # Now check if the user and group match with the conf file
OLD_USER_CONF=`grep "user" "$LSWS_HOME/conf/httpd_config.conf"`
OLD_GROUP_CONF=`grep "group" "$LSWS_HOME/conf/httpd_config.conf"`
OLD_USER=`expr "$OLD_USER_CONF" : '\s*user\s*\(\S*\)'`
@@ -401,7 +369,7 @@ if [ "x$IS_LSCPD" != "xyes" ] ; then
fi
-#Comment out the below two lines
+# Comment out the below two lines
echo "Target_Dir:$LSWS_HOME User:$WS_USER Group:$WS_GROUP "
if [ "x$IS_LSCPD" != "xyes" ] ; then
@@ -445,7 +413,7 @@ if [ "x$IS_LSCPD" != "xyes" ] ; then
chown "$SDIR_OWN" "$LSWS_HOME/fcgi-bin/lsphp5"
chmod "$EXEC_MOD" "$LSWS_HOME/fcgi-bin/lsphp5"
- #Set default lsphp5
+ # Set default lsphp5
ln -sf "$LSWS_HOME/fcgi-bin/lsphp5" "$LSWS_HOME/fcgi-bin/lsphp"
if [ "x$USE_LSPHP7" = "xyes" ] ; then
@@ -458,7 +426,7 @@ if [ "x$IS_LSCPD" != "xyes" ] ; then
fi
- #compress_admin_file
+ # compress_admin_file
if [ ! -f "$LSWS_HOME/admin/conf/jcryption_keypair" ]; then
$LSWS_HOME/admin/misc/create_admin_keypair.sh
fi
@@ -470,7 +438,7 @@ if [ "x$IS_LSCPD" != "xyes" ] ; then
chmod 0600 "$LSWS_HOME/admin/conf/htpasswd"
- #for root user, we'll try to start it automatically
+ # for root user, we'll try to start it automatically
INST_USER=`id`
INST_USER=`expr "$INST_USER" : 'uid=.*(\(.*\)) gid=.*'`
if [ $INST_USER = "root" ]; then
@@ -506,10 +474,6 @@ END
fi
-
-
echo
echo -e "\033[38;5;148mInstallation finished, Enjoy!\033[39m"
echo
-
-
Code:
--- dlbrotli.sh.orig 2018-12-31 15:14:02 UTC
+++ dlbrotli.sh
@@ -1,9 +1,8 @@
-#! /bin/sh
+#!/bin/sh
cd `dirname "$0"`
echo "Checking libbrotli ..."
-
if [ ! -f brotli-master/out/libbrotlidec-static.a ] ; then
echo -e "\033[38;5;148mDownloading libbrotli latest version and building, it will take several minutes ...\033[39m"
@@ -13,7 +12,8 @@ if [ ! -f brotli-master/out/libbrotlidec
exit 1
fi
- wget --no-check-certificate -O br.zip https://codeload.github.com/google/brotli/zip/master
+ . detect-download.sh
+ $DLCMD br.zip https://codeload.github.com/google/brotli/zip/master
unzip br.zip
cd brotli-master
@@ -34,4 +34,3 @@ else
echo -e "\033[38;5;148mLibbrotli libraries exist.\033[39m"
exit 0
fi
-
Code:
--- dlmaxminddb.sh.orig 2018-12-31 15:14:02 UTC
+++ dlmaxminddb.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
cd `dirname "$0"`
CURDIR=`pwd`
@@ -11,12 +11,13 @@ URL=https://github.com/maxmind/libmaxmin
if [ ! -f "libmaxminddb/src/.libs/libmaxminddb.a" ] ; then
echo -e "\033[38;5;148mDownloading libmaxminddb version $VERSION and building, it will take several minutes ...\033[39m"
- wget --no-check-certificate -O mmdb.tgz $URL
+ . detect-download.sh
+ $DLCMD mmdb.tgz $URL
tar xf mmdb.tgz
mv libmaxminddb-$VERSION ../libmaxminddb
cd ../libmaxminddb
-
- ./bootstrap
+
+ ./bootstrap
./configure --disable-tests
make
Code:
--- dlossl.sh.orig 2018-12-31 15:14:02 UTC
+++ dlossl.sh
@@ -1,13 +1,11 @@
-#! /bin/sh
-#
+#!/bin/sh
+
# This script is to download openssl latest stable and make the static library ready
-# Or,
-# Use your pre-built boringSSL
+# Or, use your pre-built boringSSL
-#For openssl, always use the latest officially released version
+# For openssl, always use the latest officially released version
VERSION=OpenSSL_1_1_1a
-
if [ "x$1" = "xuse_bssl" ] ; then
if [ "x$2" != "x" ] ; then
mkdir ssl
@@ -25,10 +23,6 @@ if [ "x$1" = "xuse_bssl" ] ; then
exit 0;
fi
-
-
-
-
cd `dirname "$0"`
echo "Checking openssl ..."
@@ -36,10 +30,8 @@ if [ ! -f ssl/libcrypto.a ] ; then
echo -e "\033[38;5;148mDownload openssl $VERSION and building, it will take several minutes ...\033[39m"
echo -e "\033[38;5;148mThe url is https://github.com/openssl/openssl/archive/$VERSION.tar.gz\033[39m"
- DL=`which curl`
- DLCMD="$DL -k -L -o ossl.tar.gz"
-
- $DLCMD https://github.com/openssl/openssl/archive/$VERSION.tar.gz
+ . detect-download.sh
+ $DLCMD ossl.tar.gz https://github.com/openssl/openssl/archive/$VERSION.tar.gz
tar xf ossl.tar.gz
rm -rf ssl
mv openssl-$VERSION ssl
Code:
--- fixtimestamp.sh.orig 2019-01-04 14:55:09 UTC
+++ fixtimestamp.sh
@@ -1,10 +1,9 @@
-#When using git clone to get the source code, the timestamp will be lost.
-#then when run make, it will cause re-config issue.
-
#!/bin/sh
+# When using git clone to get the source code, the timestamp will be lost.
+# then when run make, it will cause re-config issue.
-touch aclocal.m4
+touch aclocal.m4
sleep 2
touch Makefile.in
Code:
--- installudns.sh.orig 2018-12-31 15:14:02 UTC
+++ installudns.sh
@@ -1,31 +1,12 @@
#!/bin/sh
-#Download udns source code and install it
-
-# detect download method
-DLCMD=
-DL=`which wget`
-if [ $? -eq 0 ] ; then
- DLCMD="wget -nv -O "
-else
- DL=`which curl`
- if [ $? -eq 0 ] ; then
- DLCMD="curl -L -o "
- else
- if [ "x$OS" = "xFreeBSD" ] ; then
- DL=`which fetch`
- if [ $? -eq 0 ] ; then
- DLCMD="fetch -o "
- fi
- fi
- fi
-fi
+VERSION=0.4
+echo "Will download stable version of the udns library $VERSION and install it"
-echo Will download stable version of the udns library 0.4 and install it
-$DLCMD ./udns.tar.gz http://www.corpit.ru/mjt/udns/udns-0.4.tar.gz
+. detect-download.sh
+$DLCMD udns.tar.gz http://www.corpit.ru/mjt/udns/udns-$VERSION.tar.gz
tar xf udns.tar.gz
-cd udns-0.4/
+cd udns-$VERSION/
./configure
make
cd ../
-
Code:
--- modverinfo.sh.orig 2019-01-04 15:00:25 UTC
+++ modverinfo.sh
@@ -1,8 +1,6 @@
-#! /bin/sh
-#
+#!/bin/sh
+
# This script is to gather pre-defined modules version info
-#
-#
OS=`uname -s`
ALL_VER_INFO=
@@ -19,7 +17,6 @@ if [ "x$OS" = "xLinux" ] ; then
ALL_VER_INFO="$ALL_VER_INFO\tmodpagespeed $DEFINED_VALUE$MODULESPACE"
fi
-
get_file_defined_value src/modules/cache/cache.cpp "#define MODULE_VERSION_INFO"
ALL_VER_INFO="$ALL_VER_INFO\tcache $DEFINED_VALUE$MODULESPACE"
@@ -29,11 +26,7 @@ ALL_VER_INFO="$ALL_VER_INFO\tmodinspecto
get_file_defined_value src/modules/uploadprogress/uploadprogress.cpp "#define MODULE_VERSION_INFO"
ALL_VER_INFO="$ALL_VER_INFO\tuploadprogress $DEFINED_VALUE$MODULESPACE"
-
get_file_defined_value src/modules/modsecurity-ls/mod_security.cpp "#define VERSIONNUMBER"
ALL_VER_INFO="$ALL_VER_INFO\tmod_security $DEFINED_VALUE$MODULESPACE"
-
-
echo $ALL_VER_INFO
-