2 Name: check
-mk
-%{edition}-%{pkg_version}
3 Version: SET BY MAKEFILE
4 Release: SET BY MAKEFILE
6 URL: http
://mathias
-kettner.com
7 Group: Application
/System
8 Source: check
-mk
-%{edition}-%{version}.tar.gz
9 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
15 #%define _missing_doc_files_terminate_build 0
16 #%define _unpackaged_files_terminate_build 0
17 # disable binary striping
18 %global __os_install_post
%{nil}
19 # disable creating debug packages
20 %global debug_package
%{nil}
24 Check_MK is a full featured system monitoring
25 solution. This package ships with Check_MK
, Nagios
,
26 the Nagios plugins
, Livestatus
, Multisite
,
27 PNP4Nagios
, NagVis
, and other addons. Please visit
28 http
://mathias
-kettner.com
/.
31 %setup -q
-n check
-mk
-%{edition}-%{version}
39 mkdir -p $RPM_BUILD_ROOT
40 tar xzf omd
/check
-mk
-%{edition}-bin-%{version}.tar.gz
-C $RPM_BUILD_ROOT
41 # Remove all global symbolic links from package. They are shared
42 # among all versions and must be handled in %post und %postun
43 # in order to avoid RPM conflicts
44 rm -f $RPM_BUILD_ROOT
/opt
/omd
/versions
/default
45 rm -f $RPM_BUILD_ROOT
/omd
46 rm -f $RPM_BUILD_ROOT
/usr
/bin
/omd
47 rm -f $RPM_BUILD_ROOT
/usr
/share
/man
/man8
/omd
.8.gz
48 rm -f $RPM_BUILD_ROOT
/@APACHE_CONFDIR@
/*
49 rm -f $RPM_BUILD_ROOT
/etc
/init.d
/omd
50 rm -f $RPM_BUILD_ROOT
/etc
/systemd
/system
/omd.service
55 %attr(4750,root
,omd
) /opt
/omd
/versions
/%{version}/lib
/nagios
/plugins
/check_icmp
56 %attr(4750,root
,omd
) /opt
/omd
/versions
/%{version}/lib
/nagios
/plugins
/check_dhcp
57 %attr(4750,root
,omd
) /opt
/omd
/versions
/%{version}/bin
/mkeventd_open514
58 %attr(4750,root
,omd
) /opt
/omd
/versions
/%{version}/lib
/cmc
/icmpsender
59 %attr(4750,root
,omd
) /opt
/omd
/versions
/%{version}/lib
/cmc
/icmpreceiver
62 groupadd
-r omd
2>/dev
/null || true
63 # create symlink if not exists
70 # Activate init script for OMD, but only the first
71 # time an OMD package is being installed. The admin
72 # might have deactivated the script himself and does
73 # not want to make it implicitely active again.
75 if [ ! -e
/omd
/versions
/default
] ; then
79 echo "New default version is
%{version}."
80 ln
-sfn "
%{version}"
/omd
/versions
/default
81 ln
-sfn
/omd
/versions
/default
/bin
/omd
/usr
/bin
/omd
82 ln
-sfn
/omd
/versions
/default
/share
/man
/man8
/omd
.8.gz
/usr
/share
/man
/man8
/omd
.8.gz
83 ln
-sfn
/omd
/versions
/default
/share
/omd
/apache.conf @APACHE_CONFDIR@
/zzz_omd.conf
84 if [ ! -d
/etc
/bash_completion.d
]; then
85 mkdir /etc
/bash_completion.d
87 ln
-sfn
/omd
/versions
/default
/lib
/omd
/bash_completion
/etc
/bash_completion.d
/omd.sh
90 if [ -d
/usr
/lib
/systemd
] && which systemctl
>/dev
/null
2>&1; then
94 # Detect whether or not manage startup through systemd or SysV
95 if [ $IS_SYSTEMD
-eq
1 ]; then
96 echo "Installing systemd service
: omd.init"
98 # Cleanup eventually existing SysV entry
99 if [ -e
/etc
/init.d
/omd
]; then
100 # Check whether or not startup was enabled before and enable it
101 # with systemd again later
102 if chkconfig omd
>/dev
/null
2>&1; then
106 rm -f
/etc
/init.d
/omd
109 cp
/omd
/versions
/default
/share
/omd
/omd.service
/etc
/systemd
/system
/omd.service
110 systemctl daemon
-reload
113 echo "Installing SysV init script
: omd"
114 ln
-sfn
/omd
/versions
/default
/share
/omd
/omd.init
/etc
/init.d
/omd
117 # If the init script has been marked as to be activated
118 # really activate the init script now
119 if [ $ACTIVATE_INIT
-eq
1 ]; then
120 echo "Activating startup during system boot"
121 if [ $IS_SYSTEMD
-eq
1 ]; then
129 # SLES: make sure apache modules are activated
130 if which a2enmod
>/dev
/null
2>&1
132 echo "Makeing sure that Apache modules proxy
, http_proxy and rewrite are activated."
133 a2enmod proxy
2>/dev
/null || true
134 a2enmod proxy_http
2>/dev
/null || true
135 a2enmod rewrite
2>/dev
/null || true
136 %if 0%{?suse_version} > 1200
137 # Only relevant for SLES12 or newer (having apache 2.4)
138 # This still allows old permission configs like "Order: ..."
139 a2enmod mod_access_compat
2>/dev
/null || true
143 # SLES: make sure that the following file exists:
144 if [ -d
/etc
/apache2
/sysconfig.d
]
146 touch
/etc
/apache2
/sysconfig.d
/include.conf
149 # Make sure, global apache startscript is activated
150 chkconfig
--add @APACHE_NAME@
>/dev
/null
2>&1
151 chkconfig @APACHE_NAME@ on
>/dev
/null
2>&1
153 # RHEL / CENTOS >= 6.4, remove symlinks from existing sites in /etc/fstab
154 if [ -e
/etc
/fstab
]; then
155 sed
-i "s
/^tmpfs \
/omd\
/sites
/tmpfs \
/opt\
/omd\
/sites
/"
/etc
/fstab
158 # ensure apache is running
159 service @APACHE_NAME@ start
>/dev
/null
2>&1
163 # ON UNINSTALL: Make sure no sites use that version
164 # Do not check this on new release of the same OMD version
165 # (I know this has not happend yet in official releases, but might
166 # happen in future? At least I had such a case with my own builds now.)
168 for link
in /omd
/sites
/*/version
170 target
=$
(readlink $link
2>/dev
/null
) ||
continue
171 version
=$
{target
##*/}
172 if [ "$version"
= %{version} ]
174 site
=$
{link
#/omd/sites/}
175 site
=$
{site%
/version
}
176 echo "Site $site is still using this version
!"
>&2
184 v
=$
(ls
-A
/omd
/versions
2>/dev
/null| sort
-n | tail
-n
1)
187 # Test for broken default version symlink and replace with available version
188 if [ ! -e
/omd
/versions
/default
]; then
189 echo "New default version is $v"
190 ln
-sfn "$v"
/omd
/versions
/default
192 DEFAULT_VERSION
=$
(readlink
/omd
/versions
/default
2>/dev
/null
)
193 DEFAULT_VERSION
=$
{DEFAULT_VERSION
##*/}
194 echo "Leaving default version $DEFAULT_VERSION"
197 rm -f
/omd
/versions
/default
198 echo "Removing system group 'omd'"
200 echo "Removing global symbolic links"
202 rm -f
/usr
/share
/man
/man8
/omd
.8.gz
203 rm -f
/etc
/bash_completion.d
/omd
204 rm -f
/etc
/bash_completion.d
/omd.sh
206 # Can be either the symlink /etc/init.d/omd or the regular
207 # file /etc/systemd/system/omd.service.
208 if [ -e
/etc
/init.d
/omd
]; then
209 rm -f
/etc
/init.d
/omd
210 elif [ -f
/etc
/systemd
/system
/omd.service
]; then
211 rm -f
/etc
/systemd
/system
/omd.service
214 rmdir /opt
/omd
/versions
215 rm -f @APACHE_CONFDIR@
/zzz_omd.conf
217 # Try to remove empty directories
218 rmdir /opt
/omd
/sites
2>/dev
/null || true
219 rmdir /opt
/omd
2>/dev
/null || true