Update domain (#251)

This commit is contained in:
Shiming Zhang 2022-11-04 17:35:07 +08:00 committed by GitHub
parent 3f73ab6594
commit 055c0b51e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 20 deletions

View File

@ -8,29 +8,11 @@ ROOT="${ROOT:-$(dirname "${BASH_SOURCE}")/..}"
DEFAULT_REGEX='^([a-z]+-)?[a-z]*[0-9]+(\.[0-9]+){0,2}(-.+)?(__.+)?$|^[a-z]+$'
SKOPEO="${SKOPEO:-skopeo}"
ROOT=$(realpath ${ROOT})
DOMAIN="${DOMAIN:-m.daocloud.io}"
function helper::replace_domain() {
local domain="${1}"
local file="${2:-domain.txt}"
for line in $(cat ${file}); do
line="${line/ /}"
if [[ "${line}" == "" ]]; then
continue
fi
key="${line%=*}"
val="${line##*=}"
if [[ "${key}" == "" || "${val}" == "" ]]; then
continue
fi
if [[ "${domain}" =~ ^${key} ]]; then
echo "${domain}" | sed -e "s#^${key}#${val}#"
return 0
fi
done
echo "Error: domain ${domain} not found"
return 1
echo "${DOMAIN}/${domain}"
}
function helper::get_source() {