Framework stable

This commit is contained in:
2026-03-27 20:18:53 +00:00
parent a0eb1ff4dd
commit a6fc9b973f
+10 -12
View File
@@ -3,7 +3,7 @@
# ----------------- UNRAID OPS COMMON LIBRARY (STABLE FRAMEWORK v1) -----------------------
# -----------------------------------------------------------------------------------------------
# ----------------------------- ICONS -----------------------------
# ICONS Profiles
ICON_INFO="️"
ICON_WARN="⚠️"
ICON_ERROR="❌"
@@ -14,7 +14,7 @@ ICON_RETRY="🔁"
ICON_SYNC="🔄"
ICON_GEAR="⚙️"
# ----------------------------- OUTPUT -----------------------------
# OUTPUT
info() { echo "$ICON_INFO [INFO] $*"; }
warn() { echo "$ICON_WARN [WARN] $*"; }
error() { echo "$ICON_ERROR [ERROR] $*"; }
@@ -24,7 +24,7 @@ log() {
[[ "${ENABLE_LOGGING:-false}" == true ]] && echo "[LOG] $*"
}
# ----------------------------- ARG PARSER -----------------------------
# ARG PARSER
parse_args() {
ENABLE_LOGGING=${ENABLE_LOGGING:-false}
DRY_RUN=${DRY_RUN:-false}
@@ -69,13 +69,12 @@ parse_args() {
PARSED_ARGS=("${CLEAN_ARGS[@]}")
}
# ----------------------------- VALIDATION -----------------------------
# VALIDATION
require_var() {
[[ -z "${!1:-}" ]] && error "Missing required: $1" && exit 1
}
# ----------------------------- HOST DETECTION -----------------------------
detect_hosts() {
# HOST DETECTION
LOCAL_HOSTNAME="$(hostname)"
if [[ "$LOCAL_HOSTNAME" == "$HOST1" ]]; then
@@ -100,8 +99,7 @@ detect_hosts() {
info "Host: $LOCAL_SERVER_NAME$REMOTE_SERVER_NAME"
}
# ----------------------------- REMOTE -----------------------------
resolve_remote_ip() {
# REMOTE
log "Resolving remote IP..."
REMOTE_SERVER=$(tailscale ip -4 "$REMOTE_SERVER_NAME" 2>/dev/null)
@@ -110,7 +108,7 @@ resolve_remote_ip() {
info "Remote IP: $REMOTE_SERVER"
}
# ----------------------------- CONTAINERS -----------------------------
# CONTAINERS
RUNNING_CONTAINERS=()
stop_containers() {
@@ -156,7 +154,7 @@ start_containers() {
done
}
# ----------------------------- RSYNC LIMITER -----------------------------
# RSYNC LIMITER
wait_for_rsync() {
: "${RETRY_COUNT:=5}"
: "${MAX_RSYNC_PROCS:=2}"
@@ -182,7 +180,7 @@ wait_for_rsync() {
exit 1
}
# ----------------------------- RSYNC OPTIONS -----------------------------
# RSYNC OPTIONS
get_rsync_opts() {
if [[ -n "${PROFILE_RSYNC_OPTS[$PROFILE_NAME]:-}" ]]; then
read -r -a RSYNC_OPTS <<< "${PROFILE_RSYNC_OPTS[$PROFILE_NAME]}"
@@ -191,7 +189,7 @@ get_rsync_opts() {
fi
}
# ----------------------------- STATUS -----------------------------
# STATUS
show_status() {
echo "===== STATUS ====="
echo "Local: $LOCAL_SERVER_NAME"