mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-03-06 13:18:23 +01:00
The sudoers entry for the wger user was written to /etc/sudoers before the sudo package was installed. When apt-get installs sudo, its default /etc/sudoers conffile may overwrite the entry, causing sudo to fail at runtime. This prevented ha_entrypoint.sh from running as root, so /data/media was never created with correct permissions, resulting in PermissionError when downloading exercise images. Fix: re-add the sudoers entry after the sudo package is installed. Also improve symlink handling in 90-run.sh to avoid self-referencing copies on subsequent container starts. Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com>
59 lines
1.4 KiB
Bash
Executable File
59 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bashio
|
|
|
|
############################
|
|
# Change database location #
|
|
############################
|
|
echo "... set database path"
|
|
sed -i "s|/home/wger/db/database.sqlite|/data/database.sqlite|g" /home/wger/src/settings.py
|
|
|
|
#####################
|
|
# Adapt directories #
|
|
#####################
|
|
echo "... create directories"
|
|
mkdir -p /data/static
|
|
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 -sf /data/static /home/wger
|
|
|
|
mkdir -p /data/media
|
|
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 -sf /data/media /home/wger
|
|
|
|
#####################
|
|
# Align permissions #
|
|
#####################
|
|
echo "... align permissions"
|
|
chown -R wger /data
|
|
chown -R wger /home/wger
|
|
chmod -R 777 /data
|
|
|
|
echo "... add env variables"
|
|
(
|
|
set -o posix
|
|
export -p
|
|
) > /data/env.sh
|
|
while IFS= read -r line; do
|
|
[[ -z "$line" || "$line" =~ ^[[:space:]]*# ]] && continue
|
|
var="${line%%=*}"
|
|
sed -i "/^export[[:space:]]\+$var=/d" /data/env.sh
|
|
echo "export $line" >> /data/env.sh
|
|
done < /.env
|
|
|
|
chown wger /data/env.sh
|
|
chmod +x /data/env.sh
|
|
|
|
bashio::log.info "Starting nginx"
|
|
nginx || true &
|
|
true
|
|
|
|
bashio::log.info "Starting entrypoint"
|