Update containers_version.sh

This commit is contained in:
qiaofeng1227 2022-07-15 16:40:03 +08:00 committed by GitHub
parent d3b19c9522
commit 38506178b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,9 @@
#!/bin/bash #!/bin/bash
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
containername=$1
imagename=$2
# get applist # get applist
if [ -d StackHub ] ; then if [ -d StackHub ] ; then
echo "StackHub is exists" echo "StackHub is exists"
@ -8,6 +11,21 @@ else
git clone --depth=1 https://github.com/Websoft9/StackHub.git git clone --depth=1 https://github.com/Websoft9/StackHub.git
fi fi
appnames=$(ls StackHub/apps/roles |grep -v Template |grep -v README.md |grep -v role) appnames=$(ls StackHub/apps/roles |grep -v Template |grep -v README.md |grep -v role)
for appname in $appnames; do 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 done