From 05c7c8f0dd0831cad9e7027eca40581b610e92a3 Mon Sep 17 00:00:00 2001 From: mag37 Date: Wed, 1 Feb 2023 19:39:43 +0100 Subject: [PATCH] sort + compose-path Added alphabetical sorting to the lists. Changed the path accessing the compose-file to be referencing the **actual** compose-file, not just the working dir. That way allowing people to have different naming-schemes for their composes. --- dockcheck.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dockcheck.sh b/dockcheck.sh index 5667a79..b0458d6 100644 --- a/dockcheck.sh +++ b/dockcheck.sh @@ -1,5 +1,5 @@ #!/bin/bash -### VERSION v.0.1.0 +### VERSION v.0.1.1 ### Help Function: Help() { @@ -100,6 +100,12 @@ for i in $(docker ps --filter "name=$SearchName" --format '{{.Names}}') ; do fi done +### Sort arrays alphabetically +IFS=$'\n' +NoUpdates=($(sort <<<"${NoUpdates[*]}")) +GotUpdates=($(sort <<<"${GotUpdates[*]}")) +GotErrors=($(sort <<<"${GotErrors[*]}")) +unset IFS ### Create new Array to use for the numbered list: NumberedUpdates=(ALL "${GotUpdates[@]}") @@ -129,9 +135,9 @@ if [ -n "$GotUpdates" ] ; then if [ "$UpdYes" != "${UpdYes#[Yy]}" ] ; then for i in "${SelectedUpdates[@]}" do - ContPath=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.working_dir"}}') - $DockerBin -f "$ContPath/docker-compose.yml" pull - $DockerBin -f "$ContPath/docker-compose.yml" up -d + ContPath=$(docker inspect "$i" --format '{{ index .Config.Labels "com.docker.compose.project.config_files"}}') + $DockerBin -f "$ContPath" pull + $DockerBin -f "$ContPath" up -d done else printf "\nNo updates installed, exiting.\n"