Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37841117
en ru br
ALT Linux repos
5.0: 1.6.2-alt1

Group :: Monitoring
RPM: opennms

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

# The install prefix becomes $OPENMS_HOME in the finished package
%{!?instprefix:%define instprefix /usr/share/opennms}
# This is where the OPENNMS_HOME variable will be set on the remote
# operating system. Not sure this is needed anymore.
%{!?profiledir:%define profiledir /etc/profile.d}
# This is where the "share" directory will link on RPM-based systems
%{!?sharedir:%define sharedir /var/lib/opennms}
# This is where the "logs" directory will link on RPM-based systems
%{!?logdir:%define logdir /var/log/opennms}
# Where the OpenNMS webapp lives
%{!?webappsdir:%define webappsdir %instprefix/webapps}
# Where the OpenNMS Jetty webapp lives
%{!?jettydir:%define jettydir %instprefix/jetty-webapps}
# The directory for the OpenNMS webapp
%{!?servletdir:%define servletdir opennms}
# Where OpenNMS binaries live
%{!?bindir:%define bindir %instprefix/bin}

%define with_tests 0%nil
%define with_docs 1%nil

%define plain_release 1

Name: opennms
Summary: Enterprise-grade Network Management Platform (Easy Install)
Release: alt1
Version: 1.6.2
License: LGPL/GPL
Group: Monitoring

Source: %name-source-%version-%plain_release.tar.gz
#Source1: %name-maven-dependencies-1.5.97-2.tar.bz2
Source2: %name.init
Source3: %name-remote-poller.init
Source4: %name-maven-dependencies-1.6.2.tar.bz2

Url: http://www.opennms.org/
Packager: Slava Dubrovskiy <dubrsl at altlinux.ru>

Requires: opennms-webapp-jetty >= %version-%release
Requires: opennms-core = %version-%release
Requires: libiplike
Requires: postgresql-server >= 7.4

BuildRequires: /proc
BuildRequires: jpackage-1.5-compat
#BuildRequires: jpackage-utils >= 0:1.7.2
#BuildRequires: ant >= 0:1.6
#BuildRequires: maven2-plugins
BuildRequires: junit

BuildRequires: librrd-devel postgresql-devel log4j jicmp
BuildRequires: perl-Net-Nessus perl-Class-DBI perl-Net-SNMP perl-Getopt-Mixed perl-libnet perl-libwww perl-POE perl-Authen-Radius perl-DBD-Pg

%description
OpenNMS is an enterprise-grade network management platform.

This package used to contain what is now in the "opennms-core" package.
It now exists to give a reasonable default installation of OpenNMS.

When you install this package, you will also need to install one of the
opennms-webapp packages.  OpenNMS now provides 2 ways to install the
web UI:

* jetty

 A version of the web UI for OpenNMS which uses a built-in, embedded version
 of Jetty, which runs in the same JVM as OpenNMS.  This is the recommended
 version unless you have specific needs otherwise.

* standalone

 A standalone version of the web UI for OpenNMS, suitable for embedding inside
 tomcat or another servlet container, or on a server separate from the OpenNMS
 core server.

%package common
Summary: Common directories for OpenNMS
Group: Monitoring
BuildArch: noarch

%description common
Common directories for OpenNMS

%package core
Summary: The core OpenNMS backend
Group: Monitoring
BuildArch: noarch
Requires: opennms-common = %version-%release
Requires: java jicmp libjrrd which rrd-utils
Obsoletes: opennms < %version-%release
AutoReq: yes, noosgi
AutoProv: yes, noosgi

%description core
The core OpenNMS backend.  This package contains the main OpenNMS
daemon responsible for discovery, polling, data collection, and
notifications (ie, anything that is not part of the web UI).

If you want to be able to view your data, you will need to install
one of the opennms-webapp packages.

%if %with_docs
%package docs
Summary: Documentation for the OpenNMS network management platform
Group: Documentation
BuildArch: noarch

%description docs
This package contains the API and user documentation
for OpenNMS.
%endif

%package remote-poller
Summary: Remote (Distributed) Poller for OpenNMS
Group: Monitoring
BuildArch: noarch
Requires: opennms-common = %version-%release
AutoReq: yes, noosgi
AutoProv: yes, noosgi

%description remote-poller
The OpenNMS distributed monitor.  For details, see:
 http://www.opennms.org/index.php/Distributed_Monitoring

%package contrib
Summary: Enterprise-grade Open-source Network Management Platform (Contrib)
Group: Monitoring
BuildArch: noarch
Requires: opennms-core = %version-%release
AutoReq: yes, noosgi
AutoProv: yes, noosgi

