Merge pull request #2533 from alexbelgium/copilot/fix-connection-refused-error

Fix wger PermissionError on /data/media during fresh install
This commit is contained in:
Alexandre
2026-02-25 22:07:01 +01:00
committed by GitHub
2 changed files with 8 additions and 4 deletions

View File

@@ -67,6 +67,10 @@ ENV PACKAGES="sudo nginx"
ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_autoapps.sh" "/ha_autoapps.sh"
RUN chmod 744 /ha_autoapps.sh && /ha_autoapps.sh "$PACKAGES" || true && rm /ha_autoapps.sh
# Ensure sudoers entry exists after sudo package installation
# (installing sudo may overwrite /etc/sudoers with its default conffile)
RUN echo "wger ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
################
# 4 Entrypoint #
################

View File

@@ -11,22 +11,22 @@ sed -i "s|/home/wger/db/database.sqlite|/data/database.sqlite|g" /home/wger/src/
#####################
echo "... create directories"
mkdir -p /data/static
if [ -d /home/wger/static ]; then
if [ -d /home/wger/static ] && [ ! -L /home/wger/static ]; then
if [ -n "$(ls -A /home/wger/static 2> /dev/null)" ]; then
cp -rnf /home/wger/static/* /data/static/
fi
rm -r /home/wger/static
fi
ln -s /data/static /home/wger
ln -sf /data/static /home/wger
mkdir -p /data/media
if [ -d /home/wger/media ]; then
if [ -d /home/wger/media ] && [ ! -L /home/wger/media ]; then
if [ -n "$(ls -A /home/wger/media 2> /dev/null)" ]; then
cp -rnf /home/wger/media/* /data/media/
fi
rm -r /home/wger/media
fi
ln -s /data/media /home/wger
ln -sf /data/media /home/wger
#####################
# Align permissions #