Update dockcheck.sh

added a check if there's any updates.
changed order on listings.
This commit is contained in:
mag37
2023-01-18 21:45:31 +01:00
committed by GitHub
parent 72f00fdf9e
commit 07fe6ab9eb

View File

@@ -42,19 +42,20 @@ printf ". "
done done
### List what containers got updates or not ### List what containers got updates or not
if [ -n "$GotUpdates" ] ; then
printf "\n\033[31;1mContainers with updates available:\033[0m\n"
printf "%s\n" "${GotUpdates[@]}"
fi
if [ -n "$NoUpdates" ] ; then if [ -n "$NoUpdates" ] ; then
printf "\n\033[32;1mContainers on latest version:\033[0m\n" printf "\n\033[32;1mContainers on latest version:\033[0m\n"
printf "%s\n" "${NoUpdates[@]}" printf "%s\n" "${NoUpdates[@]}"
fi fi
if [ -n "$GotUpdates" ] ; then
printf "\n\033[31;1mContainers with updates available:\033[0m\n"
printf "%s\n" "${GotUpdates[@]}"
fi
### Optionally get updates ### Optionally get updates if there's any
printf "\n\033[36;1mDo you want to update? y/[n]\033[0m\n" if [ -n "$GotUpdates" ] ; then
read UpdYes printf "\n\033[36;1mDo you want to update? y/[n]\033[0m\n"
if [ "$UpdYes" != "${UpdYes#[Yy]}" ] ; then read UpdYes
if [ "$UpdYes" != "${UpdYes#[Yy]}" ] ; then
for i in "${GotUpdates[@]}" for i in "${GotUpdates[@]}"
do do
# Check what compose-type is installed: # Check what compose-type is installed:
@@ -63,6 +64,10 @@ if [ "$UpdYes" != "${UpdYes#[Yy]}" ] ; then
$DockerBin -f "$ContPath/docker-compose.yml" pull $DockerBin -f "$ContPath/docker-compose.yml" pull
$DockerBin -f "$ContPath/docker-compose.yml" up -d $DockerBin -f "$ContPath/docker-compose.yml" up -d
done done
else else
printf "\nNo updates installed, exiting.\n" printf "\nNo updates installed, exiting.\n"
fi
else
printf "\nNo updates available, exiting.\n"
fi fi