LibrePortal/variables.sh
librelad 7c28007779 refactor(config): updater knobs -> configs/webui/webui_updater; fix config heal/reconcile gaps
Move the WebUI-updater settings out of general_terminal into their own
advanced webui-category file (webui_logs precedent): new
configs/webui/webui_updater holds CFG_UPDATER_SCAN_INTERVAL and the
migrated CFG_HOTFIX_AUTO, listed in webui/.category.

The move only reaches existing installs if the config convergence
machinery works, and three pieces of it silently didn't:

- checkConfigFilesMissingFiles walked a stale hardcoded category list
  ('general features network' — features doesn't exist; webui/backup/
  security never healed). Derive the categories from the template tree
  instead, and heal .category metadata too: copy it when absent and
  merge missing SUBCATEGORY_ORDER entries when present, so healed files
  actually appear in the WebUI Config editor. core_categories removed.
- Option reconciliation never touched ANY nested config file: configs_dir
  carries a trailing slash, so rel stripping missed ('configs//'), the
  template lookup failed, and reconcileConfigFile early-returned for
  every file. Strip the slash before matching.
- reconcileConfigFile's AUTO_DELETE=false branch read a never-populated
  live_line array, losing the dropped keys it promised to keep. Populate
  it alongside live_value.

Also exclude *.bak from config sourcing (reconciliation writes <file>.bak
next to live configs — now that it runs, sourcing backups would resurrect
deleted keys), and add 'libreportal config check' as a non-interactive
front door to the converge pass (was only reachable via install flows and
the interactive menu).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
2026-06-12 22:33:23 +01:00

59 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
trap exitScript SIGINT
# Directories are contained in init.sh
# Define text colors
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[0;33m'
BLUE='\033[1;34m'
PINK='\033[0;35m'
CYAN='\033[0;36m'
BOLD='\033[1m'
DIM='\033[2m'
NC='\033[0m' # No Color
# Date/Time
backupDate=$(date +'%F')
backupFolder="backup_$(date +"%Y%m%d%H%M%S")"
current_date=$(date +%Y-%m-%d)
current_time=$(date +%H:%M:%S)
# Domain/Network
# Try to get public IP, fallback to local IP if all fail
if command -v dig >/dev/null 2>&1; then
public_ip_v4=$(dig +short myip.opendns.com @resolver1.opendns.com 2>/dev/null)
fi
# Fallback to local IP if dig failed or returned empty
if [[ -z "$public_ip_v4" ]]; then
public_ip_v4=$(hostname -I | awk '{print $1}' 2>/dev/null)
fi
# Final fallback to localhost
if [[ -z "$public_ip_v4" ]]; then
public_ip_v4="localhost"
fi
server_nic="$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)"
default_subnet="10.100.0"
# Files
docker_rooted_socket="/var/run/docker.sock"
swap_file=/swapfile
# Rootless sysctl settings + the "rootless configured" marker. MUST live under
# /etc/sysctl.d/ — `sysctl --system` only reads there (+ /etc/sysctl.conf), NOT
# the old non-standard /etc/sysctl/ path, so settings written elsewhere never
# persist across reboot.
sysctl="/etc/sysctl.d/99-libreportal-rootless.conf"
docker_log_file=libreportal.log
backup_log_file=backup.log
db_file=database.db
migrate_file=migrate.txt
run_file=run.txt
# Configs
update_done=false
config_file_wireguard=config_wireguard
# Menu
menu_number=0