mirror of
https://github.com/DaoCloud/public-image-mirror.git
synced 2025-08-09 12:31:58 +08:00
Add allows check for sync
This commit is contained in:
27
hack/verify-allows.sh
Executable file
27
hack/verify-allows.sh
Executable 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}"
|
Reference in New Issue
Block a user