Update 99-run.sh

This commit is contained in:
Alexandre
2025-11-29 20:00:52 +01:00
committed by GitHub
parent 007ab63fb6
commit 1d47e86277

View File

@@ -18,11 +18,15 @@ for folder in config db; do
# Migrate existing data from previous locations while avoiding self-copies
for legacy_path in "/app/${folder}" "/data/${folder}"; do
if [ -d "$legacy_path" ]; then
cp -rn "$legacy_path"/. "$target"/
rm -rf "$legacy_target"
legacy_target="$(readlink -f "$legacy_path" || true)"
if [ "$legacy_target" != "$target" ] && [ "$(ls -A "$legacy_path")" ]; then
# -n prevents clobbering anything already present in /config
cp -rn "$legacy_path"/. "$target"/
fi
fi
done
rm -rf /data/"$folder"
ln -sf "$target" /data/"$folder"
done