1
0
Fork 0
mirror of https://github.com/librenms/docker.git synced 2026-01-23 02:14:48 +00:00

Create 09-plugin-add.sh

This commit is contained in:
Skylark 2025-01-27 09:40:22 +00:00
parent 24b2130827
commit 1aedf4bae9

View file

@ -0,0 +1,43 @@
#!/usr/bin/with-contenv sh
# shellcheck shell=sh
set -e
INSTALL_PLUGINS=${INSTALL_PLUGINS:-0}
# Continue only if plugins are needed
if [ "$INSTALL_PLUGINS" = "0" ]; then
exit 0
fi
echo ">>"
echo ">> Plugin configuration detected"
echo ">>"
# Fix perms
echo "Fixing perms..."
chown librenms:librenms \
${LIBRENMS_PATH}/composer.* \
${LIBRENMS_PATH}/logs/librenms.log \
${LIBRENMS_PATH}/scripts/composer_wrapper.php
chown -R librenms:librenms \
${LIBRENMS_PATH}/scripts \
${LIBRENMS_PATH}/vendor \
${LIBRENMS_PATH}/bootstrap
# Create service
IFS=, read -ra PLUGINS <<< "$INSTALL_PLUGINS"
for plugin in "${PLUGINS[@]}"; do
echo "Installing plugin: $plugin"
if ! lnms plugin:installed "$plugin"; then
if ! lnms plugin:add "$plugin"; then
echo "Error installing $plugin" >&2
exit 1
fi
echo "Installed $plugin"
else
echo "$plugin already installed"
fi
done