Files
rustbox-package-builder/scripts/lib.sh
T
2026-10-30 12:59:58 +01:00

16 lines
500 B
Bash
Executable File

#!/usr/bin/env bash
set -Eeuo pipefail
PACKAGING_REVISION=1
DATA_DIR=${DATA_DIR:-/var/lib/rustbox-package-builder}
log() { printf '%s %s\n' "$(date -u '+%Y-%m-%dT%H:%M:%SZ')" "$*"; }
fatal() { log "ERROR: $*" >&2; exit 1; }
require_cmd() { command -v "$1" >/dev/null 2>&1 || fatal "required command not found: $1"; }
yaml_quote() { python3 - "$1" <<'PY'
import json, sys
print(json.dumps(sys.argv[1]))
PY
}
atomic_write() { local path=$1 tmp="${path}.tmp.$$"; cat > "$tmp"; mv -f "$tmp" "$path"; }