Commit 76ecbdf0 authored by Philippe Gauron's avatar Philippe Gauron
Browse files

Mise en forme shellcheck

parent 680862e7
......@@ -11,7 +11,7 @@ set +e
## Set to 1 to print every message
DEBUG=1
cd $(dirname "$0")
cd "$(dirname "$0")"
REPO_DIR=$(pwd)/
......@@ -24,7 +24,7 @@ source "${REPO_DIR}/globals.sh"
## Getting installation settings
source "${REPO_DIR}/installation_parameters.sh"
if [[ "${DEBUG}" -eq 1 ]]
if [ "${DEBUG}" -eq 1 ]
then
info "Installation settings"
echo "DOWNLOAD_ONLY=${DOWNLOAD_ONLY}"
......@@ -42,9 +42,9 @@ fi
## ${SERVERNAME} == ${TANGOSERVER} -> TANGO-DB=1
## ARCHIVING=1 -> DATABASE=1
if [[ "${DEPENDENCIES}" -eq 1 ]] \
&& [[ "${DATABASE}" -eq 0 ]] \
&& [[ "${ARCHIVING}" -eq 1 ]]
if [ "${DEPENDENCIES}" -eq 1 ] \
&& [ "${DATABASE}" -eq 0 ] \
&& [ "${ARCHIVING}" -eq 1 ]
then
warning "installation of ARCHIVING asked, DATABASE will be considered set."
DATABASE=1
......@@ -52,7 +52,8 @@ fi
## CLIENT=1 -> TANGO=1
if [ "${DEPENDENCIES}" == "1" ] && [ "${CLIENT}" -eq "1" ]
if [ "${DEPENDENCIES}" == 1 ] \
&& [ "${CLIENT}" -eq 1 ]
then
warning "installation of CLIENT asked, TANGO will be considered set."
TANGO=1
......@@ -60,7 +61,8 @@ fi
## TANGO_DB=1 -> TANGO=1 & DATABASE=1
if [ "${DEPENDENCIES}" == "1" ] && [ "${TANGO_DB}" -eq "1" ]
if [ "${DEPENDENCIES}" == 1 ] \
&& [ "${TANGO_DB}" -eq 1 ]
then
warning "installation of TANGO_DB asked, TANGO will be considered set."
TANGO=1
......@@ -116,12 +118,12 @@ DEBIAN_PACKAGES_CLIENT="ntpdate libx32gcc-6-dev libgl1-mesa-dev:i386 libxinerama
### INSTALLATION TEST
## DATABASE
if [[ "${DATABASE}" -eq 1 ]]
if [ "${DATABASE}" -eq 1 ]
then
OUTPUT_DPKG=$(dpkg -s mariadb-server | grep Status)
if [[ "${OUTPUT_DPKG}" == "Status: install ok installed" ]]
if [ "${OUTPUT_DPKG}" == "Status: install ok installed" ]
then
if [[ "${DEBUG}" -eq 1 ]]
if [ "${DEBUG}" -eq 1 ]
then
info "DB server installed"
fi
......@@ -134,7 +136,7 @@ then
OUTPUT_DPKG=$(dpkg -s mariadb-client | grep Status)
if [ "${OUTPUT_DPKG}" == "Status: install ok installed" ]
then
if [[ "${DEBUG}" -eq 1 ]]
if [ "${DEBUG}" -eq 1 ]
then
info "DB client installed"
fi
......@@ -145,11 +147,11 @@ then
fi
/usr/sbin/service mysql status &> /dev/null && DATABASE_RUNNING=1
if [[ "${DBCLIENT_INSTALLED}" -eq 1 ]] \
&& [[ "${DBSERVER_INSTALLED}" -eq 1 ]] \
&& [[ "${DATABASE_RUNNING}" -eq 1 ]]
if [ "${DBCLIENT_INSTALLED}" -eq 1 ] \
&& [ "${DBSERVER_INSTALLED}" -eq 1 ] \
&& [ "${DATABASE_RUNNING}" -eq 1 ]
then
if [[ "${DEBUG}" -eq 1 ]]
if [ "${DEBUG}" -eq 1 ]
then
info "DATABASE running"
fi
......@@ -161,13 +163,13 @@ fi
##TANGO_DB
if [[ "${TANGO_DB}" -eq 1 ]]
if [ "${TANGO_DB}" -eq 1 ]
then
echo "Following asked password is MariaDB password for tango database"
RESULT_DATABASE=$(mysql -h localhost -u tango tango -p -e "SHOW tables")
if [[ "${RESULT_DATABASE}" != "${CORRECT_OUTPUT_DATABASE}" ]]
RESULT_DATABASE=$(mysql -h "${TANGOSERVER}" -u tango tango -p -e "SHOW tables")
if [ "${RESULT_DATABASE}" != "${CORRECT_OUTPUT_DATABASE}" ]
then
if [[ "${DEBUG}" -eq 1 ]]
if [ "${DEBUG}" -eq 1 ]
then
info "DATABASE successfully installed"
fi
......@@ -177,15 +179,15 @@ then
fi
## TANGO
if [[ "${TANGO}" -eq 1 ]]
if [ "${TANGO}" -eq 1 ]
then
### yat & yat4tango
if [[ -d /usr/include/yat ]] \
&& [[ -d /usr/include/yat4tango ]] \
&& [[ -e /usr/lib/libyat.so ]] \
&& [[ -e /usr/lib/libyat4tango.so ]]
if [ -d /usr/include/yat ] \
&& [ -d /usr/include/yat4tango ] \
&& [ -e /usr/lib/libyat.so ] \
&& [ -e /usr/lib/libyat4tango.so ]
then
if [[ "${DEBUG}" -eq 1 ]]
if [ "${DEBUG}" -eq 1 ]
then
info "yat & yat4tango successfully installed"
fi
......@@ -197,7 +199,7 @@ then
#### check if Java is not openjdk
if [[ $(java -version 2>&1) != *"OpenJDK"* ]]
then
if [[ "${DEBUG}" -eq 1 ]]
if [ "${DEBUG}" -eq 1 ]
then
info "Sun Java JDK successfully installed"
fi
......@@ -210,11 +212,11 @@ then
#### if TangoTest/test is not defined
TANGOTEST_DS_UNDEFINED=1
/usr/lib/tango/tango_admin --check-server TangoTest/test && TANGOTEST_DS_UNDEFINED=0
if [[ ${TANGOTEST_DS_UNDEFINED} -ne 0 ]]
if [ ${TANGOTEST_DS_UNDEFINED} -ne 0 ]
then
warning "TangoTest Device Server is not defined"
else
if [[ "${DEBUG}" -eq 1 ]]
if [ "${DEBUG}" -eq 1 ]
then
info "TangoTest Device Server is defined"
fi
......@@ -223,11 +225,11 @@ then
#### if sys/tg_test/1 is not defined
TANGOTEST_DEVICE_UNDEFINED=1
/usr/lib/tango/tango_admin --check-device sys/tg_test/1 && TANGOTEST_DEVICE_UNDEFINED=0
if [[ "${TANGOTEST_DEVICE_UNDEFINED}" -ne 0 ]]
if [ "${TANGOTEST_DEVICE_UNDEFINED}" -ne 0 ]
then
warning "sys/tg_test/1 device is not defined"
else
if [[ "${DEBUG}" -eq 1 ]]
if [ "${DEBUG}" -eq 1 ]
then
info "sys/tg_test/1 device is defined"
fi
......@@ -236,24 +238,24 @@ then
#### if TangoTest/test does not respond to ping
TANGOTEST_DEVICE_UNREACHABLE=1
/usr/lib/tango/tango_admin --ping-device sys/tg_test/1 && TANGOTEST_DEVICE_UNREACHABLE=0
if [[ "${TANGOTEST_DEVICE_UNREACHABLE}" -ne 0 ]]
if [ "${TANGOTEST_DEVICE_UNREACHABLE}" -ne 0 ]
then
## starts TangoTest device for instance test
/usr/lib/tango/TangoTest test & > /dev/null
sleep 1
TANGOTEST_DEVICE_UNREACHABLE2=1
/usr/lib/tango/tango_admin --ping-device sys/tg_test/1 && TANGOTEST_DEVICE_UNREACHABLE2=0
if [[ "${TANGOTEST_DEVICE_UNREACHABLE2}" -ne 0 ]]
if [ "${TANGOTEST_DEVICE_UNREACHABLE2}" -ne 0 ]
then
warning "TangoTest/test does not respond to ping"
else
if [[ "${DEBUG}" -eq 1 ]]
if [ "${DEBUG}" -eq 1 ]
then
info "TangoTest/test has been started"
fi
fi
else
if [[ "${DEBUG}" -eq 1 ]]
if [ "${DEBUG}" -eq 1 ]
then
info "TangoTest/test started"
fi
......@@ -262,15 +264,15 @@ fi
### CLIENT
if [[ "${CLIENT}" -eq 1 ]]
if [ "${CLIENT}" -eq 1 ]
then
### libzmq libraries (temporary)
if [[ -d /data/shared/lib/ ]] \
&& [[ -e /data/shared/lib/libzmq.so ]] \
&& [[ -e /data/shared/lib/libzmq.so.5 ]] \
&& [[ -e /data/shared/lib/libzmq.so.5.2.1 ]]
if [ -d /data/shared/lib/ ] \
&& [ -e /data/shared/lib/libzmq.so ] \
&& [ -e /data/shared/lib/libzmq.so.5 ] \
&& [ -e /data/shared/lib/libzmq.so.5.2.1 ]
then
if [[ "${DEBUG}" -eq 1 ]]
if [ "${DEBUG}" -eq 1 ]
then
info "local (temporary) libzmq successfully installed"
fi
......@@ -279,12 +281,12 @@ then
fi
### labview libraries
if [[ -d /data/shared/lib/ ]] \
&& [[ -d /data/shared/lib/labview ]] \
&& [[ -d /data/shared/lib/labview/LabVIEW-2014 ]] \
&& [[ -d /data/shared/lib/labview/runtime ]]
if [ -d /data/shared/lib/ ] \
&& [ -d /data/shared/lib/labview ] \
&& [ -d /data/shared/lib/labview/LabVIEW-2014 ] \
&& [ -d /data/shared/lib/labview/runtime ]
then
if [[ "${DEBUG}" -eq 1 ]]
if [ "${DEBUG}" -eq 1 ]
then
info "local LabView libraries for GUI successfully installed"
fi
......@@ -296,12 +298,12 @@ then
for package in ${DEBIAN_PACKAGES_CLIENT}
do
DEBIAN_PACKAGE_NOT_INSTALLED=1
$(dpkg -l | grep ^ii | grep "${package} " > /dev/null) && DEBIAN_PACKAGE_NOT_INSTALLED=0
if [[ "$?" -ne 0 ]]
dpkg -l | grep ^ii | grep "${package} " > /dev/null && DEBIAN_PACKAGE_NOT_INSTALLED=0
if [ "$?" -ne 0 ]
then
warning "debian package ${package} is not installed"
else
if [[ "${DEBUG}" -eq 1 ]]
if [ "${DEBUG}" -eq 1 ]
then
info "debian package ${package} is installed"
fi
......@@ -312,9 +314,9 @@ fi
### TANGO_HOST
source /etc/tangorc
if [[ "${TANGO_HOST}" == "${CORRECT_TANGO_HOST}" ]]
if [ "${TANGO_HOST}" == "${CORRECT_TANGO_HOST}" ]
then
if [[ "${DEBUG}" -eq 1 ]]
if [ "${DEBUG}" -eq 1 ]
then
info "TANGO_HOST correctly set to ${TANGO_HOST}"
fi
......@@ -337,7 +339,7 @@ then
warning "Python is not installed in version 2.7"
ERREUR=2
else
if [[ "${DEBUG}" -eq 1 ]]
if [ "${DEBUG}" -eq 1 ]
then
info "Python is not in version 2.7"
fi
......@@ -346,21 +348,21 @@ fi
## Check package installation of packages needed for taurus
## fandango==13.9.0 taurus==4.4.0 PyYAML==3.13 QtPy==1.2.1 python-qt4 python-qwt5-qt4 python-qtpy qt4-designer pyqt4-dev-tools
for ((package=0;package<${PIP_PACKAGES_NUMBER}; package++))
for ((package=0;package<PIP_PACKAGES_NUMBER; package++))
do
PIP_PACKAGE_NOT_INSTALLED=1
PIP_COMMAND=$(pip show "${PIP_PACKAGES[$package]}") && PIP_PACKAGE_NOT_INSTALLED=0
if [[ "${PIP_PACKAGE_NOT_INSTALLED}" -ne 0 ]]
if [ "${PIP_PACKAGE_NOT_INSTALLED}" -ne 0 ]
then
warning "pip package ${PIP_PACKAGES[$package]} is not installed"
else
COMMAND_VERSION_INCORRECT=1
echo "${PIP_COMMAND}" | grep "${PIP_PACKAGES_VERSION[$package]}" > /dev/null && COMMAND_VERSION_INCORRECT=0
if [[ "${COMMAND_VERSION_INCORRECT}" -ne 0 ]]
if [ "${COMMAND_VERSION_INCORRECT}" -ne 0 ]
then
warning "pip package ${PIP_PACKAGES[$package]} is not installed with version ${PIP_PACKAGES_VERSION[$package]}"
else
if [[ "${DEBUG}" -eq 1 ]]
if [ "${DEBUG}" -eq 1 ]
then
info "pip package ${PIP_PACKAGES[$package]} is installed with version ${PIP_PACKAGES_VERSION[$package]}"
fi
......@@ -372,12 +374,12 @@ done
for package in ${DEBIAN_PACKAGES}
do
DEBIAN_PACKAGE_NOT_INSTALLED=1
$(dpkg -l | grep ^ii | grep "${package} " > /dev/null) && DEBIAN_PACKAGE_NOT_INSTALLED=0
if [[ "$?" -ne 0 ]]
dpkg -l | grep ^ii | grep "${package} " > /dev/null && DEBIAN_PACKAGE_NOT_INSTALLED=0
if [ "$?" -ne 0 ]
then
warning "debian package ${package} is not installed"
else
if [[ "${DEBUG}" -eq 1 ]]
if [ "${DEBUG}" -eq 1 ]
then
info "debian package ${package} is installed"
fi
......@@ -416,4 +418,3 @@ info "La fenêtre qui s'affiche doit avoir un statut vert"
echo "Starting sys/database/2 ATKPanel"
atkpanel sys/database/2
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment