1 Summary: OMD
- OpenSource Monitoring
Distribution
3 Version: SET BY MAKEFILE
4 Release: SET BY MAKEFILE
6 URL: http
://omdistro.org
/
7 Group: Application
/System
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 Open
Source Monitoring
Distribution, containing Nagios
,
25 the Nagios plugins
, Check_MK
, Livestatus
, Multisite
,
26 PNP4Nagios
, NagVis
, and other addons. Please visit
30 %setup -q
-n omd
-%{version}
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
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
57 groupadd
-r omd
2>/dev
/null || true
58 # create symlink if not exists
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.
70 if [ ! -e
/omd
/versions
/default
] ; then
71 echo "Activating init script
/etc
/init.d
/omd"
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
89 # SLES: make sure apache modules are activated
90 if which a2enmod
>/dev
/null
2>&1
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
103 # SLES: make sure that the following file exists:
104 if [ -d
/etc
/apache2
/sysconfig.d
]
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
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.)
123 for link
in /omd
/sites
/*/version
125 target
=$
(readlink $link
2>/dev
/null
) ||
continue
126 version
=$
{target
##*/}
127 if [ "$version"
= %{version} ]
129 site
=$
{link
#/omd/sites/}
130 site
=$
{site%
/version
}
131 echo "Site $site is still using this version
!"
>&2
139 rm -f
/omd
/versions
/default
140 v
=$
(ls
-A
/omd
/versions
2>/dev
/null| sort
-n | tail
-n
1)
143 echo "New default version is $v"
144 ln
-sfn "$v"
/omd
/versions
/default
146 echo "Removing system group 'omd'"
148 echo "Removing global symbolic links"
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
155 # Try to remove empty directories
156 rmdir /opt
/omd
/sites
2>/dev
/null || true
157 rmdir /opt
/omd
2>/dev
/null || true