Skip to content

Commit c2f4fca

Browse files
authored
Fixed broken symlinks in 6 => 6-next mount (#483)
no ref - moving the volume mount from a 6 => 6-next image would result in broken symlinks due to the way the default themes are shipped in the image - automatically cleanup broken symlinks instead of copying files through them
1 parent 653aed9 commit c2f4fca

3 files changed

Lines changed: 27 additions & 3 deletions

File tree

6-next/alpine3.23/docker-entrypoint.sh

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

6-next/bookworm/docker-entrypoint.sh

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docker-entrypoint-next.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ fi
7777

7878
# allow the container to be started with `--user`
7979
if [ -n "$isGhost" ] && [ "$(id -u)" = '0' ]; then
80-
find "$GHOST_CONTENT" \! -user ghost -exec chown ghost '{}' +
80+
# -h: ghost:6 seeded its bundled themes as symlinks into /var/lib/ghost, which does not
81+
# exist here. Without it chown follows them, fails on the missing target, and set -e aborts.
82+
find "$GHOST_CONTENT" \! -user ghost -exec chown -h ghost '{}' +
8183
exec gosu ghost "$0" "$@"
8284
fi
8385

@@ -87,6 +89,12 @@ if [ -n "$isGhost" ]; then
8789
src="${src%/}"
8890
target="$GHOST_CONTENT/${src#$baseDir/}"
8991
mkdir -p "$(dirname "$target")"
92+
# those same dangling theme symlinks are not "-e", so the seed below would run and tar
93+
# would extract *through* the symlink instead of replacing it. Drop them first. Guarded on
94+
# broken-only so a user's own valid symlinked theme is left alone.
95+
if [ -L "$target" ] && [ ! -e "$target" ]; then
96+
rm -f "$target"
97+
fi
9098
if [ ! -e "$target" ]; then
9199
tar -cC "$(dirname "$src")" "$(basename "$src")" | tar -xC "$(dirname "$target")"
92100
fi

0 commit comments

Comments
 (0)