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}
21 Open
Source Monitoring
Distribution, containing Nagios
,
22 the Nagios plugins
, Check_MK
, Livestatus
, Multisite
,
23 PNP4Nagios
, NagVis
, and other addons. Please visit
27 %setup -q
-n omd
-%{version}
34 mkdir -p $RPM_BUILD_ROOT
35 tar xzf omd
-bin
-%{version}.tar.gz
-C $RPM_BUILD_ROOT
36 # Remove all global symbolic links from package. They are shared
37 # among all versions and must be handled in %post und %postun
38 # in order to avoid RPM conflicts
39 rm -f $RPM_BUILD_ROOT
/opt
/omd
/versions
/default
40 rm -f $RPM_BUILD_ROOT
/omd
41 rm -f $RPM_BUILD_ROOT
/usr
/bin
/omd
42 rm -f $RPM_BUILD_ROOT
/usr
/share
/man
/man8
/omd
.8.gz
43 rm -f $RPM_BUILD_ROOT
/@APACHE_CONFDIR@
/*
44 rm -f $RPM_BUILD_ROOT
/etc
/init.d
/omd
49 %attr(4750,root
,omd
) /opt
/omd
/versions
/%{version}/lib
/nagios
/plugins
/check_icmp
50 %attr(4750,root
,omd
) /opt
/omd
/versions
/%{version}/lib
/nagios
/plugins
/check_dhcp
51 %attr(4750,root
,omd
) /opt
/omd
/versions
/%{version}/bin
/mkeventd_open514
54 groupadd
-r omd
2>/dev
/null || true
55 # create symlink if not exists
62 # Activate init script for OMD, but only the first
63 # time an OMD package is being installed. The admin
64 # might have deactivated the script himself and does
65 # not want to make it implicitely active again.
67 if [ ! -e
/omd
/versions
/default
] ; then
68 echo "Activating init script
/etc
/init.d
/omd"
72 echo "New default version is
%{version}."
73 ln
-sfn "
%{version}"
/omd
/versions
/default
74 ln
-sfn
/omd
/versions
/default
/bin
/omd
/usr
/bin
/omd
75 ln
-sfn
/omd
/versions
/default
/share
/man
/man8
/omd
.8.gz
/usr
/share
/man
/man8
/omd
.8.gz
76 ln
-sfn
/omd
/versions
/default
/share
/omd
/omd.init
/etc
/init.d
/omd
77 ln
-sfn
/omd
/versions
/default
/share
/omd
/apache.conf @APACHE_CONFDIR@
/zzz_omd.conf
79 # If the init script has been marked as to be activated
80 # really activate the init script now
81 if [ $ACTIVATE_INIT
-eq
1 ]; then
86 # SLES: make sure apache modules are activated
87 if which a2enmod
>/dev
/null
2>&1
89 echo "Makeing sure that Apache modules proxy
, http_proxy and rewrite are activated."
90 a2enmod proxy
2>/dev
/null || true
91 a2enmod proxy_http
2>/dev
/null || true
92 a2enmod rewrite
2>/dev
/null || true
95 # SLES: make sure that the following file exists:
96 if [ -d
/etc
/apache2
/sysconfig.d
]
98 touch
/etc
/apache2
/sysconfig.d
/include.conf
101 # Make sure, global apache startscript is activated
102 chkconfig
--add @APACHE_NAME@
103 chkconfig @APACHE_NAME@ on
105 # ensure apache is running
106 service @APACHE_NAME@ start
>/dev
/null
2>&1
110 # ON UNINSTALL: Make sure no sites use that version
111 # Do not check this on new release of the same OMD version
112 # (I know this has not happend yet in official releases, but might
113 # happen in future? At least I had such a case with my own builds now.)
115 for link
in /omd
/sites
/*/version
117 target
=$
(readlink $link
2>/dev
/null
) ||
continue
118 version
=$
{target
##*/}
119 if [ "$version"
= %{version} ]
121 site
=$
{link
#/omd/sites/}
122 site
=$
{site%
/version
}
123 echo "Site $site is still using this version
!"
>&2
131 rm -f
/omd
/versions
/default
132 v
=$
(ls
-A
/omd
/versions
2>/dev
/null| sort
-n | tail
-n
1)
135 echo "New default version is $v"
136 ln
-sfn "$v"
/omd
/versions
/default
138 echo "Removing system group 'omd'"
140 echo "Removing global symbolic links"
142 rm -f
/usr
/share
/man
/man8
/omd
.8.gz
143 rm -f
/etc
/init.d
/omd
144 rmdir /opt
/omd
/versions
145 rm -f @APACHE_CONFDIR@
/zzz_omd.conf
147 # Try to remove empty directories
148 rmdir /opt
/omd
/sites
2>/dev
/null || true
149 rmdir /opt
/omd
2>/dev
/null || true