Add notify_slack plugin
This commit is contained in:
@@ -0,0 +1 @@
|
||||
*prereq hc_aix.rte
|
||||
@@ -0,0 +1,31 @@
|
||||
Package Name: hc_notify_slack
|
||||
Package VRMF: %BUILD_DATE%
|
||||
Update: N
|
||||
Fileset
|
||||
Fileset Name: hc_notify_slack.rte
|
||||
Fileset VRMF: %BUILD_DATE%
|
||||
Fileset Description: Health Checker - core Slack plugin
|
||||
USRLIBLPPFiles
|
||||
EOUSRLIBLPPFiles
|
||||
ROOTLIBLPPFiles
|
||||
Post-installation Script: /export/nim/build/hc_notify_slack/scripts/hc_notify_slack.postinstall
|
||||
Unpost-installation Script: /export/nim/build/hc_notify_slack/scripts/hc_notify_slack.postuninstall
|
||||
EOROOTLIBLPPFiles
|
||||
Bosboot required: N
|
||||
License agreement acceptance required: N
|
||||
Include license files in this package: N
|
||||
Requisites: /export/nim/build/hc_notify_slack/hc_notify_slack.reqs
|
||||
USRFiles
|
||||
EOUSRFiles
|
||||
ROOT Part: Y
|
||||
ROOTFiles
|
||||
/opt/hc/lib
|
||||
/opt/hc/lib/core
|
||||
/opt/hc/lib/platform/aix/notify_slack.sh
|
||||
/etc/opt/hc
|
||||
/etc/opt/hc/core
|
||||
/etc/opt/hc/core/providers
|
||||
/etc/opt/hc/core/providers/notify_slack.conf.dist
|
||||
EOROOTFiles
|
||||
Relocatable: N
|
||||
EOFileset
|
||||
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env ksh
|
||||
#******************************************************************************
|
||||
# @(#) post-install script for hc_notify_slack LPP package
|
||||
#******************************************************************************
|
||||
# @(#) Copyright (C) 2022 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
||||
#
|
||||
# This program is a free software; you can redistribute it and/or modify
|
||||
# it under the same terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
||||
#******************************************************************************
|
||||
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
# location of ETC dir
|
||||
HC_ETC_DIR="/etc/opt/hc"
|
||||
# location of check_health.sh
|
||||
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
print "INFO: starting post-install script ..."
|
||||
|
||||
# copy plugin config file from dist (if needed)
|
||||
if [[ ! -f ${HC_ETC_DIR}/core/providers/notify_slack.conf ]]
|
||||
then
|
||||
cp -p ${HC_ETC_DIR}/core/providers/notify_slack.conf.dist ${HC_ETC_DIR}/core/providers/notify_slack.conf >/dev/null || \
|
||||
{
|
||||
print -u2 "ERROR: could not copy plugin config file in ${HC_ETC_DIR}/core/providers"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
# refresh symbolic FPATH links
|
||||
if [[ -x ${HC_BIN} ]]
|
||||
then
|
||||
${HC_BIN} --fix-symlinks || print -u2 "WARN: updating symlinks failed"
|
||||
else
|
||||
print -u2 "ERROR: could not locate or excute the HC main script (${HC_BIN})"
|
||||
fi
|
||||
|
||||
print "INFO: finished post-install script"
|
||||
|
||||
exit 0
|
||||
|
||||
#******************************************************************************
|
||||
# END of script
|
||||
#******************************************************************************
|
||||
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env ksh
|
||||
#******************************************************************************
|
||||
# @(#) post-uninstall script for hc_notify_slack LPP package
|
||||
#******************************************************************************
|
||||
# @(#) Copyright (C) 2022 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
||||
#
|
||||
# This program is a free software; you can redistribute it and/or modify
|
||||
# it under the same terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
||||
#******************************************************************************
|
||||
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
# location of the HC configuration files
|
||||
HC_ETC_DIR="/etc/opt/hc"
|
||||
# location of check_health.sh
|
||||
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
print "INFO: starting post-uninstall script ..."
|
||||
|
||||
# remove plugin configuration file (.dist only)
|
||||
if [[ -d ${HC_ETC_DIR}/core/providers ]]
|
||||
then
|
||||
rm -f ${HC_ETC_DIR}/core/providers/notify_slack.conf.dist >/dev/null
|
||||
(( $? == 0 )) || echo "WARN: could not remove plugin config file in directory ${HC_ETC_DIR}/core/providers"
|
||||
fi
|
||||
|
||||
# refresh symbolic FPATH links
|
||||
if [[ -x ${HC_BIN} ]]
|
||||
then
|
||||
${HC_BIN} --fix-symlinks || print -u2 "WARN: updating symlinks failed"
|
||||
else
|
||||
print -u2 "ERROR: could not locate or excute the HC main script (${HC_BIN})"
|
||||
fi
|
||||
|
||||
print "INFO: finished post-uninstall script"
|
||||
|
||||
exit 0
|
||||
|
||||
#******************************************************************************
|
||||
# END of script
|
||||
#******************************************************************************
|
||||
@@ -0,0 +1,80 @@
|
||||
# Depot definition:
|
||||
depot
|
||||
layout_version 1.0
|
||||
|
||||
# Vendor definition:
|
||||
vendor
|
||||
tag KUDOS
|
||||
title "KUDOS BVBA - http://www.kudos.be"
|
||||
end
|
||||
|
||||
# Bundle definitions:
|
||||
bundle
|
||||
tag HC-NOTIFY-SLACK
|
||||
title "The Health Checker (HC) for UNIX (core SLACK plugin)"
|
||||
os_name HP-UX
|
||||
revision %BUILD_DATE%
|
||||
architecture HP-UX_B.11_32/64
|
||||
machine_type ia64*
|
||||
vendor_tag KUDOS
|
||||
contents HC-NOTIFY-SLACK-MAIN,r=,a=,v=
|
||||
end
|
||||
|
||||
# Product definitions:
|
||||
product
|
||||
tag HC-NOTIFY-SLACK-MAIN
|
||||
revision %BUILD_DATE%
|
||||
category tools
|
||||
category_title Tools
|
||||
title "The Health Checker (HC) for UNIX (OS plugins)"
|
||||
description "The Health Checker is collection of scripts (plugins)
|
||||
designed to perform regular - but not intensive - health checks on
|
||||
UNIX/Linux systems. It provides plugins for AIX, HP-UX and Linux as
|
||||
well customer specific checks. Checks may include topics such file
|
||||
system mounts, process checks, file consistency etc.
|
||||
This is the core SLACK plugin package"
|
||||
architecture S700/S800_HP-UX_10/HP-UX_11/IA64_HP-UX_11
|
||||
machine_type 9000/7*|9000/8*|ia64*
|
||||
os_name HP-UX
|
||||
os_release ?.1?.*
|
||||
os_version [A-Z]
|
||||
directory /opt/hc
|
||||
is_locatable false
|
||||
is_patch false
|
||||
|
||||
postinstall scripts/hc_notify_slack.postinstall
|
||||
postremove scripts/hc_notify_slack.postremove
|
||||
|
||||
# Fileset definitions:
|
||||
fileset
|
||||
tag core_plugins
|
||||
title UX Health Checker (core SLACK plugins)
|
||||
is_kernel false
|
||||
is_locatable false
|
||||
is_reboot false
|
||||
is_sparse false
|
||||
is_patch false
|
||||
prerequisite HC-HPUX-MAIN
|
||||
|
||||
file_permissions -u 0222 -o root -g sys
|
||||
|
||||
directory ../../../opt/hc/lib/core=/opt/hc/lib/core
|
||||
file -m 755 notify_slack.sh
|
||||
end
|
||||
|
||||
fileset
|
||||
tag config
|
||||
title UX Health Checker (core SLACK plugins: configuration)
|
||||
is_kernel false
|
||||
is_locatable false
|
||||
is_reboot false
|
||||
is_sparse false
|
||||
is_patch false
|
||||
prerequisite HC-NOTIFY-SLACK-MAIN.core_plugins
|
||||
|
||||
file_permissions -u 0222 -o root -g sys
|
||||
|
||||
directory ../../../etc/opt/hc/core/providers=/etc/opt/hc/core/providers
|
||||
file -m 644 notify_slack.conf.dist
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env ksh
|
||||
#******************************************************************************
|
||||
# @(#) post-install script for HC-NOTIFY-SLACK SD package
|
||||
#******************************************************************************
|
||||
# @(#) Copyright (C) 2022 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
||||
#
|
||||
# This program is a free software; you can redistribute it and/or modify
|
||||
# it under the same terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
||||
#******************************************************************************
|
||||
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
# location of ETC dir
|
||||
HC_ETC_DIR="/etc/opt/hc"
|
||||
# location of check_health.sh
|
||||
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
print "INFO: starting post-install script ..."
|
||||
|
||||
# copy plugin config file from dist (if needed)
|
||||
if [[ ! -f ${HC_ETC_DIR}/core/providers/notify_slack.conf ]]
|
||||
then
|
||||
cp -p ${HC_ETC_DIR}/core/providers/notify_slack.conf.dist ${HC_ETC_DIR}/core/providers/notify_slack.conf >/dev/null || \
|
||||
{
|
||||
print -u2 "ERROR: could not copy plugin config file in ${HC_ETC_DIR}/core/providers"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
# refresh symbolic FPATH links
|
||||
if [[ -x ${HC_BIN} ]]
|
||||
then
|
||||
${HC_BIN} --fix-symlinks || print -u2 "WARN: updating symlinks failed"
|
||||
else
|
||||
print -u2 "ERROR: could not locate or excute the HC main script (${HC_BIN})"
|
||||
fi
|
||||
|
||||
print "INFO: finished post-install script"
|
||||
|
||||
exit 0
|
||||
|
||||
#******************************************************************************
|
||||
# END of script
|
||||
#******************************************************************************
|
||||
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env ksh
|
||||
#******************************************************************************
|
||||
# @(#) post-remove script for HC-NOTIFY-SLACK SD package
|
||||
#******************************************************************************
|
||||
# @(#) Copyright (C) 2022 by KUDOS BVBA (info@kudos.be). All rights reserved.
|
||||
#
|
||||
# This program is a free software; you can redistribute it and/or modify
|
||||
# it under the same terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
||||
#******************************************************************************
|
||||
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
# location of the HC configuration files
|
||||
HC_ETC_DIR="/etc/opt/hc"
|
||||
# location of check_health.sh
|
||||
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
|
||||
print "INFO: starting post-remove script ..."
|
||||
|
||||
# remove plugin configuration file (.dist only)
|
||||
if [[ -d ${HC_ETC_DIR}/core/providers ]]
|
||||
then
|
||||
rm -f ${HC_ETC_DIR}/core/providers/notify_slack.conf.dist >/dev/null
|
||||
(( $? == 0 )) || echo "WARN: could not remove plugin config file in directory ${HC_ETC_DIR}/core/providers"
|
||||
fi
|
||||
|
||||
# refresh symbolic FPATH links
|
||||
if [[ -x ${HC_BIN} ]]
|
||||
then
|
||||
${HC_BIN} --fix-symlinks || print -u2 "WARN: updating symlinks failed"
|
||||
else
|
||||
print -u2 "ERROR: could not locate or excute the HC main script (${HC_BIN})"
|
||||
fi
|
||||
|
||||
print "INFO: finished post-remove script"
|
||||
|
||||
exit 0
|
||||
|
||||
#******************************************************************************
|
||||
# END of script
|
||||
#******************************************************************************
|
||||
@@ -0,0 +1,33 @@
|
||||
# -- post-install --
|
||||
post_install() {
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
# location of check_health.sh
|
||||
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
echo "INFO: starting post-install script ..."
|
||||
# refresh symbolic FPATH links
|
||||
if [[ -x ${HC_BIN} ]]
|
||||
then
|
||||
${HC_BIN} --fix-symlinks
|
||||
(( $? == 0 )) || echo "WARN: updating symlinks failed"
|
||||
fi
|
||||
echo "INFO: finished post-install script"
|
||||
}
|
||||
|
||||
# -- post-remove --
|
||||
post_remove() {
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
# location of check_health.sh
|
||||
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
echo "INFO: starting post-uninstall script ..."
|
||||
# refresh symbolic FPATH links
|
||||
if [[ -x ${HC_BIN} ]]
|
||||
then
|
||||
${HC_BIN} --fix-symlinks
|
||||
(( $? == 0 )) || echo "WARN: updating symlinks failed"
|
||||
fi
|
||||
echo "INFO: finished post-uninstall script"
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
# Maintainer: Patrick Van der Veken <patrick@kudos.be>
|
||||
|
||||
_pkgname="check_health"
|
||||
pkgname="hc-notify-slack"
|
||||
pkgver="%BUILD_DATE%"
|
||||
pkgrel=1
|
||||
pkgdesc="The KUDOS Health Checker (HC) for UNIX (Slack notify core plugin)"
|
||||
arch=("any")
|
||||
url="https://github.com/patvdv/${_pkgname}"
|
||||
license=('GPL3')
|
||||
makedepends=('git')
|
||||
depends=('hc-linux')
|
||||
source=("${_pkgname}::git+${url}.git#branch=master")
|
||||
install=".install"
|
||||
sha256sums=('SKIP')
|
||||
|
||||
package() {
|
||||
cd "${srcdir}/${_pkgname}"
|
||||
install -d -m 755 ${pkgdir}/opt/hc/lib
|
||||
install -d -m 755 ${pkgdir}/opt/hc/lib/core
|
||||
install -D -m 755 opt/hc/lib/core/notify_slack.sh ${pkgdir}/opt/hc/lib/core/notify_slack.sh
|
||||
install -d -m 755 ${pkgdir}/etc/opt/hc
|
||||
install -d -m 755 ${pkgdir}/etc/opt/hc/core
|
||||
install -d -m 755 ${pkgdir}/etc/opt/hc/core/providers
|
||||
install -D -m 644 etc/opt/hc/core/providers/notify_slack.conf.dist ${pkgdir}/etc/opt/hc/core/providers/notify_slack.conf.dist
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
Package: hc-notify-slack
|
||||
Version: %BUILD_DATE%
|
||||
Architecture: all
|
||||
Maintainer: Patrick Van der Veken <patrick@kudos.be>
|
||||
Essential: no
|
||||
Installed-Size: 50
|
||||
Pre-Depends: hc-linux
|
||||
Section: tools
|
||||
Priority: extra
|
||||
Description: The KUDOS Health Checker (HC) for UNIX (Slack notify core plugin).
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
# location of the HC configuration files
|
||||
HC_ETC_DIR="/etc/opt/hc"
|
||||
# location of check_health.sh
|
||||
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
echo "INFO: starting post-install script ..."
|
||||
# debian: reset ownerships
|
||||
chown -R root:root /opt/hc /etc/opt/hc 2>/dev/null
|
||||
# copy plugin configuration file
|
||||
if [[ -f ${HC_ETC_DIR}/core/providers/notify_slack.conf.dist ]]
|
||||
then
|
||||
if [[ ! -f ${HC_ETC_DIR}/core/providers/notify_slack.conf ]]
|
||||
then
|
||||
cp -p ${HC_ETC_DIR}/core/providers/notify_slack.conf.dist ${HC_ETC_DIR}/core/providers/notify_slack.conf >/dev/null
|
||||
(( $? == 0 )) || \
|
||||
{
|
||||
echo "ERROR: could not copy plugin config file in ${HC_ETC_DIR}/core/providers"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
else
|
||||
echo "WARN: could not find plugin config .dist file in ${HC_ETC_DIR}/core/providers"
|
||||
fi
|
||||
# refresh symbolic FPATH links
|
||||
if [[ -x ${HC_BIN} ]]
|
||||
then
|
||||
${HC_BIN} --fix-symlinks
|
||||
(( $? == 0 )) || echo "WARN: updating symlinks failed"
|
||||
fi
|
||||
echo "INFO: finished post-install script"
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
# location of the HC configuration files
|
||||
HC_ETC_DIR="/etc/opt/hc"
|
||||
# location of check_health.sh
|
||||
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
# update or uninstall?
|
||||
if (( $1 == 0 ))
|
||||
then
|
||||
echo "INFO: starting post-uninstall script ..."
|
||||
# copy plugin configuration file (.dist only)
|
||||
if [[ -d ${HC_ETC_DIR}/core/providers ]]
|
||||
then
|
||||
rm -f ${HC_ETC_DIR}/core/providers/notify_slack.conf.dist 2>/dev/null
|
||||
(( $? == 0 )) || \
|
||||
{
|
||||
echo "ERROR: could not remove plugin config file in ${HC_ETC_DIR}/core/providers"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
else
|
||||
echo "INFO: starting post-uninstall script (RPM upgrade)"
|
||||
fi
|
||||
# refresh symbolic FPATH links
|
||||
if [[ -x ${HC_BIN} ]]
|
||||
then
|
||||
${HC_BIN} --fix-symlinks
|
||||
(( $? == 0 )) || echo "WARN: updating symlinks failed"
|
||||
fi
|
||||
echo "INFO: finished post-uninstall script"
|
||||
@@ -0,0 +1,107 @@
|
||||
%define build_timestamp %(date +"%Y%m%d")
|
||||
|
||||
Name: hc-notify-slack
|
||||
Version: %{build_timestamp}
|
||||
Release: 1
|
||||
|
||||
Summary: The KUDOS Health Checker (HC) for UNIX (Slack notify core plugin)
|
||||
Group: Tools/Monitoring
|
||||
|
||||
License: GNU General Public License either version 2 of the License, or (at your option) any later version
|
||||
URL: http://www.kudos.be
|
||||
|
||||
Requires: ksh,hc-linux
|
||||
BuildArch: noarch
|
||||
BuildRoot: %{_topdir}/%{name}-%{version}-root
|
||||
|
||||
%description
|
||||
The Health Checker is collection of scripts (plugins) designed to perform regular - but not intensive - health checks on UNIX/Linux systems. It provides plugins for AIX, HP-UX and Linux as well customer specific checks. Checks may include topics such file system mounts, process checks, file consistency etc.
|
||||
This package contains core plugins (notify).
|
||||
|
||||
%prep
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
install -d -m 755 $RPM_BUILD_ROOT/opt/hc/lib
|
||||
install -d -m 755 $RPM_BUILD_ROOT/opt/hc/lib/core
|
||||
cp ../SOURCES/opt/hc/lib/core/notify_slack.sh $RPM_BUILD_ROOT/opt/hc/lib/core/notify_slack.sh
|
||||
install -d -m 755 $RPM_BUILD_ROOT/etc/opt/hc
|
||||
install -d -m 755 $RPM_BUILD_ROOT/etc/opt/hc/core
|
||||
install -d -m 755 $RPM_BUILD_ROOT/etc/opt/hc/core/providers
|
||||
cp ../SOURCES/etc/opt/hc/core/providers/notify_slack.conf.dist $RPM_BUILD_ROOT/etc/opt/hc/core/providers/notify_slack.conf.dist
|
||||
|
||||
%post
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
# location of the HC configuration files
|
||||
HC_ETC_DIR="/etc/opt/hc"
|
||||
# location of check_health.sh
|
||||
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
echo "INFO: starting post-install script ..."
|
||||
# copy plugin configuration file
|
||||
if [[ ! -f ${HC_ETC_DIR}/core/providers/notify_slack.conf ]]
|
||||
then
|
||||
cp -p ${HC_ETC_DIR}/core/providers/notify_slack.conf.dist ${HC_ETC_DIR}/core/providers/notify_slack.conf >/dev/null
|
||||
(( $? == 0 )) || \
|
||||
{
|
||||
echo "ERROR: could not copy plugin config file in ${HC_ETC_DIR}/core/providers"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
# refresh symbolic FPATH links
|
||||
if [[ -x ${HC_BIN} ]]
|
||||
then
|
||||
${HC_BIN} --fix-symlinks
|
||||
(( $? == 0 )) || echo "WARN: updating symlinks failed"
|
||||
fi
|
||||
echo "INFO: finished post-install script"
|
||||
|
||||
%postun
|
||||
# ------------------------- CONFIGURATION starts here -------------------------
|
||||
# location of the HC configuration files
|
||||
HC_ETC_DIR="/etc/opt/hc"
|
||||
# location of check_health.sh
|
||||
HC_BIN="/opt/hc/bin/check_health.sh"
|
||||
PATH="$PATH:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin"
|
||||
# ------------------------- CONFIGURATION ends here ---------------------------
|
||||
# update or uninstall?
|
||||
if (( $1 == 0 ))
|
||||
then
|
||||
echo "INFO: starting post-uninstall script ..."
|
||||
# copy plugin configuration file (.dist only)
|
||||
if [[ -d ${HC_ETC_DIR}/core/providers ]]
|
||||
then
|
||||
rm -f ${HC_ETC_DIR}/core/providers/notify_slack.conf.dist 2>/dev/null
|
||||
(( $? == 0 )) || \
|
||||
{
|
||||
echo "ERROR: could not remove plugin config file in ${HC_ETC_DIR}/core/providers"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
else
|
||||
echo "INFO: starting post-uninstall script (RPM upgrade)"
|
||||
fi
|
||||
# refresh symbolic FPATH links
|
||||
if [[ -x ${HC_BIN} ]]
|
||||
then
|
||||
${HC_BIN} --fix-symlinks
|
||||
(( $? == 0 )) || echo "WARN: updating symlinks failed"
|
||||
fi
|
||||
echo "INFO: finished post-uninstall script"
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,755)
|
||||
%dir /opt/hc/lib
|
||||
%dir /opt/hc/lib/core
|
||||
%attr(755, root, root) /opt/hc/lib/core/notify_slack.sh
|
||||
%dir /etc/opt/hc
|
||||
%dir /etc/opt/hc/core
|
||||
%dir /etc/opt/hc/core/providers
|
||||
%attr(644, root, root) /etc/opt/hc/core/providers/notify_slack.conf.dist
|
||||
|
||||
%changelog
|
||||
* Sun Oct 14 2022 <patrick@kudos.be> - 0.0.1
|
||||
- Initial build
|
||||
@@ -47,6 +47,7 @@ rpmbuild -bb ${BUILD_DIR}/SPECS/hc-linux-platform.spec
|
||||
# build core plugins
|
||||
rpmbuild -bb ${BUILD_DIR}/SPECS/hc-notify-eif.spec
|
||||
rpmbuild -bb ${BUILD_DIR}/SPECS/hc-notify-sms.spec
|
||||
rpmbuild -bb ${BUILD_DIR}/SPECS/hc-notify-slack.spec
|
||||
rpmbuild -bb ${BUILD_DIR}/SPECS/hc-display-init.spec
|
||||
rpmbuild -bb ${BUILD_DIR}/SPECS/hc-display-json.spec
|
||||
rpmbuild -bb ${BUILD_DIR}/SPECS/hc-display-csv.spec
|
||||
|
||||
Reference in New Issue
Block a user