mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-11 02:11:01 +01:00
49 lines
1.1 KiB
Bash
Executable File
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"
|