%description contrib
This package provides additional features and functionality that are not part
of OpenNMS proper.

%package webapp-jetty
Summary: Embedded web interface for OpenNMS
Group: Networking/Other
Requires: opennms-core = %version-%release
Provides: opennms-webui = %version-%release
Obsoletes: opennms-webapp < %version-%release
AutoReq: yes, noosgi
AutoProv: yes, noosgi

%description webapp-jetty
The web UI for OpenNMS.  This is the Jetty version, which runs
embedded in the main OpenNMS core process.

%package webapp-standalone
Summary: Standalone web interface for OpenNMS
Group: Networking/Other
Requires: opennms-core = %version-%release
Requires: tomcat6 java
Provides: opennms-webui = %version-%release
Obsoletes: opennms-webapp < %version-%release
AutoReq: yes, noosgi
AutoProv: yes, noosgi

%description webapp-standalone
The web UI for OpenNMS.  This is the standalone version, suitable for
use with Tomcat or another servlet container.

%prep
%setup -q -n %name-%version-%plain_release/source
rm -fr $HOME/.m2
mkdir $HOME/.m2
##%__tar xjf %SOURCE1 -C $HOME/.m2
%__tar xjf %SOURCE4 -C $HOME/.m2

##############################################################################

# building
##############################################################################

%build
# nothing necessary

##############################################################################

# installation
##############################################################################

%install

%if %with_tests
EXTRA_TARGETS="$EXTRA_TARGETS test"
%endif

%if %with_docs
EXTRA_TARGETS="$EXTRA_TARGETS docs"
%endif

echo "=== RUNNING INSTALL ==="

#sh ./build.sh -o -Dinstall.version="%version-%release" -Ddist.name=$RPM_BUILD_ROOT \

#        -Dinstall.logs.dir=%_logdir/%name \
#        -Dinstall.pid.file=/var/run/%name.pid \
#        -Dproduct.release=%release \
#        -Dbuild.postgresql.include.dir=%_includedir/pgsql \
#        -Dbuild.rrdtool.lib.dir=%_libdir \
#        -Dopennms.home=%instprefix install assembly:directory-inline

sh ./build.sh -o \
       -Ddist.dir=$(pwd)/alt -Ddist.name=temp \
       -Dopennms.home=%_datadir/%name \
       -Dinstall.dir=%_datadir/%name \
       -Dinstall.init.dir=%_sysconfdir/init.d \
       -Dinstall.etc.dir=%_sysconfdir/%name \
       -Dinstall.share.dir=%_libdir/%name \
       -Dinstall.contrib.dir=%_datadir/%name/contrib \
       -Dinstall.servlet.dir=%_datadir/%name/webapps \
       -Dinstall.webapps.dir=%_datadir/%name/webapps \
       -Dinstall.logs.dir=%_logdir/%name \
       -Dinstall.pid.file=/var/run/%name.pid \
       -Dproduct.release=%release \
       -Dinstall.rrdtool.bin=/usr/bin/rrdtool \
       -Dbuild.postgresql.include.dir=%_includedir/pgsql \
       -Dbuild.rrdtool.lib.dir=%_libdir \
       install  assembly:directory-inline

pushd opennms-remote-poller
   sh ../build.sh -o \
       -Dinstall.dir=%_datadir/%name \
       -Ddist.dir=$(pwd)/alt -Ddist.name=temp \
       -Dinstall.logs.dir=%_logdir/%name \
       -Dinstall.pid.file=/var/run/%name.pid \
       -Dproduct.release=%release \
       -Dbuild.postgresql.include.dir=%_includedir/pgsql \
       -Dbuild.rrdtool.lib.dir=%_libdir \
       -Dopennms.home=%instprefix package
popd

echo "=== INSTALL COMPLETED ==="

mkdir -p $RPM_BUILD_ROOT%instprefix
mkdir -p $RPM_BUILD_ROOT%_sysconfdir/%name
mkdir -p $RPM_BUILD_ROOT%_sysconfdir/sysconfig
mkdir -p $RPM_BUILD_ROOT%_sbindir

### XXX is this needed?  (Most of) the current scripts don't use OPENNMS_HOME.

### /etc/profile.d

mkdir -p $RPM_BUILD_ROOT%profiledir
cat > $RPM_BUILD_ROOT%profiledir/%name.sh << __END__
#!/bin/bash

