rename: appdata/varaverk → appdata/Varaverk (capital V throughout)
This commit is contained in:
+56
-17
@@ -1,27 +1,66 @@
|
||||
#!/bin/bash
|
||||
# ==============================================================================================
|
||||
# conf_upgrade.sh — Merge new conf structure into an existing conf while preserving user values.
|
||||
# ============================= conf_upgrade.sh ================================================
|
||||
# ==============================================================================================
|
||||
#
|
||||
# Usage:
|
||||
# conf_upgrade.sh --template <template.conf> --target <target.conf> [--dry-run] [--backup]
|
||||
# PURPOSE
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# Merges a new conf template into an existing user conf while preserving every
|
||||
# value the user has already set. Run manually when the conf schema changes
|
||||
# between versions — adds new keys, removes deprecated ones, and keeps the
|
||||
# structure of the new template exactly.
|
||||
#
|
||||
# What it does:
|
||||
# • Keys in template only → ADDED with template's placeholder/default — user fills in once
|
||||
# • Keys in target only → REMOVED — deprecated in new version
|
||||
# • Keys in both → KEPT — target's value always preserved, template's ignored
|
||||
# • Comments / blank lines → always from template (structure follows new version)
|
||||
# Keys in template only → ADDED (placeholder/default — user fills in once)
|
||||
# Keys in target only → REMOVED (deprecated in new version)
|
||||
# Keys in both → KEPT (target's value always wins, template ignored)
|
||||
# Comments / blank lines → always from template (structure follows new version)
|
||||
#
|
||||
# Supports all conf variable patterns:
|
||||
# Simple scalar: KEY="value"
|
||||
# Indexed array: KEY=(\n "item"\n)
|
||||
# Associative array: declare -A KEY=(\n ["k"]="v"\n)
|
||||
# Supports all conf variable patterns: simple scalars, indexed arrays, and
|
||||
# associative arrays (declare -A).
|
||||
#
|
||||
# Options:
|
||||
# --template New version conf file (source of structure and defaults)
|
||||
# --target Existing user conf (source of real values — preserved)
|
||||
# --dry-run Show what would change without writing
|
||||
# --backup Write a .bak copy of target before modifying
|
||||
# ==============================================================================================
|
||||
# OPERATIONAL SAFEGUARDS
|
||||
# ==============================================================================================
|
||||
#
|
||||
# Dry-run Mode
|
||||
# --dry-run prints the full change report (ADDED / REMOVED / KEPT) then exits
|
||||
# without writing anything. Always preview before applying to production confs.
|
||||
#
|
||||
# Backup Option
|
||||
# --backup writes a .bak copy of the target before overwriting. Use when
|
||||
# applying to a conf that has never been upgraded before.
|
||||
#
|
||||
# File Existence Guards
|
||||
# Both --template and --target are validated before any parsing begins.
|
||||
# Missing files abort immediately with a clear error.
|
||||
#
|
||||
# Atomic Write
|
||||
# Merged output is written to a tempfile first, then copied to the target.
|
||||
# A partial write cannot corrupt the original.
|
||||
#
|
||||
# ==============================================================================================
|
||||
# CONFIGURATION
|
||||
# ==============================================================================================
|
||||
#
|
||||
# No conf vars. All inputs are CLI flags.
|
||||
#
|
||||
# --template <file> New version conf file (source of structure and defaults)
|
||||
# --target <file> Existing user conf (source of real values — always preserved)
|
||||
# --dry-run Show what would change without writing
|
||||
# --backup Write a .bak copy of target before modifying
|
||||
#
|
||||
# ==============================================================================================
|
||||
# RUNTIME MODES
|
||||
# ==============================================================================================
|
||||
#
|
||||
# conf_upgrade.sh --template master.conf.template --target Configurations/master.conf --dry-run
|
||||
# Preview what would be added, removed, and kept — no changes written.
|
||||
#
|
||||
# conf_upgrade.sh --template master.conf.template --target Configurations/master.conf --backup
|
||||
# Apply the upgrade, writing a .bak first.
|
||||
#
|
||||
# conf_upgrade.sh --template master.conf.template --target Configurations/master.conf
|
||||
# Apply the upgrade in-place with no backup.
|
||||
#
|
||||
# ==============================================================================================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user