Files
hassio-addons/piwigo/rootfs/etc/cont-init.d/21-folders
2021-08-31 15:33:08 +02:00

43 lines
1.1 KiB
Plaintext

#!/usr/bin/with-contenv bash
##################
# CORRECT CONFIG #
##################
sed -i "s|$conf['show_php_errors'] = E_ALL;|$conf['show_php_errors'] = E_ALL & ~E_NOTICE & ~E_DEPRECATED;|g" /gallery/local/config/config.inc.php && echo "config corrected for php error" || true
##################
# SYMLINK CONFIG #
##################
if [ ! -d /share/piwigo ]; then
echo "Creating /share/piwigo"
mkdir -p /share/piwigo
chown -R abc:abc /share/piwigo
else
chown -R abc:abc /share/piwigo
fi
# If config doesn't exist, create it
if [ ! -d /share/piwigo/config ]; then
echo "moving config folder"
mv /gallery/local/config /share/piwigo
ln -s /share/piwigo/config /gallery/local
echo "links done"
else
rm /gallery/local/config
ln -s /share/piwigo/config /gallery/local
echo "Using existing config"
fi
# If keys don't exist, create it
if [ ! -d /share/piwigo/keys ]; then
echo "moving keys folder"
mv /config/keys /share/piwigo
ln -s /share/piwigo/keys /config
echo "links done"
else
rm /config/keys
ln -s /share/piwigo/keys /config
echo "Using existing keys folder"
fi