Issue #2105 - common-base can now be used by both EDEX and CAVE when they are installed on the same machine.

Former-commit-id: 24d32835b66a8a84a19c9834fe1475e547dbc8c7
This commit is contained in:
Bryan Kowal 2013-06-14 08:05:03 -05:00
parent e31e16741c
commit 772460c8ae
4 changed files with 127 additions and 73 deletions

View file

@ -238,6 +238,21 @@ if [ "${1}" = "2" ]; then
rm -rf /awips2/cave.bak
fi
# determine if an installation of awips2-common-base is already present
# (edex has been installed before CAVE on an ADAM machine)
if [ -f /awips2/.cave/installCAVECommon.sh ]; then
# copy common-base files to cave
cp -r /awips2/.cave/.repository /awips2/cave/
cp /awips2/.cave/installCAVECommon.sh /awips2/cave
# install the common-base feature
/bin/bash /awips2/cave/installCAVECommon.sh
rm -f /awips2/cave/installCAVECommon.sh
# cleanup
rm -rf /awips2/.cave
fi
%preun
# Backup the core CAVE jar files so that they are
# not removed during the uninstallation of a previous

View file

@ -72,45 +72,28 @@ if [ $? -ne 0 ]; then
exit 1
fi
RPMS_CORE=%{_baseline_workspace}/rpms/awips2.core
RPMS_COMMON_BASE=${RPMS_CORE}/Installer.common-base
SCRIPTS=${RPMS_COMMON_BASE}/scripts
cp -vf ${RPMS_COMMON_BASE}/scripts/* %{_build_root}/awips2/cave
if [ $? -ne 0 ]; then
exit 1
fi
%pre
%post
# Set all paths required by CAVE before installing.
export LD_LIBRARY_PATH=/awips2/java/lib:/awips2/python/lib:$LD_LIBRARY_PATH
export LD_PRELOAD=libpython.so
if [ -d /awips2/cave/lib ]; then
export LD_LIBRARY_PATH=/awips2/cave/lib/lib_illusion:$LD_LIBRARY_PATH
fi
if [ -d /awips2/cave/lib64 ]; then
export LD_LIBRARY_PATH=/awips2/cave/lib64/lib_illusion:$LD_LIBRARY_PATH
fi
# Need to use awips2-java to do this.
export PATH=/awips2/java/bin:/awips2/python/bin:${PATH}
export JAVA_HOME="/awips2/java/jre"
# Set the CAVE logfile location.
export LOGFILE_CAVE=/dev/null
# Use the eclipse p2 manager.
CAVE_EXE="/awips2/cave/cave"
NOSPLASH_ARG="-nosplash"
DIRECTOR_APP="-application org.eclipse.equinox.p2.director"
DESTINATION_ARG="-destination /awips2/cave"
INSTALL_ARG="-i com.raytheon.uf.common.base.feature.feature.group"
UNINSTALL_ARG="-u com.raytheon.uf.common.base.feature.feature.group"
REPO="-repository file:/awips2/cave/.repository/"
COMMON_CMD="${CAVE_EXE} ${NOSPLASH_ARG} ${DIRECTOR_APP} ${DESTINATION_ARG}"
INSTALL_CMD="${COMMON_CMD} ${INSTALL_ARG} ${REPO}"
UNINSTALL_CMD="${COMMON_CMD} ${UNINSTALL_ARG}"
# EDEX installed?
# when the plugins are for EDEX, we just leave
# them on the filesystem; no action required.
rpm -q awips2-edex > /dev/null 2>&1
if [ $? -ne 0 ]; then
# remove the edex plugins
rm -rf /awips2/edex
# hide the edex plugins
pushd . > /dev/null 2>&1
cd /awips2
rm -rf .edex
mv edex .edex
popd > /dev/null 2>&1
fi
# CAVE installed?
@ -119,51 +102,25 @@ fi
# use the p2 director to install from a repository.
rpm -q awips2-cave > /dev/null 2>&1
if [ $? -eq 0 ]; then
# Uninstall any existing components since the p2 director does not
# support updating.
# If the feature is not installed, this does not fail quietly.
# Determine if the feature needs to be uninstalled.
${UNINSTALL_CMD} -verifyOnly > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_TIMESTAMP=`date`
echo "uninstall previous STARTED: ${LOG_TIMESTAMP}"
${UNINSTALL_CMD}
LOG_TIMESTAMP=`date`
echo "uninstall previous COMPLETE: ${LOG_TIMESTAMP}"
fi
# complete the install
LOG_TIMESTAMP=`date`
echo "installation STARTED: ${LOG_TIMESTAMP}"
${INSTALL_CMD}
if [ $? -ne 0 ]; then
exit 1
fi
LOG_TIMESTAMP=`date`
echo "installation COMPLETE: ${LOG_TIMESTAMP}"
# remove the repository
if [ -f /awips2/cave/.repository/artifacts.xml ]; then
rm -f /awips2/cave/.repository/artifacts.xml
fi
if [ -f /awips2/cave/.repository/content.xml ]; then
rm -f /awips2/cave/.repository/content.xml
fi
if [ -d /awips2/cave/.repository/features ]; then
rm -rf /awips2/cave/.repository/features
fi
if [ -d /awips2/cave/.repository/plugins ]; then
rm -rf /awips2/cave/.repository/plugins
fi
/bin/bash /awips2/cave/installCAVECommon.sh
rm -f /awips2/cave/installCAVECommon.sh
else
# remove the cave repository
rm -rf /awips2/cave
# hide the cave repository
pushd . > /dev/null 2>&1
cd /awips2
rm -rf .cave
mv cave .cave
popd > /dev/null 2>&1
fi
%preun
if [ -d /awips2/.cave ]; then
rm -rf /awips2/.cave
fi
if [ -d /awips2/.edex ]; then
rm -rf /awips2/.edex
fi
%postun
%clean
@ -175,5 +132,7 @@ rm -rf ${RPM_BUILD_ROOT}
%dir /awips2/edex
/awips2/edex/*
%dir /awips2/cave
/awips2/cave/*
%dir /awips2/cave/.repository
/awips2/cave/.repository/*
/awips2/cave/.repository/*

View file

@ -0,0 +1,70 @@
#!/bin/bash
# Set all paths required by CAVE before installing.
export LD_LIBRARY_PATH=/awips2/java/lib:/awips2/python/lib:$LD_LIBRARY_PATH
export LD_PRELOAD=libpython.so
if [ -d /awips2/cave/lib ]; then
export LD_LIBRARY_PATH=/awips2/cave/lib/lib_illusion:$LD_LIBRARY_PATH
fi
if [ -d /awips2/cave/lib64 ]; then
export LD_LIBRARY_PATH=/awips2/cave/lib64/lib_illusion:$LD_LIBRARY_PATH
fi
# Need to use awips2-java to do this.
export PATH=/awips2/java/bin:/awips2/python/bin:${PATH}
export JAVA_HOME="/awips2/java/jre"
# Set the CAVE logfile location.
export LOGFILE_CAVE=/dev/null
# Use the eclipse p2 manager.
CAVE_EXE="/awips2/cave/cave"
NOSPLASH_ARG="-nosplash"
DIRECTOR_APP="-application org.eclipse.equinox.p2.director"
DESTINATION_ARG="-destination /awips2/cave"
INSTALL_ARG="-i com.raytheon.uf.common.base.feature.feature.group"
UNINSTALL_ARG="-u com.raytheon.uf.common.base.feature.feature.group"
REPO="-repository file:/awips2/cave/.repository/"
COMMON_CMD="${CAVE_EXE} ${NOSPLASH_ARG} ${DIRECTOR_APP} ${DESTINATION_ARG}"
INSTALL_CMD="${COMMON_CMD} ${INSTALL_ARG} ${REPO}"
UNINSTALL_CMD="${COMMON_CMD} ${UNINSTALL_ARG}"
# Uninstall any existing components since the p2 director does not
# support updating.
# If the feature is not installed, this does not fail quietly.
# Determine if the feature needs to be uninstalled.
${UNINSTALL_CMD} -verifyOnly > /dev/null 2>&1
if [ $? -eq 0 ]; then
LOG_TIMESTAMP=`date`
echo "uninstall previous STARTED: ${LOG_TIMESTAMP}"
${UNINSTALL_CMD}
LOG_TIMESTAMP=`date`
echo "uninstall previous COMPLETE: ${LOG_TIMESTAMP}"
fi
# complete the install
LOG_TIMESTAMP=`date`
echo "installation STARTED: ${LOG_TIMESTAMP}"
${INSTALL_CMD}
if [ $? -ne 0 ]; then
exit 1
fi
LOG_TIMESTAMP=`date`
echo "installation COMPLETE: ${LOG_TIMESTAMP}"
# remove the repository
if [ -f /awips2/cave/.repository/artifacts.xml ]; then
rm -f /awips2/cave/.repository/artifacts.xml
fi
if [ -f /awips2/cave/.repository/content.xml ]; then
rm -f /awips2/cave/.repository/content.xml
fi
if [ -d /awips2/cave/.repository/features ]; then
rm -rf /awips2/cave/.repository/features
fi
if [ -d /awips2/cave/.repository/plugins ]; then
rm -rf /awips2/cave/.repository/plugins
fi

View file

@ -125,6 +125,16 @@ if [ -f /etc/init.d/edex_camel ]; then
/sbin/chkconfig --add edex_camel
fi
# determine if an installation of awips2-common-base is already present
# (CAVE has been installed before edex on an ADAM machine)
if [ -d /awips2/.edex ]; then
# copy the common-base contributions to the EDEX installation
cp -r /awips2/.edex/* /awips2/edex
# cleanup
rm -rf /awips2/.edex
fi
%preun
if [ "${1}" = "1" ]; then
exit 0