From 10cb1d26296f8f45cbb912a698a0a63fadf088dd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 06:33:36 +0000 Subject: [PATCH] Address review: improve error logging for data migration and add clarifying comment Agent-Logs-Url: https://github.com/alexbelgium/hassio-addons/sessions/23af3f23-96f8-49a3-849a-82fb5feef2bc Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com> --- linkwarden/rootfs/etc/cont-init.d/99-run.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/linkwarden/rootfs/etc/cont-init.d/99-run.sh b/linkwarden/rootfs/etc/cont-init.d/99-run.sh index 4573654a6..d04423b07 100755 --- a/linkwarden/rootfs/etc/cont-init.d/99-run.sh +++ b/linkwarden/rootfs/etc/cont-init.d/99-run.sh @@ -16,11 +16,14 @@ mkdir -p "$STORAGE_FOLDER" # of /config/library. Create a symlink so data reaches the persistent location. if [[ "$STORAGE_FOLDER" == /* ]]; then RESOLVED_STORAGE="/data_linkwarden${STORAGE_FOLDER}" + # Safety check: only create symlink if the paths actually differ if [ "$RESOLVED_STORAGE" != "$STORAGE_FOLDER" ]; then mkdir -p "$(dirname "$RESOLVED_STORAGE")" # Preserve any data already written to the non-persistent path if [ -d "$RESOLVED_STORAGE" ] && [ ! -L "$RESOLVED_STORAGE" ]; then - cp -rn "$RESOLVED_STORAGE/." "$STORAGE_FOLDER/" 2>/dev/null || true + if ! cp -rn "$RESOLVED_STORAGE/." "$STORAGE_FOLDER/" 2>/dev/null; then + bashio::log.warning "Could not copy existing data from $RESOLVED_STORAGE to $STORAGE_FOLDER" + fi rm -rf "$RESOLVED_STORAGE" fi ln -sfn "$STORAGE_FOLDER" "$RESOLVED_STORAGE"