mirror of
https://github.com/saltstack/salt-bootstrap.git
synced 2025-04-16 09:40:21 +00:00
Avoid subshell overhead and remove unnecessary parens around conditions
Fixes the following shellcheck violations: - SC2233: Remove superfluous (..) around condition. - SC2235: Use { ..; } instead of (..) to avoid subshell overhead.
This commit is contained in:
parent
71af9303e9
commit
20a89d31bc
1 changed files with 16 additions and 14 deletions
|
@ -1511,8 +1511,8 @@ __check_end_of_life_versions() {
|
|||
# = 17.04
|
||||
if [ "$DISTRO_MAJOR_VERSION" -lt 14 ] || \
|
||||
[ "$DISTRO_MAJOR_VERSION" -eq 15 ] || \
|
||||
([ "$DISTRO_MAJOR_VERSION" -eq 17 ] && [ "$DISTRO_MINOR_VERSION" -eq 04 ]) || \
|
||||
([ "$DISTRO_MAJOR_VERSION" -lt 17 ] && [ "$DISTRO_MINOR_VERSION" -eq 10 ]); then
|
||||
{ [ "$DISTRO_MAJOR_VERSION" -eq 17 ] && [ "$DISTRO_MINOR_VERSION" -eq 04 ]; } || \
|
||||
{ [ "$DISTRO_MAJOR_VERSION" -lt 17 ] && [ "$DISTRO_MINOR_VERSION" -eq 10 ]; }; then
|
||||
echoerror "End of life distributions are not supported."
|
||||
echoerror "Please consider upgrading to the next stable. See:"
|
||||
echoerror " https://wiki.ubuntu.com/Releases"
|
||||
|
@ -1526,7 +1526,7 @@ __check_end_of_life_versions() {
|
|||
# <= 13.X
|
||||
# <= 42.1
|
||||
if [ "$DISTRO_MAJOR_VERSION" -le 13 ] || \
|
||||
([ "$DISTRO_MAJOR_VERSION" -eq 42 ] && [ "$DISTRO_MINOR_VERSION" -le 1 ]); then
|
||||
{ [ "$DISTRO_MAJOR_VERSION" -eq 42 ] && [ "$DISTRO_MINOR_VERSION" -le 1 ]; }; then
|
||||
echoerror "End of life distributions are not supported."
|
||||
echoerror "Please consider upgrading to the next stable. See:"
|
||||
echoerror " http://en.opensuse.org/Lifetime"
|
||||
|
@ -1544,8 +1544,8 @@ __check_end_of_life_versions() {
|
|||
SUSE_PATCHLEVEL="00"
|
||||
fi
|
||||
if [ "$DISTRO_MAJOR_VERSION" -lt 11 ] || \
|
||||
([ "$DISTRO_MAJOR_VERSION" -eq 11 ] && [ "$SUSE_PATCHLEVEL" -lt 04 ]) || \
|
||||
([ "$DISTRO_MAJOR_VERSION" -eq 12 ] && [ "$SUSE_PATCHLEVEL" -lt 02 ]); then
|
||||
{ [ "$DISTRO_MAJOR_VERSION" -eq 11 ] && [ "$SUSE_PATCHLEVEL" -lt 04 ]; } || \
|
||||
{ [ "$DISTRO_MAJOR_VERSION" -eq 12 ] && [ "$SUSE_PATCHLEVEL" -lt 02 ]; }; then
|
||||
echoerror "Versions lower than SuSE 11 SP4 or 12 SP2 are not supported."
|
||||
echoerror "Please consider upgrading to the next stable"
|
||||
echoerror " https://www.suse.com/lifecycle/"
|
||||
|
@ -1625,7 +1625,8 @@ __check_end_of_life_versions() {
|
|||
|
||||
freebsd)
|
||||
# FreeBSD versions lower than 9.1 are not supported.
|
||||
if ([ "$DISTRO_MAJOR_VERSION" -eq 9 ] && [ "$DISTRO_MINOR_VERSION" -lt 01 ]) || [ "$DISTRO_MAJOR_VERSION" -lt 9 ]; then
|
||||
if { [ "$DISTRO_MAJOR_VERSION" -eq 9 ] && [ "$DISTRO_MINOR_VERSION" -lt 01 ]; } || \
|
||||
[ "$DISTRO_MAJOR_VERSION" -lt 9 ]; then
|
||||
echoerror "Versions lower than FreeBSD 9.1 are not supported."
|
||||
exit 1
|
||||
fi
|
||||
|
@ -1727,7 +1728,7 @@ elif [ "${DISTRO_NAME_L}" = "debian" ]; then
|
|||
__debian_codename_translation
|
||||
fi
|
||||
|
||||
if ([ "$(echo "${DISTRO_NAME_L}" | grep -E '(debian|ubuntu|centos|red_hat|oracle|scientific|amazon)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]); then
|
||||
if [ "$(echo "${DISTRO_NAME_L}" | grep -E '(debian|ubuntu|centos|red_hat|oracle|scientific|amazon)')" = "" ] && [ "$ITYPE" = "stable" ] && [ "$STABLE_REV" != "latest" ]; then
|
||||
echoerror "${DISTRO_NAME} does not have major version pegged packages support"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -1742,13 +1743,13 @@ if [ "${ITYPE}" = "testing" ]; then
|
|||
fi
|
||||
|
||||
# Only Ubuntu has support for installing to virtualenvs
|
||||
if ([ "${DISTRO_NAME_L}" != "ubuntu" ] && [ "$_VIRTUALENV_DIR" != "null" ]); then
|
||||
if [ "${DISTRO_NAME_L}" != "ubuntu" ] && [ "$_VIRTUALENV_DIR" != "null" ]; then
|
||||
echoerror "${DISTRO_NAME} does not have -V support"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Only Ubuntu has support for pip installing all packages
|
||||
if ([ "${DISTRO_NAME_L}" != "ubuntu" ] && [ $_PIP_ALL -eq $BS_TRUE ]); then
|
||||
if [ "${DISTRO_NAME_L}" != "ubuntu" ] && [ $_PIP_ALL -eq $BS_TRUE ]; then
|
||||
echoerror "${DISTRO_NAME} does not have -a support"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -3310,7 +3311,7 @@ install_debian_git_post() {
|
|||
# Configure SystemD for Debian 8 "Jessie" and later
|
||||
if [ -f /bin/systemctl ]; then
|
||||
if [ ! -f /lib/systemd/system/salt-${fname}.service ] || \
|
||||
([ -f /lib/systemd/system/salt-${fname}.service ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]); then
|
||||
{ [ -f /lib/systemd/system/salt-${fname}.service ] && [ $_FORCE_OVERWRITE -eq $BS_TRUE ]; }; then
|
||||
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" ]; then
|
||||
__copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.service" /lib/systemd/system
|
||||
__copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.environment" "/etc/default/salt-${fname}"
|
||||
|
@ -3329,7 +3330,7 @@ install_debian_git_post() {
|
|||
|
||||
# Install initscripts for Debian 7 "Wheezy"
|
||||
elif [ ! -f "/etc/init.d/salt-$fname" ] || \
|
||||
([ -f "/etc/init.d/salt-$fname" ] && [ "$_FORCE_OVERWRITE" -eq $BS_TRUE ]); then
|
||||
{ [ -f "/etc/init.d/salt-$fname" ] && [ "$_FORCE_OVERWRITE" -eq $BS_TRUE ]; }; then
|
||||
if [ -f "${_SALT_GIT_CHECKOUT_DIR}/pkg/salt-$fname.init" ]; then
|
||||
__copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.init" "/etc/init.d/salt-${fname}"
|
||||
__copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/salt-${fname}.environment" "/etc/default/salt-${fname}"
|
||||
|
@ -3844,13 +3845,13 @@ install_centos_git_post() {
|
|||
|
||||
if [ -f /bin/systemctl ]; then
|
||||
if [ ! -f "/usr/lib/systemd/system/salt-${fname}.service" ] || \
|
||||
([ -f "/usr/lib/systemd/system/salt-${fname}.service" ] && [ "$_FORCE_OVERWRITE" -eq $BS_TRUE ]); then
|
||||
{ [ -f "/usr/lib/systemd/system/salt-${fname}.service" ] && [ "$_FORCE_OVERWRITE" -eq $BS_TRUE ]; }; then
|
||||
__copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}.service" /usr/lib/systemd/system
|
||||
fi
|
||||
|
||||
SYSTEMD_RELOAD=$BS_TRUE
|
||||
elif [ ! -f "/etc/init.d/salt-$fname" ] || \
|
||||
([ -f "/etc/init.d/salt-$fname" ] && [ "$_FORCE_OVERWRITE" -eq $BS_TRUE ]); then
|
||||
{ [ -f "/etc/init.d/salt-$fname" ] && [ "$_FORCE_OVERWRITE" -eq $BS_TRUE ]; }; then
|
||||
__copyfile "${_SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname}" /etc/init.d
|
||||
chmod +x /etc/init.d/salt-${fname}
|
||||
fi
|
||||
|
@ -5699,7 +5700,8 @@ install_opensuse_git_post() {
|
|||
if [ -f /bin/systemctl ]; then
|
||||
use_usr_lib=$BS_FALSE
|
||||
|
||||
if [ "${DISTRO_MAJOR_VERSION}" -gt 13 ] || ([ "${DISTRO_MAJOR_VERSION}" -eq 13 ] && [ "${DISTRO_MINOR_VERSION}" -ge 2 ]); then
|
||||
if [ "${DISTRO_MAJOR_VERSION}" -gt 13 ] || \
|
||||
{ [ "${DISTRO_MAJOR_VERSION}" -eq 13 ] && [ "${DISTRO_MINOR_VERSION}" -ge 2 ]; }; then
|
||||
use_usr_lib=$BS_TRUE
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue