commit 45af039a9453a78a7f21450c4e5fd0759b699b70
Author: Douglas Bagnall <douglas@paradise.net.nz>
Date:   Mon Oct 13 10:59:15 2008 +1300

    Check for sysconfig file in init.d script.
    
    This allows for:
    a) Easily raised open file limits.
    b) Alternate config files (e.g. for OLPC XS).

diff --git a/ejabberd.init b/ejabberd.init
index 3ef3548..9aab1b5 100644
--- a/ejabberd.init
+++ b/ejabberd.init
@@ -17,15 +17,26 @@
 
 . /etc/rc.d/init.d/functions
 
+if [ -r /etc/sysconfig/ejabberd ]; then
+    . /etc/sysconfig/ejabberd
+fi
+
+if [ ! "$CONFIG_FILE" ]; then
+    CONFIG_FILE=/etc/ejabberd/ejabberd.cfg
+fi
+
 node=`hostname -s`
 
 start() {
         echo -n $"Starting ejabberd: "
+        if [ "$ULIMIT_MAX_FILES" ]; then
+            ulimit -n $ULIMIT_MAX_FILES
+        fi
         daemon --user=ejabberd --check=ejabberd \
 	    "erl" "-pa @libdir@/ejabberd/ebin \
                    -sname ejabberd \
                    -s ejabberd \
-                   -ejabberd config \\\"/etc/ejabberd/ejabberd.cfg\\\" \
+                   -ejabberd config \\\"$CONFIG_FILE\\\" \
                              log_path \\\"/var/log/ejabberd/ejabberd.log\\\" \
                    -sasl sasl_error_logger \\{file,\\\"/var/log/ejabberd/sasl.log\\\"\\} \
                    -mnesia dir \\\"/var/lib/ejabberd/spool\\\" \
diff --git a/ejabberd.spec b/ejabberd.spec
index 7ee8636..10832db 100644
--- a/ejabberd.spec
+++ b/ejabberd.spec
@@ -1,6 +1,6 @@
 Name:           ejabberd
 Version:        2.0.1
-Release:        8%{?dist}.olpc
+Release:        9%{?dist}.olpc
 Summary:        A distributed, fault-tolerant Jabber/XMPP server
 
 Group:          Applications/Internet
@@ -9,6 +9,7 @@ URL:            http://www.ejabberd.im/
 Source0:	http://www.process-one.net/downloads/%{name}/%{version}/%{name}-%{version}_2.tar.gz
 Source1:        ejabberd.init
 Source2:        ejabberd.logrotate
+Source3:        ejabberd.sysconfig
 
 # http://ejabberd.jabber.ru/ejabberdctl-extra
 Source4:        https://svn.process-one.net/ejabberd-modules/mod_ctlextra/trunk/src/mod_ctlextra.erl
@@ -160,6 +161,9 @@ chmod a+x %{buildroot}%{_initrddir}/ejabberd
 mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
 cp -p %{S:2} %{buildroot}%{_sysconfdir}/logrotate.d/ejabberd
 
+mkdir -p %{buildroot}%{_sysconfdir}/sysconfig
+cp -p %{S:3} %{buildroot}%{_sysconfdir}/sysconfig/ejabberd
+
 %{__perl} -pi -e 's!\@libdir\@!%{_libdir}!g'  %{buildroot}%{_initrddir}/ejabberd %{buildroot}%{_sysconfdir}/logrotate.d/ejabberd %{buildroot}%{_sbindir}/ejabberdctl
 %{__perl} -pi -e 's!\@version\@!%{version}!g' %{buildroot}%{_initrddir}/ejabberd %{buildroot}%{_sysconfdir}/logrotate.d/ejabberd %{buildroot}%{_sbindir}/ejabberdctl
 
@@ -183,7 +187,7 @@ rm -rf %{buildroot}
 
 %{_initrddir}/ejabberd
 %config(noreplace) %{_sysconfdir}/logrotate.d/ejabberd
-
+%config(noreplace) %{_sysconfdir}/sysconfig/ejabberd
 %config(noreplace) %{_sysconfdir}/pam.d/ejabberdctl
 %config(noreplace) %{_sysconfdir}/security/console.apps/ejabberdctl
 %{_bindir}/ejabberdctl
@@ -214,6 +218,9 @@ rm -rf %{buildroot}
 %endif
 
 %changelog
+* Mon Oct  13 2008 Douglas Bagnall <douglas@paradise.net.nz> 2.0.1-9.olpc
+- Add /etc/sysconfig/ejabberd, with options to set config file and open file limit.
+
 * Tue Sep  9 2008 Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> 2.0.1-8.olpc
 - ejabberd.cfg: add mod_ctlextra to the modules list
 
diff --git a/ejabberd.sysconfig b/ejabberd.sysconfig
new file mode 100644
index 0000000..fac25b1
--- /dev/null
+++ b/ejabberd.sysconfig
@@ -0,0 +1,13 @@
+## Settings for ejabberd
+
+## Where should ejabberd find its configuration file?
+#
+#CONFIG_FILE=/etc/ejabberd/ejabberd.cfg
+
+## ULIMIT_MAX_FILES alters the number of files that ejabberd is
+## allowed to have open at once.  If it is unset the system default
+## (usually 1024) will be used.  ejabberd will want over twice as many
+## open files as it has active connections, so if you have a few
+## hundred or more users you will want to set this.
+#
+#ULIMIT_MAX_FILES=1024