OPENNMS_HOME=%instprefix
if ! echo "\$PATH" | grep "\$OPENNMS_HOME/bin" >/dev/null 2>&1; then
PATH="\$PATH:\$OPENNMS_HOME/bin"
fi

export OPENNMS_HOME PATH

__END__

cat > $RPM_BUILD_ROOT%_sysconfdir/sysconfig/%name << __END__
# Number of times to do "opennms status" after starting OpenNMS to see
# if it comes up completely.  Set to "0" to disable.  Between each
# attempt we sleep for STATUS_WAIT seconds...
#START_TIMEOUT=10

# Number of seconds to wait between each "opennms status" check when

# START_TIMEOUT > 0.
#STATUS_WAIT=5

# Value of the -Xmx<size>m option passed to Java.

#JAVA_HEAP_SIZE=256

# Additional options that should be passed to Java when starting OpenNMS.

#ADDITIONAL_MANAGER_OPTIONS=""

# Classpath additions.  These go on the front of our classpath.

#ADDITIONAL_CLASSPATH=""

# Use incremental garbage collection.

#USE_INCGC=""

# Use the Java Hotspot server VM.

#HOTSPOT=""

# Enable verbose garbage collection debugging.

#VERBOSE_GC=""

# Additional options to pass to runjava.

#RUNJAVA_OPTIONS=""

__END__

cat > $RPM_BUILD_ROOT%_sysconfdir/sysconfig/opennms-remote-poller << __END__
#JAVA_EXE="/usr/bin/java"
#RMI_LOCATION="RDU"
#RMI_HOST="127.0.0.1"
#RMI_PORT=1099

__END__

%if %with_docs

