Search
j0ke.net Open Build Service
>
Projects
>
server:monitoring
>
zenoss
> zenoss-3.0.3.spec
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File zenoss-3.0.3.spec of Package zenoss (Revision 9)
Currently displaying revision
9
,
show latest
# # This spec file defines the input constraints and build system for # Zenoss when it is installed onto an RPM based system. # # For information on what arguments are passed to %pre, %post, %preun, # and %postun see the following URL: # http://tinyurl.com/sjyfp # # the location where zenoss is installed %define zenhome /opt/zenoss # the location where zope is installed %define zopehome %{zenhome}/zopehome %define zopesitezcml %{zenhome}/lib/python/Zope2/utilities/skel/etc/site.zcml # mysql is used for the events database %define mysql_username zenoss %define mysql_passwd zenoss %define mysql_database events # zope is used for the web interface %define zope_passwd zenoss # a shell account controls the zenoss processes %define os_username zenoss %define os_uid 1337 %define os_home /home/zenoss %define os_shell /bin/bash # the version of python we require %define python_required_version 2.6 # set to 1 if the version of the software to be built is the trunk # if trunk is set to 0 the version will be extrapolated from the # rpm information contained in the %{version} and %{release} vars %define trunk 0 # the location of the snmp configuration file and mysql configuration %define snmpd_conf /etc/snmp/snmpd.conf %define my_cnf /etc/my.cnf # don't terminate the build when there are unpackaged (but installed) files %define _unpackaged_files_terminate_build 0 # avoid advertising Zenoss as the provider of libs we package for internal consumption only (see #5354) %define __find_provides %{nil} # the RPM meta information Name: zenoss Summary: The Open Source Network Management System URL: http://www.zenoss.com/ Version: 3.0.3 %define pkgrelease 897.el5 Release: %{pkgrelease} License: GPLv2 Vendor: Zenoss, Inc. Packager: Glenn Streiff <glenn@zenoss.com> Group: Applications/System Source0: %{name}-%{version}-%{pkgrelease}.tar.bz2 Requires(pre): shadow-utils BuildRequires: which BuildRequires: gcc-c++ BuildRequires: gcc BuildRequires: subversion BuildRequires: zlib-devel BuildRequires: make BuildRequires: patch BuildRequires: autoconf >= 2.53 BuildRequires: swig >= 1.3 BuildRequires: readline-devel BuildRequires: openssl-devel BuildRequires: python >= 2.3.4 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root Requires: net-snmp Requires: binutils Requires: libgcj Requires: libgomp Requires: liberation-fonts Requires: libaio Requires: readline Requires: openssl # additional provides BuildRequires: mysql-devel >= 5.0.22 BuildRequires: mysql >= 5.0.22 Requires: mysql-server >= 5.0.22 Requires: mysql >= 5.0.22 Requires: python >= 2.3.4 Requires: net-snmp-utils # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= %description Zenoss is an IT infrastructure monitoring product that allows you to monitor your entire infrastructure within a single, integrated software application. Key features include: * Monitors the entire stack o networks, servers, applications, services, power, environment, etc... * Monitors across all perspectives o discovery, configuration, availability, performance, events, alerts, etc. * Affordable and easy to use o unlike the big suites offered by IBM, HP, BMC, CA, etc... o unlike first generation open source tools... * Complete open source package o complete solution available as free, open source software # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= %prep # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= %setup # changelog-section # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= %build replace() { SEARCH=$1 REPLACE=$2 FILE=$3 TEMP=/tmp/`basename $FILE` sed -e "s%${SEARCH}%${REPLACE}%g" < ${FILE} > ${TEMP} mv ${TEMP} ${FILE} } # clean up the old build if it is still laying around rm -rf ${RPM_BUILD_ROOT} # map environment variables to .spec variables export ZENHOME=%{zenhome} export ZOPEPASSWORD=%{zope_passwd} export DESTDIR=${RPM_BUILD_ROOT} # load up the build functions ZEN_BUILD_DIR=${RPM_BUILD_DIR}/%{name}-%{version} . ${ZEN_BUILD_DIR}/build-functions.sh # set up make and the python path set_make # set the SVNTAG variable and honor the trunk flag if [ "%{trunk}" = "1" ]; then SVNTAG="trunk" else SVNTAG="tags/%{name}-%{version}" fi # do NOT setuid zensocket export SETUID="" # set the BUILD_DIR variable in order to optimize the RPM assembly process export OPTIMIZED_BUILD_DIR=/tmp/zenoss-externallibs # optionally set the PLATFORM_PYTHON if this platform runs python 2.6 PLATFORM_PYTHON="" for TEST_PYTHON in \ `which python%{python_required_version}` \ `which python` do PLATFORM_PYTHON_VERSION=`${TEST_PYTHON} -c "import sys; print '.'.join(map(str, sys.version_info[:2]))"` echo "${TEST_PYTHON} - ${PLATFORM_PYTHON_VERSION}" if [ "${PLATFORM_PYTHON_VERSION}" = "%{python_required_version}" ]; then PLATFORM_PYTHON=${TEST_PYTHON} break fi done # But if /usr/bin/python is python2.3, we're probably on a box that ships with # python2.3, so we should build our own SYSPYTHON=`/usr/bin/python -c "import sys; print '.'.join(map(str, sys.version_info[:2]))"` if [ "$SYSPYTHON" != "%{python_required_version}" ]; then PLATFORM_PYTHON="" fi find_python # compile external libs and pull down zenoss compile # remove the nagios-plugins perl scripts that force ugly deps DIR=${RPM_BUILD_ROOT}/${ZENHOME}/libexec DIRNAME=${RPM_BUILD_ROOT}/${ZENHOME}/libexec for file in \ `grep perl $DIRNAME/* | awk '{print $1}' | cut -d: -f1 | sort -u` do rm -f $file done # remove the CM artifacts ZEN_INST_DIR=${RPM_BUILD_ROOT}/${ZENHOME} find ${ZEN_INST_DIR} -name .svn | xargs rm -rf # remove the .conf files but leave the .conf.examples rm ${ZEN_INST_DIR}/etc/*.conf # create the .manifest file echo "%{name} %{version}-%{pkgrelease}" > ${ZEN_INST_DIR}/.manifest # copy some configuration files to the /etc installation directory ZEN_BUILD_DIR=${RPM_BUILD_DIR}/%{name}-%{version} CONF_DIR=${ZEN_BUILD_DIR}/conf mkdir -p ${ZEN_INST_DIR}/etc cp ${CONF_DIR}/snmpd.conf ${ZEN_INST_DIR}/etc cp ${CONF_DIR}/my.cnf ${ZEN_INST_DIR}/etc mkdir ${ZEN_INST_DIR}/log # land the zenctl into the init.d directory as "zenoss" INIT_SCRIPT_DIR=${RPM_BUILD_ROOT}%{_initrddir} START_SCRIPT=${INIT_SCRIPT_DIR}/zenoss INIT_PRE_SCRIPT=${ZEN_INST_DIR}/bin/zenoss_init_pre INIT_POST_SCRIPT=${ZEN_INST_DIR}/bin/zenoss_init_post UPGRADE_PRE_SCRIPT=${ZEN_INST_DIR}/bin/zenoss_upgrade_pre UPGRADE_POST_SCRIPT=${ZEN_INST_DIR}/bin/zenoss_upgrade_post mkdir -p ${INIT_SCRIPT_DIR} cp ${RPM_BUILD_ROOT}/%{zenhome}/bin/zenctl ${START_SCRIPT} for file in \ ${START_SCRIPT} \ ${INIT_PRE_SCRIPT} \ ${INIT_POST_SCRIPT} \ ${UPGRADE_PRE_SCRIPT} \ ${UPGRADE_POST_SCRIPT} do replace "\*\*OS_USERNAME\*\*" "%{os_username}" ${file} replace "\*\*OS_UID\*\*" "%{os_uid}" ${file} replace "\*\*ZENHOME\*\*" "%{zenhome}" ${file} replace "\*\*MYSQL_HOST\*\*" "localhost" ${file} replace "\*\*MYSQL_PORT\*\*" "3306" ${file} replace "\*\*MYSQL_ROOT_USERNAME\*\*" "root" ${file} replace "\*\*MYSQL_ROOT_PASSWD\*\*" "" ${file} replace "\*\*MYSQL_HOST\*\*" "localhost" ${file} replace "\*\*MYSQL_USERNAME\*\*" "%{mysql_username}" ${file} replace "\*\*MYSQL_PASSWD\*\*" "%{mysql_passwd}" ${file} replace "\*\*MYSQL_DATABASE\*\*" "%{mysql_database}" ${file} replace "\*\*ZOPE_PASSWD\*\*" "%{zope_passwd}" ${file} replace "\*\*SNMPD_CONF\*\*" "%{snmpd_conf}" ${file} replace "\*\*MY_CNF\*\*" "%{my_cnf}" ${file} replace "\*\*ZOPEHOME\*\*" "%{zopehome}" ${file} replace "\*\*PYTHON\*\*" "%{zenhome}/bin/python" ${file} chmod +x ${file} done # copy the [install,shared]-functions because they are used by zenoss_init cp ${ZEN_BUILD_DIR}/shared-functions.sh ${ZEN_INST_DIR}/bin cp ${ZEN_BUILD_DIR}/install-functions.sh ${ZEN_INST_DIR}/bin # copy filesystem scripts to the real filesystem cd ${ZEN_BUILD_DIR}/extras/etc for file in \ `find . -type f | grep -v .svn` do DEST=${RPM_BUILD_ROOT}/etc/${file} DIR=`dirname $DEST` if [ ! -d ${DIR} ]; then mkdir -p ${DIR} fi cp ${file} ${DEST} replace "\*\*ZENHOME\*\*" "%{zenhome}" ${DEST} done # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= %install # several libraries contain an include path that includes # RPM_BUILD_ROOT. setting this flag subverts the checking for # RPM_BUILD_ROOT in the files QA_SKIP_BUILD_ROOT="DO_NOT_WANT"; export QA_SKIP_BUILD_ROOT # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= %files # make the following files owned by zenoss:wheel with the default perms %defattr(-,zenoss,zenoss) %doc %{zenhome}/Products/LICENSE.txt %doc %{zenhome}/Products/COPYRIGHT.txt %{zenhome} %defattr(4755,root,zenoss) %{zenhome}/bin/zensocket # make the following files owned by root:root with 755 perms %defattr(755,root,root) /etc # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= %pre export ZENHOME=%{zenhome} # create the zenoss group add_group() { # create the zenoss group and move the zenoss user into the group GROUP=`cat /etc/group | cut -d: -f1 | grep %{os_username}` EXISTS=$? if [ $EXISTS -eq 1 ]; then /usr/sbin/groupadd %{os_username} fi } # add the zenoss user add_user() { getent passwd %{os_username} > /dev/null 2>&1 || \ /usr/sbin/useradd -r -m -c "Zenoss Account" \ -u %{os_uid} \ -g %{os_username} \ -d %{os_home} \ -s %{os_shell} \ -p \$1\$5afX49ZL\$sx0UlhhU9QZwbE/howDLk. \ %{os_username} } # move the zenoss user into the zenoss group set_group() { getent group ${os_username} > /dev/null || groupadd -r ${os_username} } # called when we are upgrading or reinstalling (but not erasing, or installing) if [ $1 -eq 2 ]; then OLDMAJOR=`cat $ZENHOME/Products/ZenModel/ZVersion.py | tail -n1 | cut -d\" -f2 | cut -d. -f1` if [ $OLDMAJOR = "2" ]; then # Check to see if pre-upgrade has finished if [ ! -f ${ZENHOME}/.zen3-preupgrade-finished ]; then echo ======================================================== echo Your system is not yet ready for upgrade. Please install echo ZenPacks.zenoss.PreUpgrade30 and let it run to completion before echo continuing the upgrade. echo echo If you have installed the ZenPack already, the preparation is not echo yet complete. Check the event console or $ZENHOME/log/zencatalog.log echo for progress. You can also ensure the upgrade script is still echo running with: echo echo zencatalog restart echo ======================================================== exit 1 fi fi # back up the conf files TEMP_DIR=/tmp/zenossrpmupgrade/$$ mkdir -p $TEMP_DIR cp ${ZENHOME}/etc/*.conf $TEMP_DIR echo $TEMP_DIR > /tmp/zenossrpmupgrade/dirname.txt # add the zenoss group and move the zenoss user into the group add_group set_group fi # called when we are installing (but not erasing, upgrading, or reinstalling) if [ $1 -eq 1 ]; then # add the zenoss group and the zenoss user add_group add_user fi # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= %post # some files have to be setuid 0. they are set here setuid() { for file in \ %{zenhome}/bin/zensocket do chown root:root ${file} chmod 4755 ${file} done } # load up the install functions export ZENHOME=%{zenhome} . ${ZENHOME}/bin/shared-functions.sh . ${ZENHOME}/bin/install-functions.sh # set environment variables export OS_USERNAME=%{os_username} export OS_UID=%{os_uid} export OS_HOME=%{os_home} export OS_SHELL=%{os_shell} # kill off any zeo/zope/zen processes that are running kill_running # optionally update the bashrc for the user (using the append function) bashrc=%{os_home}/.bashrc append ZENHOME %{zenhome} ${bashrc} append INSTANCE_HOME %{zenhome} ${bashrc} append PATH '${ZENHOME}/bin:${PATH}' ${bashrc} append PYTHONPATH %{zenhome}/lib/python ${bashrc} append LD_LIBRARY_PATH %{zenhome}/lib ${bashrc} chown %{os_username} ${bashrc} # set up symlinks for all the runlevels chkconfig --add zenoss # run these commands when installing, but not upgrading or reinstalling if [ $1 -eq 1 ]; then # update the files to be setuid setuid # set the flag to identify this as a fresh install (rather than an # upgrade) touch ${ZENHOME}/.fresh_install chown %{os_username}:%{os_username} ${ZENHOME}/.fresh_install if [ ! -f ${ZENHOME}/etc/site.zcml ];then cp %{zopesitezcml} ${ZENHOME}/etc/site.zcml fi chmod 775 ${ZENHOME}/etc/site.zcml fi # run these commands when upgrading (but not installing or reinstalling) if [ $1 -eq 2 ]; then # set the flag to identify this as an upgrade (rather than a fresh # install) touch ${ZENHOME}/.upgraded chown %{os_username}:%{os_username} ${ZENHOME}/.upgraded # update the files to be setuid setuid # remove the .pyc files that were written by python while zenoss ran find ${ZENHOME} -name \*.pyc -exec rm -f '{}' \; fi # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= %preun export OS_USERNAME=%{os_username} # load up the install functions . %{zenhome}/bin/shared-functions.sh . %{zenhome}/bin/install-functions.sh # kill off any zeo/zope/zen processes that are running kill_running # called when we are erasing the package (but not upgrading) if [ $1 -eq 0 ]; then # remove symlinks for all the runlevels chkconfig --del zenoss fi # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= %postun # called when we are erasing the package (but not upgrading) if [ $1 -eq 0 ]; then # restore snmpd.conf and my.cnf if [ -f %{snmpd_conf}.orig ]; then cp %{snmpd_conf}.orig %{snmpd_conf} fi # remove shell account /usr/sbin/userdel %{os_username} # clean up the various files written by the application for target in \ %{zenhome}/Products \ %{zenhome}/log \ %{zenhome}/.fresh_install \ %{zenhome}/.upgraded \ /tmp/renderserver do rm -rf ${target} done fi # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= %clean #rm -rf ${RPM_BUILD_ROOT}