Подготовить HY2XS к production-сборке
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
log_info() {
|
||||
printf '[hy2xs-build] %s\n' "$*"
|
||||
}
|
||||
|
||||
log_step() {
|
||||
printf '\n[hy2xs-build] ==> %s\n' "$*"
|
||||
}
|
||||
|
||||
fail() {
|
||||
printf '[hy2xs-build] ERROR: %s\n' "$*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
require_tool() {
|
||||
local tool="$1"
|
||||
command -v "$tool" >/dev/null 2>&1 || fail "required tool not found: $tool"
|
||||
}
|
||||
|
||||
version_ge() {
|
||||
[ "$(printf '%s\n%s\n' "$2" "$1" | sort -V | head -n 1)" = "$2" ]
|
||||
}
|
||||
|
||||
copy_dir_contents() {
|
||||
local src="$1"
|
||||
local dst="$2"
|
||||
|
||||
mkdir -p "$dst"
|
||||
if [ -d "$src" ]; then
|
||||
cp -a "$src"/. "$dst"/
|
||||
else
|
||||
fail "directory not found: $src"
|
||||
fi
|
||||
}
|
||||
|
||||
download_file() {
|
||||
local url="$1"
|
||||
local dst="$2"
|
||||
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
curl -fsSL "$url" -o "$dst"
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
wget -qO "$dst" "$url"
|
||||
else
|
||||
fail "curl or wget is required to download $url"
|
||||
fi
|
||||
}
|
||||
Reference in New Issue
Block a user