mkdir -p $RPM_BUILD_ROOT%_docdir/%name-%version
cp -fR alt/temp/docs/* $RPM_BUILD_ROOT%_docdir/%name-%version/
install CHANGELOG README.notification $RPM_BUILD_ROOT%_docdir/%name-%version/
#rm -rf $RPM_BUILD_ROOT%instprefix/etc/README
#rm -rf $RPM_BUILD_ROOT%instprefix/etc/README.build
%endif

install -d -m 755 $RPM_BUILD_ROOT%logdir
cp -fR alt/temp/logs/* $RPM_BUILD_ROOT%logdir/

install -d -m 755 $RPM_BUILD_ROOT%sharedir
cp -fR alt/temp/share/* $RPM_BUILD_ROOT%sharedir/

install -d -m 755 $RPM_BUILD_ROOT%_sysconfdir/%name
cp -fR alt/temp/etc/* $RPM_BUILD_ROOT%_sysconfdir/%name/

install -d -m 755 $RPM_BUILD_ROOT%_initdir

install -d -m 755 $RPM_BUILD_ROOT%instprefix/bin
cp -fR alt/temp/bin/* $RPM_BUILD_ROOT%instprefix/bin/
cp -f %SOURCE2 $RPM_BUILD_ROOT%instprefix/bin/%name
chmod o+x $RPM_BUILD_ROOT%instprefix/bin/*

# remove ELF object for "noarch" architecture

rm -rf alt/temp/contrib/qosdaemon
install -d -m 755 $RPM_BUILD_ROOT%instprefix/contrib
cp -fR alt/temp/contrib/* $RPM_BUILD_ROOT%instprefix/contrib/

install -d -m 755 $RPM_BUILD_ROOT%instprefix/lib
cp -fR alt/temp/lib/* $RPM_BUILD_ROOT%instprefix/lib/

install -d -m 755 $RPM_BUILD_ROOT%jettydir
cp -fR alt/temp/jetty-webapps/* $RPM_BUILD_ROOT%jettydir/

install -d -m 755 $RPM_BUILD_ROOT%webappsdir
cp -fR alt/temp/webapps/* $RPM_BUILD_ROOT%webappsdir/

# install the remote poller jar

install -c -m 644 opennms-remote-poller/target/opennms-remote-poller*-jar-with-dependencies.jar $RPM_BUILD_ROOT%instprefix/lib/opennms-remote-poller.jar
mkdir -p  $RPM_BUILD_ROOT%_logdir/opennms-remote-poller
install %SOURCE3 $RPM_BUILD_ROOT%_initdir/opennms-remote-poller

ln -sf ../../..%logdir $RPM_BUILD_ROOT%instprefix/logs
ln -sf ../../..%sharedir $RPM_BUILD_ROOT%instprefix/share
ln -sf ../../..%_sysconfdir/%name $RPM_BUILD_ROOT%instprefix/etc
ln -sf ../../..%instprefix/bin/%name $RPM_BUILD_ROOT%_initdir/%name
ln -sf ../..%instprefix/bin/%name $RPM_BUILD_ROOT%_sbindir/%name

touch $RPM_BUILD_ROOT%_sysconfdir/%name/configured
cat > $RPM_BUILD_ROOT%_sysconfdir/%name/java.conf << END
/usr/bin/java
END
cat > $RPM_BUILD_ROOT%_sysconfdir/%name/libraries.properties << END
opennms.library.jrrd=%_libdir/libjrrd.so
opennms.library.jicmp=%_libdir/libjicmp.so
END

find $RPM_BUILD_ROOT -type f -name .readme -print0 | xargs -r0 rm -f
#Fix unmet
%__subst "s|/opt|%_datadir|g" $RPM_BUILD_ROOT%instprefix/contrib/alvarion/run_link_quality


# core package files

find $RPM_BUILD_ROOT/etc/%name ! -type d | \
   sed -e "s|^$RPM_BUILD_ROOT|%config(noreplace) %attr(664,root,_%name) |" | \
   sort > files.main
find $RPM_BUILD_ROOT/etc/%name -type d | \
   sed -e "s|^$RPM_BUILD_ROOT|%dir %attr(775,root,_%name) |" | \
   sort >> files.main
find $RPM_BUILD_ROOT%instprefix/bin ! -type d | \
   sed -e "s|^$RPM_BUILD_ROOT|%attr(755,root,root) |" | \
   grep -v '/remote-poller.sh' | \
   sort >> files.main
find $RPM_BUILD_ROOT%instprefix/lib ! -type d | \
   sed -e "s|^$RPM_BUILD_ROOT|%attr(644,root,root) |" | \
   grep -v '/opennms-remote-poller.jar' | \
   sort >> files.main

# jetty

find $RPM_BUILD_ROOT%jettydir ! -type d | \
   sed -e "s|^$RPM_BUILD_ROOT||" | \
   grep -v '/WEB-INF/web\.xml$' | \
   grep -v '/WEB-INF/configuration\.properties$' | \
   sort >> files.jetty
find $RPM_BUILD_ROOT%jettydir -type d | \
   sed -e "s|^$RPM_BUILD_ROOT|%dir |" | \
   sort >> files.jetty

# webapps

find $RPM_BUILD_ROOT%webappsdir ! -type d | \
   sed -e "s|^$RPM_BUILD_ROOT||" | \
   grep -v '/WEB-INF/web\.xml$' | \
   grep -v '/WEB-INF/configuration\.properties$' | \
   sort > files.webapp
find $RPM_BUILD_ROOT%webappsdir -type d | \
   sed -e "s|^$RPM_BUILD_ROOT|%dir |" | \
   sort >> files.webapp

%pre core
groupadd -r -f _%name &> /dev/null ||:
##useradd -r -g _%name -d /dev/null -c 'An enterprise-grade network management platform' -s /dev/null -n _%name &> /dev/null ||:

%post core
echo "For setup DB start: /usr/share/opennms/bin/install -ids"

%post webapp-standalone
gpasswd -a tomcat _%name
echo "For install to Tomcat start: /usr/share/opennms/bin/install -y -w /etc/tomcat6/Catalina/localhost"

%files

%files common
%dir %instprefix
%dir %instprefix/lib

%files core -f files.main
%profiledir/%name.sh
%_sbindir/%name
%_initdir/%name
%_sysconfdir/sysconfig/%name
%instprefix/etc
%instprefix/logs
%instprefix/share
%sharedir
%logdir

%exclude %webappsdir
%exclude %jettydir
%exclude %instprefix/contrib
%exclude %instprefix/lib/opennms-remote-poller.jar

%if %with_docs
%files docs
%_docdir/%name-%version
%endif

%files remote-poller
%config %_sysconfdir/sysconfig/opennms-remote-poller
%_initdir/opennms-remote-poller
%instprefix/lib/opennms-remote-poller.jar
%dir %_logdir/opennms-remote-poller

%files contrib
%attr(755,root,root) %instprefix/contrib

%files webapp-jetty -f files.jetty
%config %jettydir/%servletdir/WEB-INF/web.xml
%config %jettydir/%servletdir/WEB-INF/configuration.properties

%files webapp-standalone -f files.webapp
%config %webappsdir/%servletdir/WEB-INF/web.xml
%config %webappsdir/%servletdir/WEB-INF/configuration.properties

%changelog

Full changelog you can see here

 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin