-
-
Notifications
You must be signed in to change notification settings - Fork 309
Expand file tree
/
Copy path09-plugin-add.sh
More file actions
43 lines (35 loc) · 911 Bytes
/
09-plugin-add.sh
File metadata and controls
43 lines (35 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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