Update containers_version.sh

This commit is contained in:
qiaofeng1227 2022-07-18 08:44:39 +08:00 committed by GitHub
parent 52431d030f
commit 2c3ee91cc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,11 +19,12 @@ for appinfo in $(docker ps --format '{{.Names}}%{{.Image}}'); do
imagename=$(echo $appinfo |awk -F"%" '{print $2}')
for appname in $appnames; do
# app的版本已经输出
if [[ $initdata =~ $appname ]];then
continue
fi
if [[ $containername == $appname ]];then
# app的版本已经输出
if [[ $initdata =~ $appname ]];then
continue
fi
echo "$containername容器匹配成功app:$appname"
appnames=(${appnames[*]/$appname})
initdata="$initdata $appname"
@ -31,12 +32,15 @@ for appinfo in $(docker ps --format '{{.Names}}%{{.Image}}'); do
bash /tmp/$appname_get_version.sh $containername
break
elif [[ $imagename =~ $appname ]];then
tmpvar="-"
if [[ $containername =~ $tmpvar ]];then
echo "$imagename=镜像匹配成功app:$appname"
appnames=(${appnames[*]/$appname})
initdata="$initdata $appname"
wget -O /tmp/$appname_get_version.sh https://raw.githubusercontent.com/Websoft9/docker-$appname/main/src/get_version.sh
# app的版本已经输出
if [[ $initdata =~ $appname ]];then
continue
fi
tmpvar="-"
if [[ $containername =~ $tmpvar ]];then
echo "$imagename=镜像匹配成功app:$appname"
initdata="$initdata $appname"
wget -O /tmp/$appname_get_version.sh https://raw.githubusercontent.com/Websoft9/docker-$appname/main/src/get_version.sh
bash /tmp/$appname_get_version.sh $containername
break
else