reports: Fix id of custom date selector
[ninja.git] / op5build / monitor-ninja.spec
blob518f623ec84a8307cb738d020138d427757b1ab4
1 %define daemon_user monitor
2 %if 0%{?suse_version}
3 %define htmlroot /srv/www/htdocs
4 %define httpconfdir apache2/conf.d
5 %define daemon_group www
6 %else
7 %define htmlroot /var/www/html
8 %define httpconfdir httpd/conf.d
9 %define daemon_group apache
10 %endif
12 Name: monitor-ninja
13 Version: %{op5version}
14 Release: %{op5release}%{?dist}
15 License: GPLv2 and LGPLv2 and ASL 2.0 and BSD and MIT and (MIT or GPL+) and (MIT or GPLv2+)
16 Vendor: op5 AB
17 BuildRoot: %{_tmppath}/%{name}-%{version}
18 Summary: op5 monitor ninja
19 Group: op5/monitor
20 Prefix: /opt/monitor/op5/ninja
21 Requires: monitor-gui-core
22 Requires: merlin-apps >= 0.8.0
23 Requires: merlin
24 Requires: monitor-merlin
25 Requires: php-op5lib >= 1.1.0
26 Requires: wkhtmltopdf
27 Requires: op5-monitor-supported-database
28 Requires: op5-monitor-supported-webserver
29 Requires: monitor-livestatus
30 Requires: monitor-nacoma
31 Requires: monitor-backup
32 Requires: op5-bootstrap
33 BuildRequires: php-op5lib >= 1.1.0-beta14
34 BuildRequires: rubygem(compass)
35 BuildRequires: doxygen
36 BuildRequires: graphviz
37 %if 0%{?suse_version}
38 Requires: php53
39 Requires: php53-gettext
40 Requires: php53-json
41 Requires: php53-posix
42 Requires: php53-ctype
43 Requires: php53-iconv
44 Requires: php53-mbstring
45 BuildRequires: php53-json
46 BuildRequires: php53-posix
47 BuildRequires: php53-ctype
48 BuildRequires: util-linux
49 BuildRequires: pwdutils
50 BuildRequires: graphviz-gnome
51 BuildRequires: ghostscript-fonts-std
52 %else
53 Requires: php >= 5.3
54 BuildRequires: php >= 5.3
55 BuildRequires: shadow-utils
56 %if 0%{?rhel} >= 6 || 0%{?rhel_version} >=600 || 0%{?centos_version} >=600
57 Requires: php-process
58 Requires: php-mbstring
59 BuildRequires: php-process
60 %else
61 Requires: php-json
62 %endif
63 %endif
65 Source: %name-%version.tar.gz
66 %description
67 Webgui for Nagios.
69 %package test
70 Summary: Test files for ninja
71 Group: op5/Monitor
72 Requires: monitor-ninja = %version
73 Requires: merlin monitor-merlin op5-nagios
74 Requires: merlin-apps op5-mysql
75 Requires: monitor-livestatus monitor-nagvis
76 Requires: rubygem20-op5cucumber
77 Requires: portal
78 Requires: op5license-generator
79 Requires: op5-phpunit
80 # For performance graph links on extinfo
81 Requires: monitor-pnp
83 %description test
84 Additional test files for ninja
86 %prep
87 %setup -q
88 %if 0%{?suse_version}
89 find -type f -exec %{__sed} '{}' -i -e 's#var/www/html#srv/www/htdocs#g' \;
90 find -type f -exec %{__sed} '{}' -i -e 's#var/www#srv/www#g' \;
91 %endif
93 %build
94 pushd cli-helpers
95 make
96 popd
97 make
98 make docs
101 %install
102 rm -rf %buildroot
103 mkdir -p -m 755 %buildroot%prefix
104 mkdir -p -m 775 %buildroot%prefix/upload
105 mkdir -p -m 775 %buildroot%prefix/application/logs
107 # copy everything and then remove what we don't want to ship
108 cp -r * %buildroot%prefix
109 for d in op5build monitor-ninja.spec ninja.doxy \
110 php2doxy.sh example.htaccess cli-helpers/apr_md5_validate.c \
111 README docs/README xdoc
113 rm -rf %buildroot%prefix/$d
114 done
116 sed -i "s/\(IN_PRODUCTION', \)FALSE/\1TRUE/" \
117 %buildroot%prefix/index.php
118 sed -i \
119 -e 's,^\(.config..site_domain.. = .\)/ninja/,\1/monitor/,' \
120 -e 's/^\(.config..product_name.. = .\)Nagios/\1op5 Monitor/' \
121 -e 's/^\(.config..version_info.. = .\)\/etc\/ninja-release/\1\/etc\/op5-monitor-release/' \
122 %buildroot%prefix/application/config/config.php
124 cp op5build/login.png \
125 %buildroot%prefix/application/views/css/default/images
126 cp op5build/favicon.ico \
127 %buildroot%prefix/application/views/icons/16x16/
128 cp op5build/icon.png \
129 %buildroot%prefix/application/views/icons/
131 find %buildroot -print0 | xargs -0 chmod a+r
132 find %buildroot -type d -print0 | xargs -0 chmod a+x
134 mkdir -p %buildroot/etc/cron.d/
135 install -m 644 install_scripts/scheduled_reports.crontab %buildroot/etc/cron.d/scheduled-reports
136 install -m 644 install_scripts/recurring_downtime.crontab %buildroot/etc/cron.d/recurring-downtime
138 # executables
139 for f in cli-helpers/apr_md5_validate \
140 install_scripts/ninja_db_init.sh; do
141 chmod 755 %buildroot%prefix/$f
142 done
144 # The custom_widgets dir need to be writable by the apache user
145 chmod 775 %buildroot%prefix/application/custom_widgets
147 mkdir -p %buildroot/opt/monitor/op5/nacoma/hooks/save
148 install -m 755 install_scripts/nacoma_hooks.py %buildroot/opt/monitor/op5/nacoma/hooks/save/ninja_hooks.py
149 %if 0%{?sles_version}
150 %{py_compile %buildroot/opt/monitor/op5/nacoma/hooks/save}
151 %{py_compile -O %buildroot/opt/monitor/op5/nacoma/hooks/save}
152 %endif
154 mkdir -p %buildroot%_sysconfdir/%{httpconfdir}
155 install -m 640 op5build/ninja.httpd-conf %buildroot/etc/%{httpconfdir}/monitor-ninja.conf
157 # we don't need the git directories
158 rm -rf %buildroot%prefix/application/vendor/phptap/.git
160 sed -i 's/Ninja/op5 Monitor/' %buildroot%prefix/application/media/report_footer.html
162 mkdir -p %buildroot%prefix/application/config/custom
163 install -m 755 test/configs/kohana-configs/exception.php %buildroot%prefix/application/config/custom/exception.php
164 rm %buildroot%prefix/test/configs/kohana-configs/exception.php
166 %pre
167 # This needs to be removed for us to be able to upgrade ninja 2.0.7
168 # for some reason.
169 if test -d %buildroot%prefix/application/vendor/phptap/.git; then
170 rm -rf %buildroot%prefix/application/vendor/phptap/.git
174 %post
175 # Verify that mysql-server is installed and running before executing sql scripts
176 $(mysql -Be "quit" 2>/dev/null) && MYSQL_AVAILABLE=1
177 if [ -n "$MYSQL_AVAILABLE" ]; then
178 pushd %prefix
179 sh install_scripts/ninja_db_init.sh
180 popd
181 else
182 echo "WARNING: mysql-server is not installed or not running."
183 echo "If Oracle database is to be used this is ok."
184 echo "If MySQL database is to be used you need to maually run:"
185 echo " %prefix/install_scripts/ninja_db_init.sh"
186 echo "to complete the setup of %name"
189 $(php %prefix/index.php cli/save_widget --page 'tac/index' --name nagvis --friendly_name "Nagvis" &> /dev/null)
190 $(php %prefix/index.php cli/save_widget --page 'tac/index' --name listview --friendly_name "List view" &> /dev/null)
191 if [ "$?" -ne 0 ]; then
192 echo "WARNING: mysql-server is not installed or not running."
193 echo "If Oracle database is to be used this is ok."
194 echo "If MySQL database is to be used you need to maually"
195 echo "setup the merlin database to complete the setup of %name"
198 # Cleanup symlinks we don't use anymore
199 for link in %{htmlroot}/monitor %{htmlroot}/ninja /op5/monitor/op5/ninja/op5 /opt/monitor/op5/ninja/css /opt/monitor/op5/ninja/js /opt/monitor/op5/ninja/images /opt/monitor/op5/ninja/stylesheets
201 if [ -f $link ]; then
202 rm -f $link
204 done
206 %files
207 %defattr(-,%daemon_user,%daemon_group)
208 %prefix
209 %attr(644,root,root) /etc/cron.d/*
210 %attr(755,root,root) /opt/monitor/op5/nacoma/hooks/save/ninja_hooks.py
211 %attr(644,root,root) /opt/monitor/op5/nacoma/hooks/save/ninja_hooks.pyc
212 %attr(644,root,root) /opt/monitor/op5/nacoma/hooks/save/ninja_hooks.pyo
213 %attr(-,root,%daemon_group) /etc/%{httpconfdir}/monitor-ninja.conf
214 %exclude %prefix/src
215 %exclude %prefix/test
216 %exclude %prefix/modules/test
217 %exclude %prefix/Makefile
218 %exclude %prefix/features
219 %exclude %prefix/application/config/custom/exception.php
221 %files test
222 %defattr(-,monitor,%daemon_group)
223 %prefix/src
224 %prefix/features
225 %prefix/test
226 %prefix/modules/test
227 %prefix/Makefile
228 %prefix/application/config/custom/exception.php
230 %clean
231 rm -rf %buildroot