From df9af405feaf8054e535214bd5f7bb367fae3dbb Mon Sep 17 00:00:00 2001 From: Stefan Pejcic Date: Thu, 15 Aug 2024 15:03:06 +0200 Subject: [PATCH] Update UPDATE.sh --- version/0.2.5/UPDATE.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/version/0.2.5/UPDATE.sh b/version/0.2.5/UPDATE.sh index 02fc1d2c..63e1bf8a 100644 --- a/version/0.2.5/UPDATE.sh +++ b/version/0.2.5/UPDATE.sh @@ -98,6 +98,9 @@ FUNCTIONS=( # update opencli opencli_update + + # repalce ip with username in nginx container files + nginx_change_in # verify_license @@ -251,6 +254,35 @@ opencli_update(){ + +nginx_change_in(){ + + # Check if jq is installed + if ! command -v jq &> /dev/null; then + # Install jq using apt + sudo apt-get update > /dev/null 2>&1 + sudo apt-get install -y -qq jq > /dev/null 2>&1 + # Check if installation was successful + if ! command -v jq &> /dev/null; then + echo "Error: jq installation failed. Please install jq manually and try again." + exit 1 + fi + fi + +DOCKER_USERS=$(opencli user-list --json | jq -r '.[].username') + +# Loop kroz Docker usere i pokreni skript +for USERNAME in $DOCKER_USERS; do + # Run the user-specific script + opencli nginx-update_vhosts $USERNAME +done + +opencli server-recreate_hosts +docker exec nginx bash -c "nginx -t && nginx -s reload" + +} + + run_custom_postupdate_script() { echo "Checking if post-update script is provided.."