Add option to disable SSL certificate check

This commit is contained in:
Benjamin Renard 2016-04-23 11:10:23 +02:00 committed by root
parent bcca8fc5ab
commit 6717c5416b

View file

@ -14,6 +14,7 @@ SLEEP_ON_FAILED=10
CHECK_URL=http://www.roundcube.net/download
DOWNLOAD=0
DOWNLOAD_DIR=$RC_HOME/../upstream
DONT_CHECK_SSL_CERT=0
### DO NOT MODIFY AFTER THIS LINE ###
@ -28,6 +29,7 @@ function usage() {
echo "Usage : $0 [-v] [-n] [-d] [-u]"
echo " -v Verbose mode"
echo " -n Nagios mode"
echo " -S Don't check SSL certificate"
echo " -d Download new release"
echo " -u Upgrade installation"
echo " -a Just run after_upgrade function"
@ -35,7 +37,7 @@ function usage() {
echo " -h Display this help"
}
while getopts ":dvnhuaj" opt; do
while getopts ":dvnShuaj" opt; do
case $opt in
v)
DEBUG=1
@ -43,6 +45,9 @@ while getopts ":dvnhuaj" opt; do
n)
NAGIOS=1
;;
S)
DONT_CHECK_SSL_CERT=1
;;
d)
DOWNLOAD=1
;;
@ -102,10 +107,17 @@ then
exit $?
fi
WGET_SSL_OPT=""
if [ "$DONT_CHECK_SSL_CERT" == "1" ]
then
[ $DEBUG -eq 1 ] && echo "Disable SSL certificate check"
WGET_SSL_OPT="--no-check-certificate"
fi
for i in `seq 1 $MAX_CHECK`
do
tmpfile=`mktemp`
wget -q $CHECK_URL -O $tmpfile
wget $WGET_SSL_OPT -q $CHECK_URL -O $tmpfile
newest=`cat $tmpfile|grep 'downloads.sourceforge.net'|grep 'complete.tar.gz'|head -n 1|sed 's|^.*downloads.sourceforge.net/project/roundcubemail/roundcubemail/\([^/]*\)/roundcubemail-.*$|\1|'`
if [ -n "$newest" ]
then
@ -176,7 +188,7 @@ then
cd "$DOWNLOAD_DIR"
DOWNLOAD_FILE="$( pwd )/roundcubemail-$newest.tar.gz"
[ $DEBUG -eq 1 ] && echo "Download new release in $DOWNLOAD_FILE"
wget -q -O "$DOWNLOAD_FILE" "$DOWNLOAD_URL"
wget $WGET_SSL_OPT -q -O "$DOWNLOAD_FILE" "$DOWNLOAD_URL"
if [ $EXTRACT -eq 1 ]
then
[ $DEBUG -eq 1 ] && echo "Extract new release"