Structure change and vissually fixing code to make it easier to read

This commit is contained in:
2026-03-26 22:35:44 +00:00
parent 84cdc6169b
commit 4ef4c1428c
14 changed files with 253 additions and 141 deletions
+9 -10
View File
@@ -3,7 +3,7 @@
# ----------------------- Common Helpers for Unraid Scripts -------------------------------------
# -----------------------------------------------------------------------------------------------
# ----------------------------- Output Helpers -----------------------------
# Output Helpers
info() {
echo "[INFO] $*"
}
@@ -20,8 +20,7 @@ log() {
[[ "$ENABLE_LOGGING" == true ]] && echo "[LOG] $*"
}
# ----------------------------- Argument Parsing -----------------------------
parse_args() {
# Argument Parsing
DRY_RUN=${DRY_RUN:-false}
ENABLE_LOGGING=${ENABLE_LOGGING:-false}
@@ -79,7 +78,7 @@ parse_args() {
done
}
# ----------------------------- Validation -----------------------------
# Validation
require_var() {
local var="$1"
if [[ -z "${!var:-}" ]]; then
@@ -98,7 +97,7 @@ validate_int() {
fi
}
# ----------------------------- Host Detection -----------------------------
# Host Detection
detect_hosts() {
LOCAL_HOSTNAME="$(hostname)"
@@ -129,7 +128,7 @@ detect_hosts() {
log "SSH key: $SSH_KEY"
}
# ----------------------------- Remote IP -----------------------------
# Remote IP
resolve_remote_ip() {
log "Resolving Tailscale IP for $REMOTE_SERVER_NAME..."
@@ -143,13 +142,13 @@ resolve_remote_ip() {
info "Remote IP: $REMOTE_SERVER"
}
# ----------------------------- Connectivity -----------------------------
# Connectivity
check_remote_online() {
log "Pinging $REMOTE_SERVER..."
ping -c 1 "$REMOTE_SERVER" &>/dev/null
}
# ----------------------------- Containers -----------------------------
# Containers
declare -a RUNNING_CONTAINERS=()
stop_containers() {
@@ -196,7 +195,7 @@ start_containers() {
done
}
# ----------------------------- 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]}"
@@ -207,7 +206,7 @@ get_rsync_opts() {
fi
}
# ----------------------------- Status Output -----------------------------
# Status Output
show_status() {
echo "===== RSYNC STATUS ====="
echo "Local: $LOCAL_SERVER_NAME"