PageRenderTime 32ms CodeModel.GetById 16ms app.highlight 14ms RepoModel.GetById 1ms app.codeStats 0ms

/rpm/SPECS/jmxtrans.spec

http://jmxtrans.googlecode.com/
Unknown | 112 lines | 88 code | 24 blank | 0 comment | 0 complexity | 0d8f27336980f9ecf07a126e9b8b9dc7 MD5 | raw file
  1Name: jmxtrans
  2Version: %{VERSION}
  3Release: %{RELEASE}
  4Summary: JMX Transformer - more than meets the eye
  5Group: Applications/Communications
  6URL: http://http://code.google.com/p/jmxtrans//
  7Vendor: Jon Stevens
  8Packager: Henri Gomez <henri.gomez@gmail.com>
  9License: OpenSource Software by Jon Stevens
 10BuildArch:  noarch
 11
 12Source0: %{JMXTRANS_SOURCE}
 13Source1: jmxtrans.init
 14
 15BuildRoot: %{_tmppath}/build-%{name}-%{version}-%{release}
 16
 17Requires(pre):   /usr/sbin/groupadd
 18Requires(pre):   /usr/sbin/useradd
 19
 20%define xuser       jmxtrans
 21%define xapp        jmxtrans
 22
 23%define xappdir         %{_usr}/share/%{xapp}
 24%define xlibdir         %{_var}/lib/%{xapp}
 25%define xlogdir         %{_var}/log/%{xapp}
 26%define xconf           %{_sysconfdir}/sysconfig/%{xapp}
 27
 28%description
 29jmxtrans is very powerful tool which reads json configuration files of servers/ports and jmx domains - attributes - types.
 30Then outputs the data in whatever format you want via special 'Writer' objects which you can code up yourself.
 31It does this with a very efficient engine design that will scale to querying thousands of machines.
 32
 33%prep
 34%setup -q -n %{xapp}-%{version}
 35
 36%build
 37
 38%install
 39# Prep the install location.
 40rm -rf $RPM_BUILD_ROOT
 41mkdir -p $RPM_BUILD_ROOT%{xappdir}
 42mkdir -p $RPM_BUILD_ROOT%{xlibdir}
 43mkdir -p $RPM_BUILD_ROOT%{xlogdir}
 44mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d
 45mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
 46
 47# remove source (unneeded here)
 48rm -rf src/com
 49cp -rf * $RPM_BUILD_ROOT%{xappdir}
 50cp  %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/%{xapp}
 51
 52# ensure shell scripts are executable
 53chmod 755 $RPM_BUILD_ROOT%{xappdir}/*.sh
 54
 55%clean
 56rm -rf $RPM_BUILD_ROOT
 57
 58%pre
 59/usr/sbin/useradd -c "JMXTrans" \
 60        -s /sbin/nologin -r -d %{xappdir} %{xuser} 2> /dev/null || :
 61
 62%post
 63if [ $1 = 1 ]; then
 64  /sbin/chkconfig --add %{xapp}
 65
 66  # get number of cores so we can set number of GC threads
 67  CPU_CORES=$(cat /proc/cpuinfo | grep processor | wc -l)
 68  NEW_RATIO=8
 69
 70  # defaults for JVM
 71  HEAP_SIZE="512"
 72  HEAP_NUMBER=$(echo $HEAP_SIZE|sed 's/[a-zA-Z]//g')
 73  NEW_SIZE=$(expr $HEAP_SIZE / $NEW_RATIO)
 74
 75  # populate sysconf file
 76  echo "# configuration file for package %{xapp}" > %{xconf}
 77  echo "export JAR_FILE=\"/usr/share/jmxtrans/jmxtrans-all.jar\"" >> %{xconf}
 78  echo "export LOG_DIR=\"/var/log/%{xapp}\"" >> %{xconf}
 79  echo "export SECONDS_BETWEEN_RUNS=60" >> %{xconf}
 80  echo "export JSON_DIR=\"%{xlibdir}\"" >> %{xconf}
 81  echo "export HEAP_SIZE=${HEAP_SIZE}" >> %{xconf}
 82  echo "export NEW_SIZE=${NEW_SIZE}" >> %{xconf}
 83  echo "export CPU_CORES=${CPU_CORES}" >> %{xconf}
 84  echo "export NEW_RATIO=${NEW_RATIO}" >> %{xconf}
 85  echo "export LOG_LEVEL=debug" >> %{xconf}
 86
 87fi
 88
 89%preun
 90if [ $1 = 0 ]; then
 91  /sbin/service %{xapp} stop > /dev/null 2>&1
 92  /sbin/chkconfig --del %{xapp}
 93  rm -f  %{xconf}
 94fi
 95
 96%posttrans
 97/sbin/service %{xapp} condrestart >/dev/null 2>&1 || :
 98
 99
100%files
101%defattr(-,root,root)
102%attr(0755, root, root)        %{_sysconfdir}/init.d/%{xapp}
103#%config(noreplace)             %{_sysconfdir}/sysconfig/%{xapp}
104%config(noreplace)             %{xlibdir}
105%attr(0755,%{xuser}, %{xuser}) %{xlogdir}
106%{xappdir}/*
107%doc %{xappdir}/README.html
108
109
110%changelog
111* Wed Jul 19 2011 Henri Gomez <henri.gomez@gmail.com> - 223-1
112- Initial RPM package to be used and build with ci systems.