Commit b8a63808 authored by Markus Frosch's avatar Markus Frosch
Browse files

Enable/Disable module automatically

parent 6eef87fd
Pipeline #3896 passed with stages
in 13 minutes and 57 seconds
#!/bin/bash
set -e
module_name=ipl
echo "Installing icingaweb2 module ${module_name}"
icinga-build-rpm-install "icingaweb2-module-${module_name}"
sudo sh -ex <<ROOT
ls -al /usr/share/icingaweb2/modules
find /etc/icingaweb2
if [ ! -L /etc/icingaweb2/enabledModules/${module_name} ]; then
echo "Module is not enabled at /etc/icingaweb2/enabledModules/${module_name}" >&2
exit 1
fi
ROOT
......@@ -40,6 +40,33 @@ cp -r * %{buildroot}%{basedir}
%clean
rm -rf %{buildroot}
%post
set -e
# Only for fresh installations
if [ $1 == 1 ]; then
if [ ! -d /etc/icingaweb2/enabledModules ]; then
mkdir /etc/icingaweb2/enabledModules
chmod g=rwx,o= /etc/icingaweb2/enabledModules
fi
echo "Enabling icingaweb2 module '%{module_name}'"
ln -svf /usr/share/icingaweb2/modules/%{module_name} /etc/icingaweb2/enabledModules/%{module_name}
fi
exit 0
%preun
set -e
# Only for removal
if [ $1 == 0 ]; then
echo "Disabling icingaweb2 module '%{module_name}'"
rm -f /etc/icingaweb2/enabledModules/%{module_name}
fi
exit 0
%files
%doc README.md
#LICENSE
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment