Stable v1 framework

This commit is contained in:
2026-03-27 19:29:41 +00:00
parent 2e7f624e11
commit 0e1bb83ef1
2 changed files with 19 additions and 29 deletions
+11 -21
View File
@@ -1,10 +1,9 @@
#!/bin/bash
# -----------------------------------------------------------------------------------------------
# ----------------- UNRAID OPS COMMON LIBRARY (FINAL STABLE FRAMEWORK v1) -----------------------
# ----------------- UNRAID OPS COMMON LIBRARY (STABLE FRAMEWORK v1) -----------------------
# -----------------------------------------------------------------------------------------------
# ----------------------------- ICONS -----------------------------
# ICONS Profiles
ICON_INFO="️"
ICON_WARN="⚠️"
ICON_ERROR="❌"
@@ -15,8 +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] $*"; }
@@ -26,8 +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}
@@ -72,14 +69,12 @@ parse_args() {
PARSED_ARGS=("${CLEAN_ARGS[@]}")
}
# ----------------------------- VALIDATION -----------------------------
# VALIDATION
require_var() {
[[ -z "${!1:-}" ]] && error "Missing required: $1" && exit 1
}
# ----------------------------- HOST DETECTION -----------------------------
# HOST DETECTION
detect_hosts() {
LOCAL_HOSTNAME="$(hostname)"
@@ -105,8 +100,7 @@ detect_hosts() {
info "Host: $LOCAL_SERVER_NAME$REMOTE_SERVER_NAME"
}
# ----------------------------- REMOTE -----------------------------
# REMOTE
resolve_remote_ip() {
log "Resolving remote IP..."
REMOTE_SERVER=$(tailscale ip -4 "$REMOTE_SERVER_NAME" 2>/dev/null)
@@ -116,8 +110,7 @@ resolve_remote_ip() {
info "Remote IP: $REMOTE_SERVER"
}
# ----------------------------- CONTAINERS -----------------------------
# CONTAINERS
RUNNING_CONTAINERS=()
stop_containers() {
@@ -162,8 +155,7 @@ start_containers() {
done
}
# ----------------------------- RSYNC LIMITER (FIXED FINAL) -----------------------------
# RSYNC LIMITER (FIXED FINAL)
wait_for_rsync() {
: "${RETRY_COUNT:=5}"
: "${MAX_RSYNC_PROCS:=2}"
@@ -191,8 +183,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]}"
@@ -201,8 +192,7 @@ get_rsync_opts() {
fi
}
# ----------------------------- STATUS -----------------------------
# STATUS
show_status() {
echo "===== STATUS ====="
echo "Local: $LOCAL_SERVER_NAME"