From d7ad3752329e41edcf6a5db4ae51e3bc5be172dd Mon Sep 17 00:00:00 2001 From: Dave Page Date: Wed, 10 Aug 2022 10:36:01 +0100 Subject: [PATCH] Fix additional issues detected by Sonarqube. --- pkg/debian/build.sh | 1 - pkg/linux/build-functions.sh | 1 - pkg/linux/setup-web.sh | 4 ++-- pkg/redhat/repo-rpm.sh | 4 +--- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/pkg/debian/build.sh b/pkg/debian/build.sh index 2b684b5c9..f7e505bb7 100755 --- a/pkg/debian/build.sh +++ b/pkg/debian/build.sh @@ -7,7 +7,6 @@ set -e trap 'ERRCODE=$? && if [ ${ERRCODE} -ne 0 ]; then echo "The command \"${BASH_COMMAND}\" failed in \"${FUNCNAME}\" with exit code ${ERRCODE}."; fi' EXIT OS_VERSION=$(cat /etc/os-release | grep "^VERSION_ID=" | awk -F "=" '{ print $2 }' | sed 's/"//g') -OS_NAME=$(cat /etc/os-release | grep "^ID=" | awk -F "=" '{ print $2 }' | sed 's/"//g') OS_ARCH=$(dpkg-architecture -qDEB_HOST_ARCH) # Stop creating pyc files. diff --git a/pkg/linux/build-functions.sh b/pkg/linux/build-functions.sh index 2c15c9c6d..65c3c5029 100644 --- a/pkg/linux/build-functions.sh +++ b/pkg/linux/build-functions.sh @@ -12,7 +12,6 @@ _setup_env() { APP_REVISION=`grep "^APP_REVISION" web/config.py | cut -d"=" -f2 | sed 's/ //g'` APP_NAME=`grep "^APP_NAME" web/config.py | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //' | sed 's/ //g' | tr '[:upper:]' '[:lower:]'` APP_LONG_VERSION=${APP_RELEASE}.${APP_REVISION} - APP_SHORT_VERSION=`echo ${APP_LONG_VERSION} | cut -d . -f1,2` APP_SUFFIX=`grep "^APP_SUFFIX" web/config.py | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g"` if [ ! -z ${APP_SUFFIX} ]; then APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX} diff --git a/pkg/linux/setup-web.sh b/pkg/linux/setup-web.sh index a279841a3..f54600d39 100755 --- a/pkg/linux/setup-web.sh +++ b/pkg/linux/setup-web.sh @@ -121,7 +121,7 @@ if [ ${IS_DEBIAN} == 1 ]; then esac fi -APACHE_STATUS=`ps cax | grep ${APACHE}` +ps cax | grep ${APACHE} > /dev/null if [ $? -eq 0 ]; then if [ ${AUTOMATED} == 1 ]; then RESPONSE=Y @@ -131,7 +131,7 @@ if [ $? -eq 0 ]; then case ${RESPONSE} in y|Y ) - systemctl restart ${APACHE} + systemctl restart ${APACHE} if [ $? != 0 ]; then echo "Error restarting ${APACHE}. Please check the systemd logs" else diff --git a/pkg/redhat/repo-rpm.sh b/pkg/redhat/repo-rpm.sh index 974ce6935..f5ca37e38 100755 --- a/pkg/redhat/repo-rpm.sh +++ b/pkg/redhat/repo-rpm.sh @@ -18,8 +18,6 @@ trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG trap 'if [ $? -ne 0 ]; then echo "\"${last_command}\" command filed with exit code $?."; fi' EXIT OS_VERSION=$(cat /etc/os-release | grep "^VERSION_ID=" | awk -F "=" '{ print $2 }' | sed 's/"//g') -OS_NAME=$(cat /etc/os-release | grep "^ID=" | awk -F "=" '{ print $2 }' | sed 's/"//g') -OS_ARCH=$(arch) # Common Linux build functions source pkg/linux/build-functions.sh @@ -108,4 +106,4 @@ _create_repo_rpm fedora # Get the results! # test -d "${DISTROOT}/" || mkdir -p "${DISTROOT}/" -cp ${HOME}/rpmbuild/RPMS/noarch/${APP_NAME}-*-repo-${REPO_RPM_VERSION}-${REPO_RPM_BUILD}.noarch.rpm "${DISTROOT}/" \ No newline at end of file +cp ${HOME}/rpmbuild/RPMS/noarch/${APP_NAME}-*-repo-${REPO_RPM_VERSION}-${REPO_RPM_BUILD}.noarch.rpm "${DISTROOT}/"