mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-08 02:02:50 +01:00
Add true to end of functions ending with shorthand comparison
Functions ending with test using [[ <false> ]] && <cmd> will trip set -e, so adding true to the last line of the function will prevent the function from returning a nonzero code
This commit is contained in:
@@ -28,11 +28,10 @@ WHATWOULDYOUSAYYAHDOHERE=soup
|
|||||||
|
|
||||||
check_err() {
|
check_err() {
|
||||||
local exit_code=$1
|
local exit_code=$1
|
||||||
local lineno=$2
|
|
||||||
local err_msg="Unhandled error occured, please check $SOUP_LOG for details."
|
local err_msg="Unhandled error occured, please check $SOUP_LOG for details."
|
||||||
|
|
||||||
if [[ $exit_code -ne 0 ]]; then
|
if [[ $exit_code -ne 0 ]]; then
|
||||||
printf '%s' "Soup failed on line $lineno with error $exit_code: "
|
printf '%s' "Soup failed with error $exit_code: "
|
||||||
case $exit_code in
|
case $exit_code in
|
||||||
2)
|
2)
|
||||||
echo 'No such file or directory'
|
echo 'No such file or directory'
|
||||||
@@ -323,11 +322,8 @@ preupgrade_changes_2.3.50_repo() {
|
|||||||
# We made repo changes in 2.3.50 and this prepares for that on upgrade
|
# We made repo changes in 2.3.50 and this prepares for that on upgrade
|
||||||
echo "Checking to see if 2.3.50 repo changes are needed."
|
echo "Checking to see if 2.3.50 repo changes are needed."
|
||||||
|
|
||||||
if [[ "$INSTALLEDVERSION" == 2.3.30 || "$INSTALLEDVERSION" == 2.3.40 ]]; then
|
[[ "$INSTALLEDVERSION" == 2.3.30 || "$INSTALLEDVERSION" == 2.3.40 ]] && up_2.3.3X_to_2.3.50_repo
|
||||||
up_2.3.3X_to_2.3.50_repo
|
true
|
||||||
else
|
|
||||||
echo "No changes needed."
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
preupgrade_changes() {
|
preupgrade_changes() {
|
||||||
@@ -340,6 +336,7 @@ preupgrade_changes() {
|
|||||||
[[ "$INSTALLEDVERSION" == 2.3.0 || "$INSTALLEDVERSION" == 2.3.1 || "$INSTALLEDVERSION" == 2.3.2 || "$INSTALLEDVERSION" == 2.3.10 ]] && up_2.3.0_to_2.3.20
|
[[ "$INSTALLEDVERSION" == 2.3.0 || "$INSTALLEDVERSION" == 2.3.1 || "$INSTALLEDVERSION" == 2.3.2 || "$INSTALLEDVERSION" == 2.3.10 ]] && up_2.3.0_to_2.3.20
|
||||||
[[ "$INSTALLEDVERSION" == 2.3.20 || "$INSTALLEDVERSION" == 2.3.21 ]] && up_2.3.2X_to_2.3.30
|
[[ "$INSTALLEDVERSION" == 2.3.20 || "$INSTALLEDVERSION" == 2.3.21 ]] && up_2.3.2X_to_2.3.30
|
||||||
[[ "$INSTALLEDVERSION" == 2.3.30 || "$INSTALLEDVERSION" == 2.3.40 ]] && up_2.3.3X_to_2.3.50
|
[[ "$INSTALLEDVERSION" == 2.3.30 || "$INSTALLEDVERSION" == 2.3.40 ]] && up_2.3.3X_to_2.3.50
|
||||||
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
postupgrade_changes() {
|
postupgrade_changes() {
|
||||||
@@ -350,6 +347,7 @@ postupgrade_changes() {
|
|||||||
[[ "$POSTVERSION" == 2.3.20 || "$POSTVERSION" == 2.3.21 ]] && post_2.3.2X_to_2.3.30
|
[[ "$POSTVERSION" == 2.3.20 || "$POSTVERSION" == 2.3.21 ]] && post_2.3.2X_to_2.3.30
|
||||||
[[ "$POSTVERSION" == 2.3.30 ]] && post_2.3.30_to_2.3.40
|
[[ "$POSTVERSION" == 2.3.30 ]] && post_2.3.30_to_2.3.40
|
||||||
[[ "$POSTVERSION" == 2.3.50 ]] && post_2.3.5X_to_2.3.60
|
[[ "$POSTVERSION" == 2.3.50 ]] && post_2.3.5X_to_2.3.60
|
||||||
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
post_rc1_to_2.3.21() {
|
post_rc1_to_2.3.21() {
|
||||||
@@ -661,7 +659,6 @@ upgrade_check() {
|
|||||||
is_hotfix=true
|
is_hotfix=true
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "DEBUG: here"
|
|
||||||
is_hotfix=false
|
is_hotfix=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -742,7 +739,7 @@ verify_latest_update_script() {
|
|||||||
|
|
||||||
main() {
|
main() {
|
||||||
set -e
|
set -e
|
||||||
trap 'check_err $? $BASH_LINENO' EXIT
|
trap 'check_err $?' EXIT
|
||||||
|
|
||||||
echo "### Preparing soup at $(date) ###"
|
echo "### Preparing soup at $(date) ###"
|
||||||
while getopts ":b" opt; do
|
while getopts ":b" opt; do
|
||||||
@@ -876,7 +873,7 @@ main() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Only update the repo if its airgap
|
# Only update the repo if its airgap
|
||||||
if [[ $is_airgap -eq 0 ]] && [[ $UPGRADESALT -ne 1 ]]; then
|
if [[ $is_airgap -eq 0 && $UPGRADESALT -ne 1 ]]; then
|
||||||
update_centos_repo
|
update_centos_repo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user