Files
hassio-addons/wger/rootfs/etc/cont-init.d/90-run.sh
2025-09-01 08:54:36 +02:00

49 lines
1.1 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 ]; 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
mkdir -p /data/media
if [ -d /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
#####################
# Align permissions #
#####################
echo "... align permissions"
(
set -o posix
export -p
) > /data/env.sh
chown -R 1000:1000 /data
chown -R 1000:1000 /home/wger
chmod -R 777 /data
bashio::log.info "Starting nginx"
nginx || true &
true
bashio::log.info "Starting entrypoint"
su -p -s /bin/bash wger -c "/home/wger/entrypoint.sh"