Merge pull request #196 from linuxserver/init-fix

Symlink all logs to avoid defer error on new install
This commit is contained in:
Adam 2023-11-25 12:15:15 +00:00 committed by GitHub
commit 586c3d8751
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,9 @@
# create directory structure
mkdir -p \
/config/www/{uploads,files,images,themes,backups}
/config/www/{uploads,files,images,themes} \
/config/backups \
/config/log/bookstack
# check for .env and copy default if needed
if [[ ! -f "/config/www/.env" ]] || [[ ! -s "/config/www/.env" ]]; then
@ -13,12 +15,10 @@ fi
# create symlinks
symlinks=(
/app/www/themes
/app/www/storage/backups
/app/www/storage/uploads/files
/app/www/storage/uploads/images
/app/www/public/uploads
/app/www/.env
/app/www/storage/logs/laravel.log
)
for i in "${symlinks[@]}"; do
@ -30,6 +30,20 @@ for i in "${symlinks[@]}"; do
fi
done
if [[ -e "/app/www/storage/backups" && ! -L "/app/www/storage/backups" ]]; then
rm -rf "/app/www/storage/backups"
fi
if [[ ! -L "/app/www/storage/backups" ]]; then
ln -s "/config/backups" "/app/www/storage/backups"
fi
if [[ -e "/app/www/storage/logs" && ! -L "/app/www/storage/logs" ]]; then
rm -rf "/app/www/storage/logs"
fi
if [[ ! -L "/app/www/storage/logs" ]]; then
ln -s "/config/log/bookstack" "/app/www/storage/logs"
fi
# Echo init finish for test runs
if [ -n "${TEST_RUN}" ]; then
echo '[ls.io-init] done.'