diff --git a/rootfs/etc/cont-init.d/03-config.sh b/rootfs/etc/cont-init.d/03-config.sh index ab662f0..aa30aa7 100644 --- a/rootfs/etc/cont-init.d/03-config.sh +++ b/rootfs/etc/cont-init.d/03-config.sh @@ -88,7 +88,21 @@ sed -i -e "s/RANDOMSTRINGGOESHERE/${LIBRENMS_SNMP_COMMUNITY}/" /etc/snmp/snmpd.c # Init files and folders echo "Initializing LibreNMS files / folders..." mkdir -p /data/config /data/logs /data/monitoring-plugins /data/plugins /data/rrd /data/weathermap /data/alert-templates -ln -sf /data/weathermap ${LIBRENMS_PATH}/html/plugins/Weathermap/configs + +if [ -d "${LIBRENMS_PATH}/html/plugins/Weathermap/configs" ] && [ ! -L "${LIBRENMS_PATH}/html/plugins/Weathermap/configs" ]; then + rm -rf ${LIBRENMS_PATH}/html/plugins/Weathermap/configs +fi +if [ ! -L "${LIBRENMS_PATH}/html/plugins/Weathermap/configs" ]; then + ln -sf /data/weathermap ${LIBRENMS_PATH}/html/plugins/Weathermap/configs +fi +chown -h librenms:librenms ${LIBRENMS_PATH}/html/plugins/Weathermap/configs +chown -R librenms:librenms /data/weathermap + +# cleanup bad symlink: https://github.com/librenms/docker/issues/294#issuecomment-1190389960 +if [ -L "/data/weathermap/weathermap" ]; then + rm /data/weathermap/weathermap +fi + touch /data/logs/librenms.log rm -rf ${LIBRENMS_PATH}/logs rm -f ${LIBRENMS_PATH}/config.d/*