#!/bin/bash TARGET_PLUGIN_DIR="/usr/lib/check_mk_agent/plugins" # Enter folder where installer and plugins live cd `dirname $0` # This script expects $1 to be the name of the plugin to install if [[ "" == "$1" ]]; then echo "Please provide the name of the plugin to install." echo "Example: $0 postfix-stats.sh" exit 1 fi plugin_file=$1 if [[ ! -f "$plugin_file" ]]; then echo "Plugin file does not exist!" exit 1 fi # Plugin file should exist at this point, so let's build and install the launcher launcher_path="$TARGET_PLUGIN_DIR/000-launch-$plugin" plugin_path=$(pwd) echo "$plugin_path/$plugin_file" > $launcher_path chmod +x $launcher_path exit 0