Compare commits
No commits in common. "1e997f75d288778a6ad8fe5d07a9566bb0443b81" and "e317962616390a6c356717818c114d89fa8b4dc9" have entirely different histories.
1e997f75d2
...
e317962616
@ -2,6 +2,8 @@
|
|||||||
# Terminal - System utilities and advanced settings **ADVANCED**
|
# Terminal - System utilities and advanced settings **ADVANCED**
|
||||||
# ================================================================================
|
# ================================================================================
|
||||||
CFG_UPDATER_CHECK=60 # Update Check Interval - Hours between system update checks
|
CFG_UPDATER_CHECK=60 # Update Check Interval - Hours between system update checks
|
||||||
|
CFG_HOTFIX_AUTO=security-breakage # Hotfix Auto-Apply - Which signed hotfix severities apply automatically on the update check [security-breakage|all|off]
|
||||||
|
CFG_UPDATER_SCAN_INTERVAL=30 # App Scan Interval - Minutes between automatic app update/CVE/improvement scans (0 disables)
|
||||||
CFG_SWAPFILE_SIZE=2G # Swap File Size - Size of swap file for memory management
|
CFG_SWAPFILE_SIZE=2G # Swap File Size - Size of swap file for memory management
|
||||||
CFG_GENERATED_PASS_LENGTH=14 # Password Length - Length for auto generated passwords
|
CFG_GENERATED_PASS_LENGTH=14 # Password Length - Length for auto generated passwords
|
||||||
CFG_GENERATED_USER_LENGTH=8 # Username Length - Length for auto generated usernames
|
CFG_GENERATED_USER_LENGTH=8 # Username Length - Length for auto generated usernames
|
||||||
|
|||||||
@ -2,4 +2,4 @@ TITLE=WebUI
|
|||||||
DESCRIPTION=Web interface settings and preferences
|
DESCRIPTION=Web interface settings and preferences
|
||||||
ICON=webui
|
ICON=webui
|
||||||
ORDER=2
|
ORDER=2
|
||||||
SUBCATEGORY_ORDER=webui_logins,webui_logs,webui_updater
|
SUBCATEGORY_ORDER=webui_logins,webui_logs
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
# ================================================================================
|
|
||||||
# WebUI Updater - Automatic app update, CVE & improvement scanning **ADVANCED**
|
|
||||||
# ================================================================================
|
|
||||||
CFG_UPDATER_SCAN_INTERVAL=30 # App Scan Interval - Minutes between automatic app update/CVE/improvement scans. 0 disables.
|
|
||||||
CFG_HOTFIX_AUTO=security-breakage # Hotfix Auto-Apply - Which signed hotfix severities apply automatically on the update check [security-breakage|all|off]
|
|
||||||
@ -14,16 +14,6 @@ cliHandleConfigCommands()
|
|||||||
configUpdateBatch "$encoded_pairs"
|
configUpdateBatch "$encoded_pairs"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"check")
|
|
||||||
# Converge live configs on the install templates: copy any missing
|
|
||||||
# files / categories (and surface them to the WebUI Config editor
|
|
||||||
# via .category), then reconcile the options inside each file —
|
|
||||||
# add new keys, drop removed ones, refresh comments, keep the
|
|
||||||
# user's values. Read-and-converge; safe to run any time.
|
|
||||||
checkConfigFilesMissingFiles
|
|
||||||
checkConfigFilesMissingVariables true
|
|
||||||
;;
|
|
||||||
|
|
||||||
"")
|
"")
|
||||||
cliShowConfigHelp
|
cliShowConfigHelp
|
||||||
;;
|
;;
|
||||||
|
|||||||
@ -5,9 +5,6 @@ cliShowConfigHelp()
|
|||||||
echo ""
|
echo ""
|
||||||
echo "Available Config Commands:"
|
echo "Available Config Commands:"
|
||||||
echo ""
|
echo ""
|
||||||
echo " libreportal config check - Converge live configs on the install templates:"
|
|
||||||
echo " copy missing files, then reconcile options in each"
|
|
||||||
echo " (add new keys, drop removed ones, keep your values)"
|
|
||||||
echo " libreportal config update '<encoded>' - Apply a batch of CFG_KEY=VALUE pairs"
|
echo " libreportal config update '<encoded>' - Apply a batch of CFG_KEY=VALUE pairs"
|
||||||
echo " <encoded> is pipe-separated; literal '|' in"
|
echo " <encoded> is pipe-separated; literal '|' in"
|
||||||
echo " values must be URL-encoded as %7C."
|
echo " values must be URL-encoded as %7C."
|
||||||
|
|||||||
@ -11,66 +11,31 @@ checkConfigFilesMissingFiles()
|
|||||||
local missing_files_count=0
|
local missing_files_count=0
|
||||||
local found_files_count=0
|
local found_files_count=0
|
||||||
|
|
||||||
# Walk every category the install templates define (configs/<category>/),
|
# Check for core config categories in the new structure
|
||||||
# derived from the template tree itself — so a new category, or one a
|
for category in "${core_categories[@]}"; do
|
||||||
# hardcoded list would miss (webui/backup/security were), heals onto
|
local install_category_dir="$install_configs_dir/$category"
|
||||||
# existing installs automatically.
|
local target_category_dir="$configs_dir/$category"
|
||||||
local install_category_dir category target_category_dir
|
|
||||||
for install_category_dir in "$install_configs_dir"*/; do
|
if [ -d "$install_category_dir" ]; then
|
||||||
[ -d "$install_category_dir" ] || continue
|
# Create target category directory if it doesn't exist
|
||||||
category="$(basename "$install_category_dir")"
|
if [ ! -d "$target_category_dir" ]; then
|
||||||
target_category_dir="${configs_dir%/}/$category"
|
runInstallOp mkdir -p "$target_category_dir"
|
||||||
|
|
||||||
# Create target category directory if it doesn't exist
|
|
||||||
if [ ! -d "$target_category_dir" ]; then
|
|
||||||
runInstallOp mkdir -p "$target_category_dir"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check each file in the install category directory
|
|
||||||
local install_file
|
|
||||||
for install_file in "$install_category_dir"*; do
|
|
||||||
if [ -f "$install_file" ] && [[ ! "$install_file" =~ \.category$ ]]; then
|
|
||||||
local filename=$(basename "$install_file")
|
|
||||||
local target_file="$target_category_dir/$filename"
|
|
||||||
|
|
||||||
if [ ! -f "$target_file" ]; then
|
|
||||||
# Copy missing file from install directory
|
|
||||||
runInstallOp cp "$install_file" "$target_file"
|
|
||||||
((missing_files_count++))
|
|
||||||
fi
|
|
||||||
((found_files_count++))
|
|
||||||
fi
|
fi
|
||||||
done
|
|
||||||
|
# Check each file in the install category directory
|
||||||
# Heal the category's .category metadata too: copy it when absent (a
|
for install_file in "$install_category_dir"/*; do
|
||||||
# brand-new category is invisible to the WebUI Config editor without
|
if [ -f "$install_file" ] && [[ ! "$install_file" =~ \.category$ ]]; then
|
||||||
# it), and when present merge in any template SUBCATEGORY_ORDER entries
|
local filename=$(basename "$install_file")
|
||||||
# it lacks — the editor only renders files listed there, so a healed
|
local target_file="$target_category_dir/$filename"
|
||||||
# config file would otherwise ship hidden. User-kept order and any
|
|
||||||
# extra local entries are preserved; new entries append.
|
if [ ! -f "$target_file" ]; then
|
||||||
local tmpl_cat="${install_category_dir}.category"
|
# Copy missing file from install directory
|
||||||
local live_cat="$target_category_dir/.category"
|
runInstallOp cp "$install_file" "$target_file"
|
||||||
if [ -f "$tmpl_cat" ]; then
|
((missing_files_count++))
|
||||||
if [ ! -f "$live_cat" ]; then
|
|
||||||
runInstallOp cp "$tmpl_cat" "$live_cat"
|
|
||||||
else
|
|
||||||
local tmpl_order live_order merged entry _entries
|
|
||||||
tmpl_order="$(grep -m1 '^SUBCATEGORY_ORDER=' "$tmpl_cat" 2>/dev/null | cut -d= -f2-)"
|
|
||||||
live_order="$(runInstallOp grep -m1 '^SUBCATEGORY_ORDER=' "$live_cat" 2>/dev/null | cut -d= -f2-)"
|
|
||||||
merged="$live_order"
|
|
||||||
IFS=',' read -ra _entries <<< "$tmpl_order"
|
|
||||||
for entry in "${_entries[@]}"; do
|
|
||||||
[ -n "$entry" ] || continue
|
|
||||||
[[ ",$merged," == *",$entry,"* ]] || merged="${merged:+$merged,}$entry"
|
|
||||||
done
|
|
||||||
if [ -n "$merged" ] && [ "$merged" != "$live_order" ]; then
|
|
||||||
if runInstallOp grep -q '^SUBCATEGORY_ORDER=' "$live_cat" 2>/dev/null; then
|
|
||||||
runInstallOp sed -i "s/^SUBCATEGORY_ORDER=.*/SUBCATEGORY_ORDER=$merged/" "$live_cat"
|
|
||||||
else
|
|
||||||
printf 'SUBCATEGORY_ORDER=%s\n' "$merged" | runInstallOp tee -a "$live_cat" >/dev/null
|
|
||||||
fi
|
fi
|
||||||
|
((found_files_count++))
|
||||||
fi
|
fi
|
||||||
fi
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
@ -8,11 +8,7 @@ checkLibrePortalConfigFilesMissingVariables()
|
|||||||
while IFS= read -r live; do
|
while IFS= read -r live; do
|
||||||
[[ -f "$live" ]] || continue
|
[[ -f "$live" ]] || continue
|
||||||
fn=$(basename "$live")
|
fn=$(basename "$live")
|
||||||
# configs_dir carries a trailing slash (paths.sh) — strip it before
|
rel="${live#"$configs_dir"/}"
|
||||||
# appending one, or the prefix never matches ("configs//"), rel stays
|
|
||||||
# the absolute path, the template lookup misses, and every nested
|
|
||||||
# config file silently skips reconciliation.
|
|
||||||
rel="${live#"${configs_dir%/}"/}"
|
|
||||||
remote="$install_configs_dir$fn"
|
remote="$install_configs_dir$fn"
|
||||||
[[ -f "$remote" ]] || remote="$install_configs_dir$rel"
|
[[ -f "$remote" ]] || remote="$install_configs_dir$rel"
|
||||||
reconcileConfigFile "$live" "$remote"
|
reconcileConfigFile "$live" "$remote"
|
||||||
|
|||||||
@ -41,14 +41,13 @@ reconcileConfigFile()
|
|||||||
[[ -f "$live" ]] || return 0
|
[[ -f "$live" ]] || return 0
|
||||||
runInstallOp test -s "$template" 2>/dev/null || return 0
|
runInstallOp test -s "$template" 2>/dev/null || return 0
|
||||||
|
|
||||||
declare -A live_value live_line emitted
|
declare -A live_value emitted
|
||||||
local line key
|
local line key
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
if [[ "$line" =~ ^(CFG_[A-Za-z0-9_]+)= ]]; then
|
if [[ "$line" =~ ^(CFG_[A-Za-z0-9_]+)= ]]; then
|
||||||
key="${BASH_REMATCH[1]}"
|
key="${BASH_REMATCH[1]}"
|
||||||
_reconcileSplitValueComment "$line"
|
_reconcileSplitValueComment "$line"
|
||||||
live_value["$key"]="$_reconcile_value"
|
live_value["$key"]="$_reconcile_value"
|
||||||
live_line["$key"]="$line"
|
|
||||||
fi
|
fi
|
||||||
done < <(runInstallOp cat "$live")
|
done < <(runInstallOp cat "$live")
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ sourceScanFiles()
|
|||||||
# echo "$load_type NEW FILE $file"
|
# echo "$load_type NEW FILE $file"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done < <(find "$folder_dir" -maxdepth 2 -type f ! -name "*.category" ! -name "config_*" ! -name ".*" ! -name "*.bak" -print0)
|
done < <(find "$folder_dir" -maxdepth 2 -type f ! -name "*.category" ! -name "config_*" ! -name ".*" -print0)
|
||||||
|
|
||||||
# Per-location backup configs live nested at depth 3
|
# Per-location backup configs live nested at depth 3
|
||||||
# (configs/backup/locations/<idx>/location.config) — source them via
|
# (configs/backup/locations/<idx>/location.config) — source them via
|
||||||
|
|||||||
@ -54,6 +54,7 @@ run_file=run.txt
|
|||||||
# Configs
|
# Configs
|
||||||
update_done=false
|
update_done=false
|
||||||
config_file_wireguard=config_wireguard
|
config_file_wireguard=config_wireguard
|
||||||
|
core_categories=("general" "features" "network")
|
||||||
|
|
||||||
# Menu
|
# Menu
|
||||||
menu_number=0
|
menu_number=0
|
||||||
Loading…
x
Reference in New Issue
Block a user