Commit 902cbfd2 authored by Ivan Mazhukin's avatar Ivan Mazhukin

cleanups

parent 5096bfd5
...@@ -107,8 +107,10 @@ require_command() { ...@@ -107,8 +107,10 @@ require_command() {
} }
sanitize_name() { sanitize_name() {
local value local value="${1,,}"
value="$(printf '%s' "$1" | tr '[:upper:]' '[:lower:]' | sed -e 's/[^a-z0-9]/-/g' -e 's/^-*//' -e 's/-*$//')" value="${value//[^a-z0-9]/-}"
value="${value##-}"
value="${value%%-}"
printf '%s\n' "${value:-run}" printf '%s\n' "${value:-run}"
} }
...@@ -118,7 +120,8 @@ normalize_system_name() { ...@@ -118,7 +120,8 @@ normalize_system_name() {
local image_name local image_name
local image_tag local image_tag
normalized="$(printf '%s' "$raw" | tr -d ' ' | tr '[:upper:]' '[:lower:]')" normalized="${raw// /}"
normalized="${normalized,,}"
[[ -n "$normalized" ]] || fatal "Target system is empty" [[ -n "$normalized" ]] || fatal "Target system is empty"
...@@ -228,22 +231,9 @@ can_use_local_docker() { ...@@ -228,22 +231,9 @@ can_use_local_docker() {
verify_eepm_tree() { verify_eepm_tree() {
local tree="$1" local tree="$1"
local epm_path
[[ -d "$tree" ]] || fatal "eepm tree is not a directory: $tree" [[ -d "$tree" ]] || fatal "eepm tree is not a directory: $tree"
[[ -f "$tree/bin/eepm" && -r "$tree/bin/eepm" ]] || fatal "eepm entrypoint not found or not readable: $tree/bin/eepm"
epm_path="$tree/bin/eepm"
if [[ ! -e "$epm_path" ]]; then
fatal "eepm tree does not contain ./bin/eepm: $tree"
fi
if [[ ! -f "$epm_path" ]]; then
fatal "eepm entrypoint is not a regular file: $epm_path"
fi
if [[ ! -r "$epm_path" ]]; then
fatal "eepm entrypoint is not readable: $epm_path"
fi
} }
resolve_checked_source_path() { resolve_checked_source_path() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment