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 @@ ...@@ -1480,6 +1480,7 @@
<copy todir="${mac.pkg.dir}/usr/local/openfire"> <copy todir="${mac.pkg.dir}/usr/local/openfire">
<fileset dir="${target.dir}/openfire"> <fileset dir="${target.dir}/openfire">
<exclude name="**/openfired"/> <exclude name="**/openfired"/>
<exclude name="**/openfire-sysconfig"/>
<exclude name="**/embedded-db*"/> <exclude name="**/embedded-db*"/>
<exclude name="**/redhat-postinstall.sh"/> <exclude name="**/redhat-postinstall.sh"/>
</fileset> </fileset>
......
...@@ -6,7 +6,7 @@ BuildRoot: %{_builddir}/%{name}-root ...@@ -6,7 +6,7 @@ BuildRoot: %{_builddir}/%{name}-root
Source0: %{name}_src_3_3_0_alpha.tar.gz Source0: %{name}_src_3_3_0_alpha.tar.gz
Group: Applications/Communications Group: Applications/Communications
Vendor: Jive Software Vendor: Jive Software
License: Commercial License: GPL
Requires: jdk >= 1.5.0 Requires: jdk >= 1.5.0
URL: http://www.igniterealtime.org/ URL: http://www.igniterealtime.org/
...@@ -22,16 +22,37 @@ and delivers an innovative feature set. ...@@ -22,16 +22,37 @@ and delivers an innovative feature set.
%install %install
# There's no need to package this. # There's no need to package this.
rm $RPM_BUILD_ROOT/opt/openfire/logs/stderr.out 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 %files
%defattr(-,root,root) %defattr(-,jive,jive)
%dir /opt/openfire
/opt/openfire/bin /opt/openfire/bin
%dir /opt/openfire/conf %dir /opt/openfire/conf
%config(noreplace) /opt/openfire/conf/openfire.xml %config(noreplace) /opt/openfire/conf/openfire.xml
/opt/openfire/lib /opt/openfire/lib
%dir /opt/openfire/logs %dir /opt/openfire/logs
/opt/openfire/plugins /opt/openfire/plugins
/opt/openfire/resources
%dir /opt/openfire/resources %dir /opt/openfire/resources
/opt/openfire/resources/database /opt/openfire/resources/database
/opt/openfire/resources/i18n /opt/openfire/resources/i18n
...@@ -41,6 +62,8 @@ rm $RPM_BUILD_ROOT/opt/openfire/logs/stderr.out ...@@ -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/keystore
%config(noreplace) /opt/openfire/resources/security/truststore %config(noreplace) /opt/openfire/resources/security/truststore
%doc /opt/openfire/documentation %doc /opt/openfire/documentation
%doc /opt/openfire/LICENSE.html %doc /opt/openfire/LICENSE.html
%doc /opt/openfire/README.html %doc /opt/openfire/README.html
%doc /opt/openfire/changelog.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 @@ ...@@ -9,9 +9,9 @@
# The script has currently been tested on Redhat Fedora Core 3, # The script has currently been tested on Redhat Fedora Core 3,
# but should theoretically work on most UNIX like systems # 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 # 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 # This script should be copied into /etc/init.d and linked into
# your default runlevel directory. # your default runlevel directory.
...@@ -20,28 +20,26 @@ ...@@ -20,28 +20,26 @@
# #
# Link to the directory like follows # Link to the directory like follows
# cd /etc/rc<num>.d # 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 # Get config.
# If this is not set the script will look for /opt/wildfire, then /usr/local/wildfire test -f /etc/sysconfig/openfire && . /etc/sysconfig/openfire
#export WILDFIRE_HOME=
# If there is a different user you would like to run this script as, # If openfire user is not set in sysconfig, set to jive.
# change the following line [ -z "$OPENFIRE_USER" ] && OPENFIRE_USER=jive
export WILDFIRE_USER=jive
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# If a openfire home variable has not been specified, try to determine it # If a openfire home variable has not been specified, try to determine it
if [ ! $WILDFIRE_HOME ]; then if [ ! $OPENFIRE_HOME ]; then
if [ -d "/opt/wildfire" ]; then if [ -d "/opt/openfire" ]; then
WILDFIRE_HOME="/opt/wildfire" OPENFIRE_HOME="/opt/openfire"
elif [ -d "/usr/local/wildfire" ]; then elif [ -d "/usr/local/openfire" ]; then
WILDFIRE_HOME="/usr/local/wildfire" OPENFIRE_HOME="/usr/local/openfire"
else else
echo "Could not find Openfire installation under /opt or /usr/local" 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 exit 1
fi fi
fi fi
...@@ -49,9 +47,9 @@ fi ...@@ -49,9 +47,9 @@ fi
function execCommand() { function execCommand() {
OLD_PWD=`pwd` OLD_PWD=`pwd`
cd $WILDFIRE_HOME/bin cd $OPENFIRE_HOME/bin
CMD="./wildfire.sh $1" CMD="./openfire.sh $1"
su -c "$CMD" $WILDFIRE_USER & su -c "$CMD" $OPENFIRE_USER &
sleep 1 # allows prompt to return sleep 1 # allows prompt to return
cd $OLD_PWD cd $OLD_PWD
} }
...@@ -79,12 +77,12 @@ case "$1" in ...@@ -79,12 +77,12 @@ case "$1" in
start start
;; ;;
status) 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 if [ "$retval" = "0" ] ; then
echo "wildfire is running" echo "openfire is running"
exit 0 exit 0
else else
echo "wildfire is not running" echo "openfire is not running"
exit 0 exit 0
fi fi
;; ;;
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
# OS specific support. $var _must_ be set to either true or false. # OS specific support. $var _must_ be set to either true or false.
cygwin=false; cygwin=false;
darwin=false; darwin=false;
linux=false;
case "`uname`" in case "`uname`" in
CYGWIN*) cygwin=true ;; CYGWIN*) cygwin=true ;;
Darwin*) darwin=true Darwin*) darwin=true
...@@ -18,6 +19,15 @@ case "`uname`" in ...@@ -18,6 +19,15 @@ case "`uname`" in
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
fi 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 esac
#if openfire home is not set or is not a directory #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