From 48d9bd0a13a05fa472520482f14c9271b365242c Mon Sep 17 00:00:00 2001 From: librelad Date: Sat, 23 May 2026 20:56:56 +0100 Subject: [PATCH] fix(init): never clobber live config values on deploy/reinstall MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit setupConfigsFromRepo / sync_configs_from_install used 'cp -a' of the template over /docker/configs, so any fast/full deploy (which runs init.sh) silently reset user config to template defaults — e.g. it flipped a live rooted box to the new rootless template default and broke it. Use 'cp -an' (no-clobber): fresh installs still get the full template, existing installs keep their values, and new keys are still added by the add-only reconcile pass. This is also what makes a rootless template default safe for existing rooted boxes. Co-Authored-By: Claude Opus 4.7 Signed-off-by: librelad --- init.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/init.sh b/init.sh index 7e59bc0..35a4137 100755 --- a/init.sh +++ b/init.sh @@ -737,7 +737,12 @@ setupConfigsFromRepo() sudo mkdir -p "$dst" - if ! sudo cp -a "$src"/. "$dst"/; then + # No-clobber: only seed config files that don't already exist. On a fresh + # install this copies the whole template; on a re-run/deploy it preserves the + # user's live values (a plain cp -a here silently reset e.g. the Docker + # install type back to the template default). New *keys* in existing files + # are added separately by the add-only reconcile pass. + if ! sudo cp -an "$src"/. "$dst"/; then isError "Failed to copy configs from $src to $dst — aborting." exit 1 fi @@ -1047,7 +1052,8 @@ sync_configs_from_install() { return 1 fi sudo mkdir -p "$dst" - if ! sudo cp -a "$src"/. "$dst"/; then + # No-clobber: preserve the user's live config values; only add new files. + if ! sudo cp -an "$src"/. "$dst"/; then echo "ERROR: Failed to sync configs from $src to $dst." return 1 fi