diff --git a/configure.ac b/configure.ac index 39d53aa1e..d9478cab8 100644 --- a/configure.ac +++ b/configure.ac @@ -139,7 +139,7 @@ docs/Makefile etc/Makefile etc/icinga2/Makefile etc/icinga2/conf.d/Makefile -etc/icinga2/mods-available/Makefile +etc/icinga2/features-available/Makefile etc/init.d/Makefile icinga-app/Makefile itl/Makefile @@ -155,7 +155,7 @@ third-party/cJSON/Makefile third-party/execvpe/Makefile third-party/mmatch/Makefile tools/Makefile -tools/i2modconf +tools/i2enfeature tools/mkembedconfig/Makefile ]) AC_OUTPUT([ diff --git a/etc/icinga2/Makefile.am b/etc/icinga2/Makefile.am index 300707076..e652d3c34 100644 --- a/etc/icinga2/Makefile.am +++ b/etc/icinga2/Makefile.am @@ -2,7 +2,7 @@ SUBDIRS = \ conf.d \ - mods-available + features-available icinga2confdir = $(sysconfdir)/icinga2 @@ -20,7 +20,7 @@ EXTRA_DIST = $(CONFIG_FILES) install-exec-hook: @cd $(icinga2confdir) && \ - if [ ! -e mods-enabled ]; then \ - $(MKDIR_P) mods-enabled && \ - $(LN_S) ../mods-available/compat.conf mods-enabled/; \ + if [ ! -e features-enabled ]; then \ + $(MKDIR_P) features-enabled && \ + $(LN_S) ../features-available/compat.conf features-enabled/; \ fi diff --git a/etc/icinga2/mods-available/Makefile.am b/etc/icinga2/features-available/Makefile.am similarity index 68% rename from etc/icinga2/mods-available/Makefile.am rename to etc/icinga2/features-available/Makefile.am index b39bc033e..91cf2379d 100644 --- a/etc/icinga2/mods-available/Makefile.am +++ b/etc/icinga2/features-available/Makefile.am @@ -1,8 +1,6 @@ ## Process this file with automake to produce Makefile.in -icinga2confdir = $(sysconfdir)/icinga2/mods-available -icinga2conf_DATA = \ - compat.load +icinga2confdir = $(sysconfdir)/icinga2/features-available CONFIG_FILES = \ compat.conf @@ -15,4 +13,4 @@ install-data-local: fi; \ done -EXTRA_DIST = $(CONFIG_FILES) $(icinga2conf_DATA) +EXTRA_DIST = $(CONFIG_FILES) diff --git a/etc/icinga2/mods-available/compat.conf b/etc/icinga2/features-available/compat.conf similarity index 94% rename from etc/icinga2/mods-available/compat.conf rename to etc/icinga2/features-available/compat.conf index 2c636f33f..c7ed7cbcc 100644 --- a/etc/icinga2/mods-available/compat.conf +++ b/etc/icinga2/features-available/compat.conf @@ -4,7 +4,7 @@ * hosts and services. CompatLog writeis the Icinga 1.x icinga.log and archives. */ -include "compat.load" +library "compat" object StatusDataWriter "status" { } object ExternalCommandListener "command" { } diff --git a/etc/icinga2/mods-available/compat.load b/etc/icinga2/mods-available/compat.load deleted file mode 100644 index f99df2fea..000000000 --- a/etc/icinga2/mods-available/compat.load +++ /dev/null @@ -1,2 +0,0 @@ -library "compat" - diff --git a/tools/Makefile.am b/tools/Makefile.am index 5d21b1d6e..4b32a8255 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,11 +1,10 @@ SUBDIRS = \ mkembedconfig -bin_SCRIPTS = i2modconf +bin_SCRIPTS = i2enfeature CLEANFILES = $(bin_SCRIPTS) -EXTRA_DIST = i2modconf.in +EXTRA_DIST = i2enfeature.in install-exec-hook: - $(LN_S) -f i2modconf $(bindir)/i2enmod - $(LN_S) -f i2modconf $(bindir)/i2dismod + $(LN_S) -f i2enfeature $(bindir)/i2disfeature diff --git a/tools/i2enfeature.in b/tools/i2enfeature.in new file mode 100644 index 000000000..a83b1a1da --- /dev/null +++ b/tools/i2enfeature.in @@ -0,0 +1,67 @@ +#!/bin/sh +prefix=@prefix@ +exec_prefix=@exec_prefix@ +sbindir=@sbindir@ +bindir=@bindir@ +sysconfdir=@sysconfdir@ +localstatedir=@localstatedir@ + +ICINGA2CONFDIR=@sysconfdir@/icinga2 + +TOOL=$(basename -- $0) + +if [ "$TOOL" != "i2enfeature" -a "$TOOL" != "i2disfeature" ]; then + echo "Invalid tool name ($TOOL). Should be 'i2enfeature' or 'i2disfeature'." + exit 1 +fi + +if [ -z "$1" ]; then + echo "Syntax: $0 " + + if [ "$TOOL" = "i2enfeature" ]; then + echo "Enables the specified feature." + else + echo "Disables the specified feature." + fi + + echo + echo -n "Available feature: " + + for file in $ICINGA2CONFDIR/mods-available/*.conf; do + echo -n $(basename -- $file .conf) + done + + echo + + exit 1 +fi + +FEATURE=$1 + +if [ ! -e $ICINGA2CONFDIR/mods-available/$FEATURE.conf ]; then + echo "The feature '$FEATURE' does not exist." + exit 1 +fi + +if [ "$TOOL" = "i2enfeature" ]; then + if [ -e $ICINGA2CONFDIR/mods-enabled/$FEATURE.conf ]; then + echo "The feature '$FEATURE' is already enabled." + exit 0 + fi + + ln -s ../mods-available/$FEATURE.conf $ICINGA2CONFDIR/mods-enabled/ + + echo "Module '$FEATURE' was enabled." +elif [ "$TOOL" = "i2disfeature" ]; then + if [ ! -e $ICINGA2CONFDIR/mods-enabled/$FEATURE.conf ]; then + echo "The feature '$FEATURE' is already disabled." + exit 0 + fi + + rm -f $ICINGA2CONFDIR/mods-enabled/$FEATURE.conf + + echo "Module '$FEATURE' was disabled." +fi + +echo "Make sure to restart Icinga 2 for these changes to take effect." +exit 0 diff --git a/tools/i2modconf.in b/tools/i2modconf.in deleted file mode 100644 index 48edba1c7..000000000 --- a/tools/i2modconf.in +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh -prefix=@prefix@ -exec_prefix=@exec_prefix@ -sbindir=@sbindir@ -bindir=@bindir@ -sysconfdir=@sysconfdir@ -localstatedir=@localstatedir@ - -ICINGA2CONFDIR=@sysconfdir@/icinga2 - -TOOL=$(basename -- $0) - -if [ "$TOOL" != "i2enmod" -a "$TOOL" != "i2dismod" ]; then - echo "Invalid tool name ($TOOL). Should be 'i2enmod' or 'i2dismod'." - exit 1 -fi - -if [ -z "$1" ]; then - echo "Syntax: $0 " - - if [ "$TOOL" = "i2enmod" ]; then - echo "Enables the specified module." - else - echo "Disables the specified module." - fi - - echo - echo -n "Available modules: " - - for file in $ICINGA2CONFDIR/mods-available/*.conf; do - echo -n $(basename -- $file .conf) - done - - echo - - exit 1 -fi - -MOD=$1 - -if [ ! -e $ICINGA2CONFDIR/mods-available/$MOD.conf ]; then - echo "The module '$MOD' does not exist." - exit 1 -fi - -if [ "$TOOL" = "i2enmod" ]; then - if [ -e $ICINGA2CONFDIR/mods-enabled/$MOD.conf ]; then - echo "The module '$MOD' is already enabled." - exit 0 - fi - - ln -s ../mods-available/$MOD.conf $ICINGA2CONFDIR/mods-enabled/ - - echo "Module '$MOD' was enabled." -elif [ "$TOOL" = "i2dismod" ]; then - if [ ! -e $ICINGA2CONFDIR/mods-enabled/$MOD.conf ]; then - echo "The module '$MOD' is already disabled." - exit 0 - fi - - rm -f $ICINGA2CONFDIR/mods-enabled/$MOD.conf - - echo "Module '$MOD' was disabled." -fi - -echo "Make sure to restart Icinga 2 for these changes to take effect." -exit 0