update so-image-common to use es version for es containers

This commit is contained in:
m0duspwnens
2024-09-03 12:36:03 -04:00
parent 4c10282f40
commit 529844eb36
2 changed files with 50 additions and 1 deletions

View File

@@ -168,6 +168,36 @@ check_salt_minion_status() {
return $status
}
# compare es versions and return the highest version
compare_es_versions() {
# Save the original IFS
local OLD_IFS="$IFS"
IFS=.
local i ver1=($1) ver2=($2)
# Restore the original IFS
IFS="$OLD_IFS"
# Compare each segment of the versions
for ((i=0; i<${#ver1[@]}; i++)); do
if [[ -z ${ver2[i]} ]]; then
ver2[i]=0
fi
if ((10#${ver1[i]} > 10#${ver2[i]})); then
echo "$1"
return 0
fi
if ((10#${ver1[i]} < 10#${ver2[i]})); then
echo "$2"
return 0
fi
done
echo "$1" # If versions are equal, return either
return 0
}
copy_new_files() {
# Copy new files over to the salt dir
cd $UPDATE_DIR