From 5df88f55a65a8adddd3611f6fa6d407b2c76159d Mon Sep 17 00:00:00 2001 From: mjames-upc Date: Thu, 29 May 2014 16:50:05 -0600 Subject: [PATCH] Installer.rcm putback Former-commit-id: 3acfaffdcd4c273fb3453cf3ed665f148c70b2d6 --- rpms/awips2.core/Installer.rcm/component.spec | 145 ++++++++++++++++++ .../Installer.rcm/scripts/conf/start-config | 36 +++++ .../Installer.rcm/scripts/init.d/edex_rcm | 96 ++++++++++++ 3 files changed, 277 insertions(+) create mode 100644 rpms/awips2.core/Installer.rcm/component.spec create mode 100644 rpms/awips2.core/Installer.rcm/scripts/conf/start-config create mode 100644 rpms/awips2.core/Installer.rcm/scripts/init.d/edex_rcm diff --git a/rpms/awips2.core/Installer.rcm/component.spec b/rpms/awips2.core/Installer.rcm/component.spec new file mode 100644 index 0000000000..4a68225fc3 --- /dev/null +++ b/rpms/awips2.core/Installer.rcm/component.spec @@ -0,0 +1,145 @@ +%define _component_name awips2-rcm +%define _component_project_dir awips2.core/Installer.rcm +%define _component_default_prefix /awips2/rcm +# +# AWIPS II Edex Radar Server File +# +Name: %{_component_name} +Summary: AWIPS II Radar Server +Version: %{_component_version} +Release: %{_component_release} +Group: AWIPSII +BuildRoot: /tmp +Prefix: %{_component_default_prefix} +URL: N/A +License: N/A +Distribution: N/A +Vendor: Raytheon +Packager: Bryan Kowal + +AutoReq: no +provides: awips2-rcm +requires: awips2-java + +%description +AWIPS II Radar Server Installation - Sets Up AWIPS II Radar Server. + +# Turn off the brp-python-bytecompile script +%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') + +%prep +# Verify That The User Has Specified A BuildRoot. +if [ "${RPM_BUILD_ROOT}" = "/tmp" ] +then + echo "An Actual BuildRoot Must Be Specified. Use The --buildroot Parameter." + echo "Unable To Continue ... Terminating" + exit 1 +fi + +mkdir -p ${RPM_BUILD_ROOT}/awips2/rcm + +%build +# Run pde build of RadarServer. +cd %{_baseline_workspace}/build.rcm +if [ $? -ne 0 ]; then + exit 1 +fi +/bin/bash build.sh -eclipse=%{_uframe_eclipse} +if [ $? -ne 0 ]; then + exit 1 +fi + +%install +# Copies the standard Raytheon licenses into a license directory for the +# current component. +function copyLegal() +{ + # $1 == Component Build Root + + COMPONENT_BUILD_DIR=${1} + + mkdir -p ${RPM_BUILD_ROOT}/${COMPONENT_BUILD_DIR}/licenses + + # Create a Tar file with our FOSS licenses. + tar -cjf %{_baseline_workspace}/rpms/legal/FOSS_licenses.tar \ + %{_baseline_workspace}/rpms/legal/FOSS_licenses/ + + cp %{_baseline_workspace}/rpms/legal/license.txt \ + ${RPM_BUILD_ROOT}/${COMPONENT_BUILD_DIR}/licenses + cp "%{_baseline_workspace}/rpms/legal/Master Rights File.pdf" \ + ${RPM_BUILD_ROOT}/${COMPONENT_BUILD_DIR}/licenses + cp %{_baseline_workspace}/rpms/legal/FOSS_licenses.tar \ + ${RPM_BUILD_ROOT}/${COMPONENT_BUILD_DIR}/licenses + + rm -f %{_baseline_workspace}/rpms/legal/FOSS_licenses.tar +} +RCM_PROPS_DIR="build.rcm/pdeprops" +DEPLOY_SCRIPT="build.rcm/build.xml" + +# Deploy Radar Server To Our Temporary Build Directory. +/awips2/ant/bin/ant -file %{_baseline_workspace}/${DEPLOY_SCRIPT} \ + -Ddeploy.dir=${RPM_BUILD_ROOT}/awips2/rcm \ + -Dinstaller=true -Dprops.dir=%{_baseline_workspace}/${RCM_PROPS_DIR} + +# Overwrite the Existing start-config File With The Our start-config File. +rm -f ${RPM_BUILD_ROOT}/awips2/rcm/data/config/start-config +cp %{_baseline_workspace}/rpms/awips2.core/Installer.rcm/scripts/conf/start-config \ + ${RPM_BUILD_ROOT}/awips2/rcm/data/config/ + +# Create the radar server logs directory +mkdir -p ${RPM_BUILD_ROOT}/awips2/rcm/data/logs + +# Include the rcm service script +mkdir -p ${RPM_BUILD_ROOT}/etc/init.d +cp %{_baseline_workspace}/rpms/awips2.core/Installer.rcm/scripts/init.d/edex_rcm \ + ${RPM_BUILD_ROOT}/etc/init.d + +copyLegal "awips2/rcm" + +%pre +if [ "${1}" = "2" ]; then + exit 0 +fi + +%post +if [ "${1}" = "2" ]; then + exit 0 +fi + +if [ -f /etc/init.d/edex_rcm ]; then + /sbin/chkconfig --add edex_rcm +fi + +%preun +if [ "${1}" = "1" ]; then + exit 0 +fi +if [ -f /etc/init.d/edex_rcm ]; then + /sbin/chkconfig --del edex_rcm +fi + +%postun +if [ "${1}" = "1" ]; then + exit 0 +fi + +%clean +rm -rf ${RPM_BUILD_ROOT} + +%files +%defattr(644,awips,fxalpha,755) +%dir /awips2/rcm +%dir /awips2/rcm/data +/awips2/rcm/data/* + +%docdir /awips2/rcm/licenses +%dir /awips2/rcm/licenses +/awips2/rcm/licenses/* + +%defattr(755,awips,fxalpha,755) +%dir /awips2/rcm/bin +/awips2/rcm/bin/* +%dir /awips2/rcm/lib +/awips2/rcm/lib/* + +%attr(744,root,root) /etc/init.d/edex_rcm diff --git a/rpms/awips2.core/Installer.rcm/scripts/conf/start-config b/rpms/awips2.core/Installer.rcm/scripts/conf/start-config new file mode 100644 index 0000000000..dfb0b66ee9 --- /dev/null +++ b/rpms/awips2.core/Installer.rcm/scripts/conf/start-config @@ -0,0 +1,36 @@ +# Set the following line to the radar ingest endpoint directory for EDEX. +edex_endpoint_arg=@EDEX_HOME@/edex/data/sbn/radar + +# The following line controls the location of log files. See +# data/config/res/log4j.properties for more logging options. +log_dir=$rs_home_dir/data/logs + +# Uncomment and change the following line to choose a Java VM. The +# default is the "java" program that is in the PATH. +#java=/path/to/jre/bin/java +java=/awips2/java/bin/java + +# necessary for fxaAnnounce to be called if rpg goes down +awips2_fxa=/awips2/fxa + +#======= AWIPS 1 Compatibility Configuration ======= +# Only uncomment the following items if you want to use configuration files +# from an existing AWIPS 1 install. + +# Selects the AWIPS 1 configuration system +#configuration_provider=com.raytheon.rcm.config.awips1.Awips1ConfigProvider + +# Root directory containing AWIPS 1 configuration files. It should contain +# "awips/fxa/data/", "data/fxa/", etc. This can be "/" for the actual root +# directory. +#awips1_root=/ + +# Set this to the three-character localization identifier. If unset, the +# FXA_LOCAL_SITE environment variable will be used. +#awips1_site=CCC + +# By default, radar products will be decompressed before they are sent +# to EDEX. Uncomment the following line to turn off decompression. Note +# that when using the standard configuration system, this setting is in +# config.xml. +#decompress_products=no diff --git a/rpms/awips2.core/Installer.rcm/scripts/init.d/edex_rcm b/rpms/awips2.core/Installer.rcm/scripts/init.d/edex_rcm new file mode 100644 index 0000000000..abdee180d7 --- /dev/null +++ b/rpms/awips2.core/Installer.rcm/scripts/init.d/edex_rcm @@ -0,0 +1,96 @@ +#!/bin/bash +# +# edex_rcm This scripts takes care of starting and stopping the +# radar comms manager. +# chkconfig: - 99 10 +# +# description: Radar comms manager control scripts + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +# Check that networking is up. +[ ${NETWORKING} = "no" ] && exit 0 + +RETVAL=0 + +# user to run the Radar Server +EDEXUSER=awips + +# the java installation. +JAVA_INSTALL="/awips2/java" +# the Radar Server installation. +RCM_INSTALL="/awips2/rcm" + +# set java location +JAVA_HOME_DIR=${JAVA_INSTALL} +export PATH=${JAVA_HOME_DIR}/bin:$PATH + +# set Radar Server install directory +RCM_HOME=${RCM_INSTALL} +RCM_DATA=$RCM_HOME/data + +start() { + su ${EDEXUSER} -l -c "sh ${RCM_HOME}/bin/start" > /dev/null 2>&1 +} + +stop() { + su ${EDEXUSER} -l -c "sh ${RCM_HOME}/bin/stop" > /dev/null 2>&1 +} + +# Verify root user +checkUser() { + REQUIREDUSER="root" + CURUSER=`whoami` + if [ "$CURUSER" != "$REQUIREDUSER" ]; then + echo "Insufficient privileges: must run script as $REQUIREDUSER" + exit 1 + fi +} + +# See how we were called. +case $1 in + start) + checkUser + echo -n "Starting RCM: " + start + RETVAL=$? + if [ -e ${RCM_DATA}/radarserver-pid ]; then + echo "OK" + else + echo "FAILED" + fi + ;; + stop) + checkUser + echo -n "Stopping RCM: " + stop + RETVAL=$? + if [ -e ${RCM_DATA}/radarserver-pid ]; then + echo "FAILED" + else + echo "OK" + fi + ;; + status) + status -p ${RCM_DATA}/radarserver-pid RadarServer + RETVAL=$? + ;; + restart) + checkUser + echo -n "Restarting RCM: " + stop + start + RETVAL=$? + ;; + *) + # Print help + echo "Usage: $0 {start|stop|status|restart}" 1>&2 + exit 1 + ;; +esac + +exit $RETVAL