addon-grocy/grocy/rootfs/etc/cont-init.d/grocy.sh
Franck Nijhof 45fe79ac0b
🔨 Re-branding
2020-02-12 00:25:43 +01:00

25 lines
968 B
Bash

#!/usr/bin/with-contenv bashio
# ==============================================================================
# Community Home Assistant Add-on: Grocy
# Sets up Grocy before the server starts
# ==============================================================================
if ! bashio::fs.directory_exists "/data/grocy"; then
bashio::log.debug 'Data directory not initialized, doing that now...'
# Setup structure
cp -R /var/www/grocy/data /data/grocy
# Ensure file permissions
chown -R nginx:nginx /data/grocy
find /data/grocy -not -perm 0644 -type f -exec chmod 0644 {} \;
find /data/grocy -not -perm 0755 -type d -exec chmod 0755 {} \;
fi
if ! bashio::fs.directory_exists "/data/grocy/viewcache"; then
mkdir -p /data/grocy/viewcache
chown nginx:nginx /data/grocy/viewcache
fi
bashio::log.debug 'Symlinking data directory to persistent storage location...'
rm -f -r /var/www/grocy/data
ln -s /data/grocy /var/www/grocy/data