check_logfiles: 3.7.5.1
[omd.git] / omd.spec.in
blobf74f4f31ec2be5610071c739de69ae3312d05456
1 Summary: OMD - OpenSource Monitoring Distribution
2 Name: omd-%{version}
3 Version: SET BY MAKEFILE
4 Release: SET BY MAKEFILE
5 License: GPL
6 URL: http://omdistro.org/
7 Group: Application/System
8 Source: %{name}.tar.gz
9 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
10 AutoReq: off
11 AutoProv: off
12 Provides: omd
13 Requires:
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}
23 %description
24 Open Source Monitoring Distribution, containing Nagios,
25 the Nagios plugins, Check_MK, Livestatus, Multisite,
26 PNP4Nagios, NagVis, and other addons. Please visit
27 http://omdistro.org/.
29 %prep
30 %setup -q -n omd-%{version}
32 %build
33 make -j 4
34 make pack
36 %install
37 mkdir -p $RPM_BUILD_ROOT
38 tar xzf omd-bin-%{version}.tar.gz -C $RPM_BUILD_ROOT
39 # Remove all global symbolic links from package. They are shared
40 # among all versions and must be handled in %post und %postun
41 # in order to avoid RPM conflicts
42 rm -f $RPM_BUILD_ROOT/opt/omd/versions/default
43 rm -f $RPM_BUILD_ROOT/omd
44 rm -f $RPM_BUILD_ROOT/usr/bin/omd
45 rm -f $RPM_BUILD_ROOT/usr/share/man/man8/omd.8.gz
46 rm -f $RPM_BUILD_ROOT/@APACHE_CONFDIR@/*
47 rm -f $RPM_BUILD_ROOT/etc/init.d/omd
49 %files
50 %defattr(-,root,root)
51 /opt/omd
52 %attr(4750,root,omd) /opt/omd/versions/%{version}/lib/nagios/plugins/check_icmp
53 %attr(4750,root,omd) /opt/omd/versions/%{version}/lib/nagios/plugins/check_dhcp
54 %attr(4750,root,omd) /opt/omd/versions/%{version}/bin/mkeventd_open514
56 %pre
57 groupadd -r omd 2>/dev/null || true
58 # create symlink if not exists
59 if [ ! -e /omd ]
60 then
61 ln -sfn /opt/omd /omd
64 %post
65 # Activate init script for OMD, but only the first
66 # time an OMD package is being installed. The admin
67 # might have deactivated the script himself and does
68 # not want to make it implicitely active again.
69 ACTIVATE_INIT=0
70 if [ ! -e /omd/versions/default ] ; then
71 echo "Activating init script /etc/init.d/omd"
72 ACTIVATE_INIT=1
75 echo "New default version is %{version}."
76 ln -sfn "%{version}" /omd/versions/default
77 ln -sfn /omd/versions/default/bin/omd /usr/bin/omd
78 ln -sfn /omd/versions/default/share/man/man8/omd.8.gz /usr/share/man/man8/omd.8.gz
79 ln -sfn /omd/versions/default/share/omd/omd.init /etc/init.d/omd
80 ln -sfn /omd/versions/default/share/omd/apache.conf @APACHE_CONFDIR@/zzz_omd.conf
82 # If the init script has been marked as to be activated
83 # really activate the init script now
84 if [ $ACTIVATE_INIT -eq 1 ]; then
85 chkconfig --add omd
86 chkconfig omd on
89 # SLES: make sure apache modules are activated
90 if which a2enmod >/dev/null 2>&1
91 then
92 echo "Makeing sure that Apache modules proxy, http_proxy and rewrite are activated."
93 a2enmod proxy 2>/dev/null || true
94 a2enmod proxy_http 2>/dev/null || true
95 a2enmod rewrite 2>/dev/null || true
96 %if 0%{?suse_version} > 1200
97 # Only relevant for SLES12 or newer (having apache 2.4)
98 # This still allows old permission configs like "Order: ..."
99 a2enmod mod_access_compat 2>/dev/null || true
100 %endif
103 # SLES: make sure that the following file exists:
104 if [ -d /etc/apache2/sysconfig.d ]
105 then
106 touch /etc/apache2/sysconfig.d/include.conf
109 # Make sure, global apache startscript is activated
110 chkconfig --add @APACHE_NAME@ >/dev/null 2>&1
111 chkconfig @APACHE_NAME@ on >/dev/null 2>&1
113 # ensure apache is running
114 service @APACHE_NAME@ start >/dev/null 2>&1
115 exit 0
117 %preun
118 # ON UNINSTALL: Make sure no sites use that version
119 # Do not check this on new release of the same OMD version
120 # (I know this has not happend yet in official releases, but might
121 # happen in future? At least I had such a case with my own builds now.)
122 if [ $1 = 0 ] ; then
123 for link in /omd/sites/*/version
125 target=$(readlink $link 2>/dev/null) || continue
126 version=${target##*/}
127 if [ "$version" = %{version} ]
128 then
129 site=${link#/omd/sites/}
130 site=${site%/version}
131 echo "Site $site is still using this version!" >&2
132 exit 1
134 done
138 %postun
139 rm -f /omd/versions/default
140 v=$(ls -A /omd/versions 2>/dev/null| sort -n | tail -n 1)
141 if [ -n "$v" ]
142 then
143 echo "New default version is $v"
144 ln -sfn "$v" /omd/versions/default
145 else
146 echo "Removing system group 'omd'"
147 groupdel omd
148 echo "Removing global symbolic links"
149 rm -f /usr/bin/omd
150 rm -f /usr/share/man/man8/omd.8.gz
151 rm -f /etc/init.d/omd
152 rmdir /opt/omd/versions
153 rm -f @APACHE_CONFDIR@/zzz_omd.conf
154 rm -f /omd
155 # Try to remove empty directories
156 rmdir /opt/omd/sites 2>/dev/null || true
157 rmdir /opt/omd 2>/dev/null || true