diff --git a/scripts/containers_version.sh b/scripts/containers_version.sh index cd7e0768..d3a6caad 100644 --- a/scripts/containers_version.sh +++ b/scripts/containers_version.sh @@ -1,6 +1,9 @@ #!/bin/bash export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin +containername=$1 +imagename=$2 + # get applist if [ -d StackHub ] ; then echo "StackHub is exists" @@ -8,6 +11,21 @@ else git clone --depth=1 https://github.com/Websoft9/StackHub.git fi appnames=$(ls StackHub/apps/roles |grep -v Template |grep -v README.md |grep -v role) + for appname in $appnames; do - echo $character + + if [[ $containername == $appname ]];then + echo "$containername容器匹配成功app:$appname" + break + elif [[ $imagename =~ $appname ]];then + tmpvar="-" + if [[ $containername =~ $tmpvar ]];then + echo "$imagename=镜像匹配成功app:$appname" + break + else + echo "need other mothod " + fi + else + echo "容器镜像均未匹配成功app:$appname" + fi done