Commit 73935057 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

Updated openfire.sh to auto-detect standard Linux java installs.

Updated openfired to reflect openfire name and make use of sysconfig.
Added default sysconfig file to be auto-installed by rpm.
Updated build.xml to ignore sysconfig file for Mac package.
Updated .spec file to make RPM auto-create jive user and properly own openfire install directory, auto-install init file, auto-install default sysconfig file, adjusted license to GPL, and a couple of other minor tweaks.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@7769 b35dd754-fafc-0310-a699-88a17e54d16e
parent 8a027cc5
......@@ -1480,6 +1480,7 @@
<copy todir="${mac.pkg.dir}/usr/local/openfire">
<fileset dir="${target.dir}/openfire">
<exclude name="**/openfired"/>
<exclude name="**/openfire-sysconfig"/>
<exclude name="**/embedded-db*"/>
<exclude name="**/redhat-postinstall.sh"/>
</fileset>
......
......@@ -6,7 +6,7 @@ BuildRoot: %{_builddir}/%{name}-root
Source0: %{name}_src_3_3_0_alpha.tar.gz
Group: Applications/Communications
Vendor: Jive Software
License: Commercial
License: GPL
Requires: jdk >= 1.5.0
URL: http://www.igniterealtime.org/
......@@ -22,16 +22,37 @@ and delivers an innovative feature set.
%install
# There's no need to package this.
rm $RPM_BUILD_ROOT/opt/openfire/logs/stderr.out
# Set up the init script.
mkdir -p $RPM_BUILD_ROOT/etc/init.d
cp $RPM_BUILD_ROOT/opt/openfire/bin/extra/openfired $RPM_BUILD_ROOT/etc/init.d/openfired
chmod 755 $RPM_BUILD_ROOT/etc/init.d/openfired
# Make the startup script executable.
chmod 755 $RPM_BUILD_ROOT/opt/openfire/bin/openfire.sh
# Set up the sysconfig file.
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
cp $RPM_BUILD_ROOT/opt/openfire/bin/extra/openfire-sysconfig $RPM_BUILD_ROOT/etc/sysconfig/openfire
%pre
if /usr/bin/id jive > /dev/null 2>&1 ; then
: # user already exists
else
/usr/sbin/groupadd -r jive
/usr/sbin/useradd -r -g jive -d /opt/openfire -s /bin/bash -c "jive" jive
/usr/sbin/usermod -G jive jive
fi
%post
/sbin/chkconfig --add openfired
%files
%defattr(-,root,root)
%defattr(-,jive,jive)
%dir /opt/openfire
/opt/openfire/bin
%dir /opt/openfire/conf
%config(noreplace) /opt/openfire/conf/openfire.xml
/opt/openfire/lib
%dir /opt/openfire/logs
/opt/openfire/plugins
/opt/openfire/resources
%dir /opt/openfire/resources
/opt/openfire/resources/database
/opt/openfire/resources/i18n
......@@ -41,6 +62,8 @@ rm $RPM_BUILD_ROOT/opt/openfire/logs/stderr.out
%config(noreplace) /opt/openfire/resources/security/keystore
%config(noreplace) /opt/openfire/resources/security/truststore
%doc /opt/openfire/documentation
%doc /opt/openfire/LICENSE.html
%doc /opt/openfire/README.html
%doc /opt/openfire/LICENSE.html
%doc /opt/openfire/README.html
%doc /opt/openfire/changelog.html
/etc/init.d/openfired
%config(noreplace) /etc/sysconfig/openfire
# Set this to the path where openfire lives
# If this is not set the script will look for /opt/openfire, then /usr/local/ope
nfire
#OPENFIRE_HOME=""
# If there is a different user you would like to run openfire as,
# change the following line
#OPENFIRE_USER="jive"
......@@ -9,9 +9,9 @@
# The script has currently been tested on Redhat Fedora Core 3,
# but should theoretically work on most UNIX like systems
#
# before running this script make sure $WILDFIRE_HOME/bin/wildfire is
# before running this script make sure $OPENFIRE_HOME/bin/openfire.sh is
# executable by the user you want to run openfire as
# (chmod +x $WILDFIRE_HOME/bin/wildfire)
# (chmod +x $OPENFIRE_HOME/bin/openfire.sh)
#
# This script should be copied into /etc/init.d and linked into
# your default runlevel directory.
......@@ -20,28 +20,26 @@
#
# Link to the directory like follows
# cd /etc/rc<num>.d
# ln -s ../init.d/wildfired $90wildfired
# ln -s ../init.d/openfired S99openfired
#
# Set this to tell this script where openfire lives
# If this is not set the script will look for /opt/wildfire, then /usr/local/wildfire
#export WILDFIRE_HOME=
# Get config.
test -f /etc/sysconfig/openfire && . /etc/sysconfig/openfire
# If there is a different user you would like to run this script as,
# change the following line
export WILDFIRE_USER=jive
# If openfire user is not set in sysconfig, set to jive.
[ -z "$OPENFIRE_USER" ] && OPENFIRE_USER=jive
# -----------------------------------------------------------------
# If a openfire home variable has not been specified, try to determine it
if [ ! $WILDFIRE_HOME ]; then
if [ -d "/opt/wildfire" ]; then
WILDFIRE_HOME="/opt/wildfire"
elif [ -d "/usr/local/wildfire" ]; then
WILDFIRE_HOME="/usr/local/wildfire"
if [ ! $OPENFIRE_HOME ]; then
if [ -d "/opt/openfire" ]; then
OPENFIRE_HOME="/opt/openfire"
elif [ -d "/usr/local/openfire" ]; then
OPENFIRE_HOME="/usr/local/openfire"
else
echo "Could not find Openfire installation under /opt or /usr/local"
echo "Please specify the Openfire installation location in environment variable WILDFIRE_HOME"
echo "Please specify the Openfire installation location in environment variable OPENFIRE_HOME"
exit 1
fi
fi
......@@ -49,9 +47,9 @@ fi
function execCommand() {
OLD_PWD=`pwd`
cd $WILDFIRE_HOME/bin
CMD="./wildfire.sh $1"
su -c "$CMD" $WILDFIRE_USER &
cd $OPENFIRE_HOME/bin
CMD="./openfire.sh $1"
su -c "$CMD" $OPENFIRE_USER &
sleep 1 # allows prompt to return
cd $OLD_PWD
}
......@@ -79,12 +77,12 @@ case "$1" in
start
;;
status)
retval=$(pgrep -u $WILDFIRE_USER -f $WILDFIRE_HOME/bin/wildfire > /dev/null ; echo $?)
retval=$(pgrep -u $OPENFIRE_USER -f $OPENFIRE_HOME/bin/openfire.sh > /dev/null ; echo $?)
if [ "$retval" = "0" ] ; then
echo "wildfire is running"
echo "openfire is running"
exit 0
else
echo "wildfire is not running"
echo "openfire is not running"
exit 0
fi
;;
......
......@@ -11,6 +11,7 @@
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
linux=false;
case "`uname`" in
CYGWIN*) cygwin=true ;;
Darwin*) darwin=true
......@@ -18,6 +19,15 @@ case "`uname`" in
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
fi
;;
Linux*) linux=true
jdks=`ls -r1d /usr/java/j*`
for jdk in $jdks; do
if [ -f "$jdk/bin/java" ]; then
JAVA_HOME="$jdk"
break
fi
done
;;
esac
#if openfire home is not set or is not a directory
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment