Add allows check for sync

This commit is contained in:
Shiming Zhang
2024-06-18 16:51:10 +08:00
parent 5b89b1d521
commit 5a3f3841d6
3 changed files with 35 additions and 0 deletions

27
hack/verify-allows.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
file=$1
image=$2
function check_allows() {
local file=$1
local image=$2
while read line; do
if [[ "${line}" == *"**" ]]; then
if [[ "${image}" == "${line%\*\*}"* ]]; then
return 0
fi
elif [[ "${line}" == *"*" ]]; then
if [[ "${image}" == "${line%\*}"* ]]; then
if [[ "${image#"${line%\*}"}" != *"/"* ]]; then
return 0
fi
fi
fi
done <"${file}"
return 1
}
check_allows "${file}" "${image}"