File sipxconfig.spec of Package sipxconfig
#!BuildIgnore: post-build-checks
Name:    sipxconfig
Version: 4.2.1
Release: %{buildno}
Summary:  Configuration Management for sipXecs IP PBX from SIPfoundry 
License:  LGPL
Group:    Productivity/Telephony/SIP/Servers
Vendor:   SIPfoundry
Packager: SIPfoundry <sipx-dev@list.sipfoundry.org>
Url:      http://www.sipfoundry.org
BuildRequires: ant-commons-logging
BuildRequires: ant-junit
BuildRequires: ant-trax, xalan-j2
BuildRequires: ant-nodeps
BuildRequires: automake
BuildRequires: java-devel >= 1.6
%if %{_vendor} == redhat
BuildRequires: shadow-utils
BuildRequires: vixie-cron
%endif
%if %{_vendor} == suse
BuildRequires: pwdutils
BuildRequires: cron
%endif
BuildRequires: zip
BuildRequires: sudo
BuildRequires: jakarta-commons-beanutils
BuildRequires: jakarta-commons-collections
BuildRequires: ruby-devel
BuildRequires: rubygems
BuildRequires: rubygem-rake
BuildRequires: sipx-jasperreports-deps
BuildRequires: sipxcommons >= %version
BuildRequires: asciidoc
%if %{_vendor} == redhat
BuildRequires: docbook-style-xsl
%endif
%if %{_vendor} == suse
BuildRequires: docbook-xsl-stylesheets
%endif
%define sipxpbxlog %{_localstatedir}/log/sipxpbx
%define sipxpbxrun %{_localstatedir}/run/sipxpbx
%define sipxpbxconf %{_sysconfdir}/sipxpbx
%define sipxpbxvarlib %{_var}/lib/sipxpbx
%define sipxconfiglib %{_datadir}/sipXecs/sipXconfig
%define tftproot /tftpboot
%define devicefilesdir %{_datadir}/sipxecs/devicefiles
# Should match sipXlib.m4:SIPX_CONFIGPHONEDIR
%define phonedir %{_localstatedir}/sipxdata/configserver/phone
# disable JAR repacking
%define __jar_repack %{nil}
Source: %name-%version.tar.gz
Source1:  %{name}-%{version}-rpmlintrc
Requires: sipxcommons >= %version
Requires: sipxcommserverlib >= %version
Requires: sipxpbx >= %version
Requires: postgresql-server
Requires: ruby
Requires: rubygems
Requires: sipx-jasperreports-deps
%if %{_vendor} == suse
Requires: apache2-prefork
Requires: pwdutils
Requires: cron
%endif
%if %{_vendor} == redhat
Requires: shadow-utils
# only used to serve phone profiles under http devices
Requires: httpd >= 2.0
Requires: vixie-cron
%endif
# %if %{use_ibm_jvm}
# Requires: java-ibm >= 1.6
# %if %{_vendor} == redhat
# Requires: java-fonts >= 1.6
# %endif
# Requires: java-ibm-unrestricted
# %endif
Prefix: %_prefix
BuildRoot: %{_tmppath}/%name-%version-root
# should match sipXlib.m4:SIPX_VARDIR/upgrade
%define upgrade_archive_dir %{_localstatedir}/sipxdata/upgrade
%define this_archive %{name}-%{version}-%{release}.tgz
%description
This package is part of the sipXecs Enterprise Unified Communications Solution (IP PBX) from SIPfoundry
(http://www.sipfoundry.org). Install the toplevel RPM called 'sipxecs' to install the entire system.
After installation run the script 'sipxecs-setup' to initialize.
sipXconfig is the centralized management system for for the sipXecs system. It provides everything from
cluster management to phone and gateway configuration. sipXconfig also includes a user portal for direct
user control.
Configuring one phone can be a daunting task, configuring a hundred
phones can be maddening. sipXconfig leverages Jetty, Axis
SOAP, REST, postgresql and other JEE technologies to get the job done.
# For phones that use TFTP to server profiles
%package tftp
%if %{_vendor} == redhat
Requires: tftp-server
%endif
%if %{_vendor} == suse
Requires: tftp
%endif
Group: Productivity/Telephony/SIP/Servers
Vendor: SIPfoundry
Summary: Configures/enables TFTP for devices controlled by %{name}
%description tftp
This package is part of the sipXecs Enterprise Unified Communications Solution (IP PBX) from SIPfoundry
(http://www.sipfoundry.org). Install the toplevel RPM called 'sipxecs' to install the entire system.
After installation run the script 'sipxecs-setup' to initialize.
This package provides TFTP service for sipXconfig, required to auto-provision phones and gateways.
* requires tftp-server
* turns on xinit.d/tftp service on
* redirects /tftpboot to %{phonedir}/profile/tftproot
%package ftp
Requires: vsftpd
Requires: sudo
Group: Productivity/Telephony/SIP/Servers
Vendor: SIPfoundry
Summary: Configures/enables FTP for devices controlled by %{name} 
%if %{_vendor} == suse
%define vsftpd_conf /etc/vsftpd.conf
%else
%define vsftpd_conf /etc/vsftpd/vsftpd.conf
%endif
%description ftp
This package is part of the sipXecs Enterprise Unified Communications Solution (IP PBX) from SIPfoundry
(http://www.sipfoundry.org). Install the toplevel RPM called 'sipxecs' to install the entire system.
After installation run the script 'sipxecs-setup' to initialize.
This package provides FTP service for sipXconfig, required to auto-provision phones and gateways.
* installs and configures vsftpd server
* turns on xinit.d/vsftpd service on
* add a user account w/default account for polycom phones
%package snmp
Requires: net-snmp
%if %{_vendor} == redhat
Requires: net-snmp-utils
Requires: lm_sensors
%endif
%if %{_vendor} == suse
Requires: sensors
%endif
Group: Productivity/Telephony/SIP/Servers
Vendor: SIPfoundry
Summary: Configures/enables SNMP for %{name}
%description snmp
This package is part of the sipXecs Enterprise Unified Communications Solution (IP PBX) from SIPfoundry
(http://www.sipfoundry.org). Install the toplevel RPM called 'sipxecs' to install the entire system.
After installation run the script 'sipxecs-setup' to initialize.
This package provides SNMP management for sipXconfig managed servers.
* installs and configures SNMP
%package mrtg
Requires: sipxconfig-snmp
Requires: sipxconfig
Requires: mrtg
Requires: rrdtool
Requires: libart_lgpl
%if %{_vendor} == redhat
Requires: rrdtool-perl
%endif
Group: Productivity/Telephony/SIP/Servers
Vendor: SIPfoundry
Summary: Configures/enables MRTG monitoring for %{name} 
%description mrtg
This package is part of the sipXecs Enterprise Unified Communications Solution (IP PBX) from SIPfoundry
(http://www.sipfoundry.org). Install the toplevel RPM called 'sipxecs' to install the entire system.
After installation run the script 'sipxecs-setup' to initialize.
This package provides MRTG graphing of SNMP managed resources for sipXconfig.
* installs and configures sipXconfig integration for MRTG
%package agent
Requires: sipxcommserverlib
Requires: ruby
Requires: rubygems
%if %{_vendor} == redhat
# irb is for file-tail gem
Requires: irb
%endif
Group: Productivity/Telephony/SIP/Servers
Vendor: SIPfoundry
Summary: Analyzes data from sipxpbx and provides SOAP API to information
%description agent
This package is part of the sipXecs Enterprise Unified Communications Solution (IP PBX) from SIPfoundry
(http://www.sipfoundry.org). Install the toplevel RPM called 'sipxecs' to install the entire system.
After installation run the script 'sipxecs-setup' to initialize.
This package is part of the sipXecs Call Center (ACD) solution and provides a SOAP interface to call detail
records relevant for the ACD. 
It is ideal for CTI applications or report aggregating tools like sipxconfig-report
or real-time analysys like sipxconfig's statistics web console.
%package report
Requires: ruby
Requires: sipxcommserverlib
Group: Productivity/Telephony/SIP/Servers
Vendor: SIPfoundry
Summary: Aggregates data from sipxconfig-agent into a database for reporting tools
Requires: rubygems
Requires: ruby-dbi
%if %{_vendor} == redhat
Requires: ruby-postgres
%endif
%if %{_vendor} == suse
Requires: rubygem-postgres
%endif
%description report
This package is part of the sipXecs Enterprise Unified Communications Solution (IP PBX) from SIPfoundry
(http://www.sipfoundry.org). Install the toplevel RPM called 'sipxecs' to install the entire system.
After installation run the script 'sipxecs-setup' to initialize.
The reporting function peridocically queries sipxconfig-agent regarding automatic call distribution (ACD)
call detail records and assembles data into a postgres database SIPXACD_HISTORY for the reporting tools.
Although this package does not have any other sipxecs dependencies because it's not required to
run on the same machine, it's default setup it to point to localhost.
%prep
%setup -q
%build
%configure --enable-rpmbuild --enable-reports --enable-agent --enable-mrtg  --with-distdir=/home/sipxbuild/src/main/RPMBUILD/../dist
cp config.log %name.configlog
make
%install
export NO_BRP_CHECK_BYTECODE_VERSION=true
# makeinstall RPM macro doesn't leverage DESTDIR but instead overrides
# libdir, bindir, etc just for make install. This not copesetic w/how
# our makefiles are built, they'd rather preserve libdir, and use 
# DESTDIR when copying/moving/creating files.  The approach we're taking
# is quite standard, so it's surprising RPM's makeinstall macro is
# the way it is.
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
%define upgrade_archive_root ${RPM_BUILD_ROOT}%{upgrade_archive_dir}
mkdir -p %{upgrade_archive_root}
tar --directory ${RPM_BUILD_ROOT} \
    -czf %{upgrade_archive_root}/%{this_archive} \
    etc \
    var/sipxdata/configserver
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
# WARNING: Do use @ SIPX_CONFDIR @ because prefix used and 'make dist'
# typically does not RPM's prefix
%doc CONTRIBUTORS README NEWS NOTICE TODO ChangeLog %name.configlog
%attr(755,root,root) %{_bindir}/sipxconfig.sh
%dir %{_libexecdir}/sipXecs
%dir %{_libexecdir}/sipXecs/setup.d
%attr(755,root,root) %{_libexecdir}/sipXecs/setup.d/sipxconfig-setup
%attr(755,root,root) %{_bindir}/sipxconfig-config
%attr(755,root,root) %{_bindir}/sipx-upgrade-3.6-mailstore
%attr(755,root,root) %{_bindir}/sipx-upgrade-3.6-mailstore-report
%attr(644,root,root) %{_datadir}/sipxecs/process.d/sipxconfig-process.xml
%attr(755,sipxchange, sipxchange) %{_bindir}/sipx-time-manager
# itspTemplates
%dir %attr(775,sipxchange,sipxchange) %{sipxpbxconf}/itspTemplates
%config(noreplace) %{sipxpbxconf}/itspTemplates/*
# Jar files are in here, but declaring the directory includes them all implicitly
%{_datadir}/java/sipXecs/sipXconfig
# Because of generation of data and profiles
%dir %attr(775,sipxchange,sipxchange) %{phonedir}
%dir %attr(775,sipxchange,sipxchange) %{phonedir}/profile
%dir %attr(775,sipxchange,sipxchange) %{phonedir}/profile/docroot
%dir %attr(775,sipxchange,sipxchange) %{phonedir}/profile/tftproot
%config(noreplace) %{phonedir}/profile/tftproot/*
%config(noreplace) %{phonedir}/profile/docroot/*
%dir %{_localstatedir}
%{upgrade_archive_dir}/%{this_archive}
%{upgrade_archive_dir}/%{name}-previous.tgz
# Install configserver config files, directory only is created by pbx
%defattr(644,sipxchange,sipxchange,755)
%config(noreplace) %{sipxpbxconf}/sipxconfig-jetty.xml
%config(noreplace) %{sipxpbxconf}/log4j.properties
%config(noreplace) %{sipxpbxconf}/sipxconfig.properties
%{sipxpbxconf}/sipxconfig.properties.map
%config(noreplace) %{sipxpbxconf}/VM_global_library.vm
%config(noreplace) %{sipxpbxconf}/setting.dtd
%config(noreplace) %{sipxpbxconf}/setting.xsl
%dir %{sipxpbxconf}/kphone
%config(noreplace) %{sipxpbxconf}/kphone/*
%dir %{sipxpbxconf}/aastra
%config(noreplace) %{sipxpbxconf}/aastra/*
%dir %{sipxpbxconf}/acme
%config(noreplace) %{sipxpbxconf}/acme/*
%dir %{sipxpbxconf}/acmePhone
%config(noreplace) %{sipxpbxconf}/acmePhone/*
%dir %{sipxpbxconf}/acd
%{sipxpbxconf}/acd/*
%dir %{sipxpbxconf}/alarms
%config(noreplace) %{sipxpbxconf}/alarms/*
%dir %{sipxpbxconf}/audiocodes
%config(noreplace) %{sipxpbxconf}/audiocodes/*
%dir %{sipxpbxconf}/ciscoAta
%config(noreplace) %{sipxpbxconf}/ciscoAta/*
%dir %{sipxpbxconf}/ciscoIp
%config(noreplace) %{sipxpbxconf}/ciscoIp/*
%dir %{sipxpbxconf}/ciscoplus
%config(noreplace) %{sipxpbxconf}/ciscoplus/*
%dir %{sipxpbxconf}/clearone
%config(noreplace) %{sipxpbxconf}/clearone/*
%dir %{sipxpbxconf}/commserver
%{sipxpbxconf}/commserver/*
%dir %{sipxpbxconf}/freeswitch
%config(noreplace) %{sipxpbxconf}/freeswitch/*
%dir %{sipxpbxconf}/database
%config(noreplace) %{sipxpbxconf}/database/*
%dir %{sipxpbxconf}/region_*
%config %{sipxpbxconf}/region_*/*
%dir %{sipxpbxconf}/grandstream
%config(noreplace) %{sipxpbxconf}/grandstream/*
%dir %{sipxpbxconf}/gtek
%config(noreplace) %{sipxpbxconf}/gtek/*
%dir %{sipxpbxconf}/gtek-aq
%config(noreplace) %{sipxpbxconf}/gtek-aq/*
%dir %{sipxpbxconf}/hitachi
%config(noreplace) %{sipxpbxconf}/hitachi/*
%dir %{sipxpbxconf}/ipDialog
%config(noreplace) %{sipxpbxconf}/ipDialog/*
%dir %{sipxpbxconf}/lg-nortel
%{sipxpbxconf}/lg-nortel/*
%dir %{sipxpbxconf}/linksys
%{sipxpbxconf}/linksys/*
%dir %{sipxpbxconf}/polycom
%{sipxpbxconf}/polycom/*
%dir %{sipxpbxconf}/snom
%{sipxpbxconf}/snom/*
%dir %{sipxpbxconf}/counterpath
%config(noreplace) %{sipxpbxconf}/counterpath/*
%dir %{sipxpbxconf}/mitel
%config(noreplace) %{sipxpbxconf}/mitel/*
%dir %{sipxpbxconf}/nattraversal
%config(noreplace) %{sipxpbxconf}/nattraversal/*
%dir %{sipxpbxconf}/nortel
%{sipxpbxconf}/nortel/*
%dir %{sipxpbxconf}/nortel12x0
%config(noreplace) %{sipxpbxconf}/nortel12x0/*
%dir %{sipxpbxconf}/nt1535
%{sipxpbxconf}/nt1535/*
%dir %{sipxpbxconf}/sipxbridge
%config(noreplace) %{sipxpbxconf}/sipxbridge/*
%dir %{sipxpbxconf}/sipxconference
%config(noreplace) %{sipxpbxconf}/sipxconference/*
%dir %{sipxpbxconf}/sipxconfig
%config(noreplace) %{sipxpbxconf}/sipxconfig/*
%dir %{sipxpbxconf}/sipximbot
%config(noreplace) %{sipxpbxconf}/sipximbot/*
%dir %{sipxpbxconf}/scsimbot
%config(noreplace) %{sipxpbxconf}/scsimbot/*
%dir %{sipxpbxconf}/sipxivr
%config(noreplace) %{sipxpbxconf}/sipxivr/*
%dir %{sipxpbxconf}/sipxproxy
%config(noreplace) %{sipxpbxconf}/sipxproxy/*
%dir %{sipxpbxconf}/sipxregistrar
%config(noreplace) %{sipxpbxconf}/sipxregistrar/*
%dir %{sipxpbxconf}/sipxcallresolver
%config(noreplace) %{sipxpbxconf}/sipxcallresolver/*
%dir %{sipxpbxconf}/sipxconfigagent
%config(noreplace) %{sipxpbxconf}/sipxconfigagent/*
%dir %{sipxpbxconf}/sipxpresence
%config(noreplace) %{sipxpbxconf}/sipxpresence/*
%dir %{sipxpbxconf}/sipxstatus
%config(noreplace) %{sipxpbxconf}/sipxstatus/*
%dir %{sipxpbxconf}/sipxpark
%{sipxpbxconf}/sipxpark/*
%dir %{sipxpbxconf}/sipxpage
%config(noreplace) %{sipxpbxconf}/sipxpage/*
%dir %{sipxpbxconf}/sipxrecording
%config(noreplace) %{sipxpbxconf}/sipxrecording/*
%dir %{sipxpbxconf}/sipxrls
%config(noreplace) %{sipxpbxconf}/sipxrls/*
%dir %{sipxpbxconf}/sipxvxml
%{sipxpbxconf}/sipxvxml/*
%dir %{sipxpbxconf}/test.d
%config(noreplace) %{sipxpbxconf}/test.d/*
%dir %{sipxpbxconf}/unmanagedPhone
%config(noreplace) %{sipxpbxconf}/unmanagedPhone/*
%dir %{sipxpbxconf}/mailbox
%config(noreplace) %{sipxpbxconf}/mailbox/*
%dir %{sipxpbxconf}/sipxsaa
%config(noreplace) %{sipxpbxconf}/sipxsaa/*
%dir %{sipxpbxconf}/openfire
%config(noreplace) %{sipxpbxconf}/openfire/*
%dir %{sipxpbxconf}/sipxrest
%config(noreplace) %{sipxpbxconf}/sipxrest/*
%dir %{sipxpbxconf}/sipxprovision
%config(noreplace) %{sipxpbxconf}/sipxprovision/*
%define audiocodesdir %{_localstatedir}/sipxdata/audiocodes
%dir %attr(775,sipxchange,sipxchange) %{audiocodesdir}
%config(noreplace) %{audiocodesdir}/*
%define reportsdir %{_localstatedir}/sipxdata/reports
%dir %attr(775,sipxchange,sipxchange) %{reportsdir}
%config(noreplace) %{reportsdir}/*
%dir %attr(775,sipxchange,sipxchange) %{_localstatedir}/sipxdata/configserver/web-cert
%dir %attr(775,sipxchange,sipxchange) %{devicefilesdir}
%pre
%post
sipxconfig.sh --first-run
%define current_archive %{upgrade_archive_dir}/%{name}-current.tgz
%define previous_archive %{upgrade_archive_dir}/%{name}-previous.tgz
if [ -f %{current_archive} ]; then
  mv %{current_archive} %{previous_archive}
fi
mv %{upgrade_archive_dir}/%{this_archive} %{current_archive}
pkg-upgrade --previous %{previous_archive} --current %{current_archive}
%preun
%postun
# uninstall lucene index and Jetty scratch dir on every install
rm -rf /var/sipxdata/tmp/index 2> /dev/null
rm -rf /var/sipxdata/tmp/Jetty__8443__sipxconfig 2> /dev/null
# empty but required to generate RPM
%files tftp
%post tftp
sed /etc/xinetd.d/tftp -i -e 's|^\W*disable\W*=\W*yes\W*$|disable = no|' -e 's|\W*/tftpboot\W*| %{phonedir}/profile/tftproot|'
# turn on the service so its started after all reboots.
/sbin/chkconfig xinetd on >/dev/null
%if %{_vendor} == suse
# turn on the service so its started after all reboots.
/sbin/chkconfig xinetd on >/dev/null
# ensure that INET services are running
/sbin/service xinetd start >/dev/null
%endif
# empty but required to generate RPM
%files ftp
%post ftp
%if %{_vendor} == suse
%define adduser /usr/sbin/useradd
%define nologin /bin/false
%else
%define adduser /usr/sbin/adduser
%define nologin /sbin/nologin
%endif
if ! id -u PlcmSpIp > /dev/null 2>&1
then
  # default user account polycom phones use
  %{adduser} -d %{phonedir}/profile/tftproot -s %{nologin} -M PlcmSpIp >/dev/null
  echo -e "PlcmSpIp" | sudo passwd --stdin PlcmSpIp >/dev/null
fi
if ! id -u lvp2890 > /dev/null 2>&1
then
  # default user account Nortel 1535 phones use
  %{adduser} -d %{phonedir}/profile/tftproot -s %{nologin} -M lvp2890 >/dev/null
  echo -e "28904all" | sudo passwd --stdin lvp2890 >/dev/null
fi
# 'install' ftpd config file
mv %{vsftpd_conf} %{vsftpd_conf}.sipx-orig
cat > %{vsftpd_conf} <<EOF
# vsftpd config for sipxconfig 
local_enable=YES
write_enable=YES
local_umask=022
dirlist_enable=NO
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
pam_service_name=vsftpd
listen=YES
chroot_local_user=YES
EOF
chmod 600 %{vsftpd_conf}
/sbin/chkconfig vsftpd on >/dev/null
# anaconda installs may not have network installed or ready
# however they do restart system post installation
/sbin/service vsftpd start >/dev/null
%preun ftp
if [ "$1" = "0" ] ; then
  /usr/sbin/userdel PlcmSpIp
  /usr/sbin/userdel lvp2890
  if [ -e %{vsftpd_conf}.sipx-orig ]
  then
    mv %{vsftpd_conf}.sipx-orig %{vsftpd_conf}
    service vsftpd restart
  fi
fi
%files snmp
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/sipx-snmp-init
%post snmp
sipx-snmp-init > /dev/null
%files mrtg
%defattr(644,sipxchange,sipxchange,755)
%attr(755,sipxchange,sipxchange) %{_bindir}/sipx-mrtg-init
%attr(755,sipxchange,sipxchange) %{_bindir}/sipXmrtg.sh
%dir %{sipxpbxconf}
%dir %attr(775,sipxchange,sipxchange) %{sipxpbxconf}/mrtg
%config(noreplace) %{sipxpbxconf}/mrtg/*
%dir %{_localstatedir}/sipxdata
%dir %attr(775,sipxchange,sipxchange) %{_localstatedir}/sipxdata/mrtg
%dir %attr(775,sipxchange,sipxchange) %{_localstatedir}/sipxdata/mrtg/thresh
%dir %{_datadir}/sipxecs
%dir %{_datadir}/sipxecs/process.d
%attr(644,root,root) %{_datadir}/sipxecs/process.d/sipXmrtg-process.xml
%preun mrtg
if [ "$1" = "0" ] ; then
  sipx-mrtg-init -d > /dev/null
fi
%files agent
%defattr(644,root,root,755)
%dir %{sipxpbxvarlib}
%{sipxpbxvarlib}/sipXconfig-agent-*.gem
%{sipxpbxvarlib}/file-tail-*.gem
%attr(755,root,root) %{_bindir}/sipxconfig-agent
%defattr(644,sipxchange,sipxchange,755)
%attr(644,root,root) %{_datadir}/sipxecs/process.d/sipxconfig-agent-process.xml
%post agent
gem install --no-rdoc --local %{sipxpbxvarlib}/sipXconfig-agent-*.gem >/dev/null
gem install --no-rdoc --local %{sipxpbxvarlib}/file-tail-*.gem >/dev/null
%preun agent
# prevent uninstalling during an upgrade
#   see http://www-128.ibm.com/developerworks/library/l-rpm3/
if [ "$1" = "0" ] ; then
  gem uninstall sipXconfig-agent >/dev/null 2>&1 || true
fi
# not uninstalling file-tail incase it's used elsewhere
%files report
%defattr(644,root,root,755)
%attr(755,root,root) %{_libexecdir}/sipXecs/setup.d/sipxconfig-report-setup
%dir %{sipxpbxvarlib}
%{sipxpbxvarlib}/sipXconfig-report-*.gem
%config(noreplace) /etc/cron.d/sipxconfig-report-crontab
%attr(755,root,root) %{_bindir}/sipxconfig-report
%defattr(644,sipxchange,sipxchange,755)
%config(noreplace) %{sipxpbxconf}/sipxconfig-report-config
%dir %{sipxpbxconf}
%dir %{sipxpbxconf}/report
%config(noreplace) %{sipxpbxconf}/report/schema.sql
%config(noreplace) %{sipxpbxconf}/report/enable_upgrades.sql
%config(noreplace) %{sipxpbxconf}/report/location_fqdn.sql
%config(noreplace) %{sipxpbxconf}/report/sipxconfig-report-config.vm
%post report
gem install --no-rdoc --local %{sipxpbxvarlib}/sipXconfig-report-*.gem >/dev/null
if ( ! test -f /etc/cron.d/cron.allow ) || ( ! grep '^sipxchange$' /etc/cron.d/cron.allow > /dev/null ); then
  echo sipxchange >> /etc/cron.d/cron.allow
fi
%preun report
# prevent uninstalling during an upgrade
#   see http://www-128.ibm.com/developerworks/library/l-rpm3/
if [ "$1" = "0" ] ; then
  gem uninstall sipXconfig-report >/dev/null 2>&1 || true
fi