mirror of
				https://github.com/DaoCloud/public-image-mirror.git
				synced 2025-11-04 16:57:22 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			33 lines
		
	
	
		
			709 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			709 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
 | 
						|
file=$1
 | 
						|
 | 
						|
image=$2
 | 
						|
 | 
						|
function check_allows() {
 | 
						|
    local file=$1
 | 
						|
    local image=$2
 | 
						|
    if [[ "${image}" == *":" ]]; then
 | 
						|
        return 1
 | 
						|
    fi
 | 
						|
    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
 | 
						|
        elif [[ "${line}" == "${image%\:*}" ]]; then
 | 
						|
            return 0
 | 
						|
        fi
 | 
						|
    done <"${file}"
 | 
						|
 | 
						|
    return 1
 | 
						|
}
 | 
						|
 | 
						|
check_allows "${file}" "${image}"
 |