From d3805ac66e3298400d0862c146d83062327f2435 Mon Sep 17 00:00:00 2001 From: Johan Cwiklinski Date: Jun 23 2012 18:41:03 +0000 Subject: Iinitial import --- diff --git a/.gitignore b/.gitignore index e69de29..91f5cd1 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/prosody-0.8.2.tar.gz diff --git a/prosody.config.patch b/prosody.config.patch new file mode 100644 index 0000000..9eaa215 --- /dev/null +++ b/prosody.config.patch @@ -0,0 +1,39 @@ +diff -up prosody-0.8.0/prosody.cfg.lua.dist.patch prosody-0.8.0/prosody.cfg.lua.dist +--- prosody-0.8.0/prosody.cfg.lua.dist.patch 2011-04-08 14:20:24.508974815 +0200 ++++ prosody-0.8.0/prosody.cfg.lua.dist 2011-04-08 14:25:56.159877253 +0200 +@@ -59,7 +59,7 @@ modules_enabled = { + --"admin_telnet"; -- Opens telnet console interface on localhost port 5582 + + -- Other specific functionality +- --"posix"; -- POSIX functionality, sends server to background, enables syslog, etc. ++ "posix"; -- POSIX functionality, sends server to background, enables syslog, etc. + --"bosh"; -- Enable BOSH clients, aka "Jabber over HTTP" + --"httpserver"; -- Serve static files from a directory over HTTP + --"groups"; -- Shared roster support +@@ -86,8 +86,8 @@ allow_registration = false; + -- These are the SSL/TLS-related settings. If you don't want + -- to use SSL/TLS, you may comment or remove this + ssl = { +- key = "certs/localhost.key"; +- certificate = "certs/localhost.cert"; ++ key = "/etc/pki/tls/private/prosody.key"; ++ certificate = "/etc/pki/tls/certs/prosody.crt"; + } + + -- Only allow encrypted streams? Encryption is already used when +@@ -123,11 +123,12 @@ authentication = "internal_plain" + -- Logging configuration + -- For advanced logging see http://prosody.im/doc/logging + log = { +- info = "prosody.log"; -- Change 'info' to 'debug' for verbose logging +- error = "prosody.err"; +- -- "*syslog"; -- Uncomment this for logging to syslog ++ -- info = "prosody.log"; -- Change 'info' to 'debug' for verbose logging ++ -- error = "prosody.err"; ++ "*syslog"; -- Uncomment this for logging to syslog + -- "*console"; -- Log to the console, useful for debugging with daemonize=false + } ++pidfile = "/var/run/prosody/prosody.pid"; + + ----------- Virtual hosts ----------- + -- You need to add a VirtualHost entry for each domain you wish Prosody to serve. diff --git a/prosody.init b/prosody.init new file mode 100644 index 0000000..a5a79e1 --- /dev/null +++ b/prosody.init @@ -0,0 +1,75 @@ +#!/bin/sh +# +# prosody - Flexible communications server for Jabber/XMPP +# +# chkconfig: - 90 10 +# description: Flexible communications server for Jabber/XMPP + +# http://fedoraproject.org/wiki/FCNewInit/Initscripts +### BEGIN INIT INFO +# Provides: prosody +# Required-Start: network +# Required-Stop: network +# Default-Start: +# Default-Stop: 0 1 6 +# Short-Description: Start and stop prosody +# Description: +### END INIT INFO + +# Source function library. +. /etc/rc.d/init.d/functions + +exec="/usr/bin/prosodyctl" +prog="prosody" +user="prosody" + +[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +lockfile=/var/lock/subsys/$prog + +start() { + echo -n $"Starting $prog: " + daemon --user $user $exec start + retval=$? + echo + [ $retval -eq 0 ] && touch $lockfile + return $retval +} + +stop() { + echo -n $"Stopping $prog: " + daemon $exec stop 2>/dev/null + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + stop + start +} + +case "$1" in + start|stop|restart) + $1 + ;; + force-reload) + restart + ;; + status) + $exec status + ;; + try-restart|condrestart) + if $exec status >/dev/null ; then + restart + fi + ;; + reload) + action $"Service ${0##*/} does not support the reload action: " /bin/false + exit 3 + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}" + exit 2 +esac diff --git a/prosody.service b/prosody.service new file mode 100644 index 0000000..d8eb11a --- /dev/null +++ b/prosody.service @@ -0,0 +1,12 @@ +[Unit] +Description=Prosody XMPP (Jabber) server +After=network.target + +[Service] +Type=forking +PIDFile=/var/run/prosody/prosody.pid +ExecStart=/usr/bin/prosodyctl start +ExecStop=/usr/bin/prosodyctl stop + +[Install] +WantedBy=multi-user.target diff --git a/prosody.spec b/prosody.spec new file mode 100644 index 0000000..cd89789 --- /dev/null +++ b/prosody.spec @@ -0,0 +1,238 @@ +%{!?_initddir: %{expand: %%global _initddir %{_initrddir}}} +%if 0%{?rhel} == 5 +%global _sharedstatedir %{_localstatedir}/lib +%endif + +%global sslcert %{_sysconfdir}/pki/tls/certs/prosody.crt +%global sslkey %{_sysconfdir}/pki/tls/private/prosody.key + +%global luaver 5.1 + +Name: prosody +Version: 0.8.2 +Release: 5%{?dist} +Summary: Flexible communications server for Jabber/XMPP + +Group: System Environment/Daemons +License: MIT +URL: http://prosody.im/ +Source0: http://prosody.im/downloads/source/%{name}-%{version}.tar.gz +Source1: %{name}.init +Source2: %{name}.tmpfiles +Source3: %{name}.service +Patch0: %{name}.config.patch +Patch1: %{name}.sslcerts.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: lua-devel +BuildRequires: libidn-devel +BuildRequires: openssl-devel +%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 +BuildRequires: systemd-units +%endif +Requires: lua-expat +Requires: lua-sec +Requires: lua-filesystem +Requires: lua-dbi +%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units +%endif +%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7 +Requires: lua(abi) = %{luaver} +%else +Requires: lua >= %{luaver} +%endif + +%description +Prosody is a flexible communications server for Jabber/XMPP written in Lua. +It aims to be easy to use, and light on resources. For developers it aims +to be easy to extend and give a flexible system on which to rapidly +develop added functionality, or prototype new protocols. + + +%prep +%setup -q +%patch0 -p1 +# remove default ssl certificates +%patch1 -p1 +#do the sed atfer patch1, to avoid a i686 build issue +sed -e 's|$(PREFIX)/lib|$(PREFIX)/%{_lib}|' -i Makefile +rm -rf certs/ +# fix wrong end of line encoding +pushd doc +sed -i -e 's|\r||g' stanza.txt session.txt roster_format.txt +popd + + +%build +./configure \ + --with-lua='' \ + --with-lua-include=%{_includedir} \ + --prefix=%{_prefix} +make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS -fPIC" + + +%install +rm -rf $RPM_BUILD_ROOT +make install DESTDIR=$RPM_BUILD_ROOT +#fix perms +chmod -x $RPM_BUILD_ROOT%{_libdir}/%{name}/%{name}.version +#avoid rpmlint unstripped-binary-or-object warnings +chmod 0755 $RPM_BUILD_ROOT%{_libdir}/%{name}/util/*.so + +#directories for datadir and pids +mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/%{name} +chmod 0755 $RPM_BUILD_ROOT%{_sharedstatedir}/%{name} +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/%{name} + +%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 +#systemd stuff +mkdir -p $RPM_BUILD_ROOT%{_unitdir} +install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_unitdir}/%{name}.service + +#tmpfiles.d stuff +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d +install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf +%else +#install initd script +mkdir -p $RPM_BUILD_ROOT%{_initddir} +install -m755 %{SOURCE1} $RPM_BUILD_ROOT%{_initddir}/%{name} +%endif + + +%clean +rm -rf $RPM_BUILD_ROOT + + +%pre +%{_sbindir}/useradd -d %{_sharedstatedir}/%{name} -r -s /sbin/nologin %{name} 2> /dev/null || : + + +%preun +if [ $1 = 0 ]; then + # Package removal, not upgrade + %if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 + /bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || : + /bin/systemctl stop %{name}.service > /dev/null 2>&1 || : + %else + service %{name} stop > /dev/null 2>&1 || : + chkconfig --del %{name} || : + %endif +fi + + +%post +if [ $1 -eq 1 ] ; then + # Initial installation + %if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 + /bin/systemctl daemon-reload >/dev/null 2>&1 || : + %else + chkconfig --add %{name} || : + %endif +fi +umask 077 +if [ ! -f %{sslkey} ] ; then +%{_bindir}/openssl genrsa 1024 > %{sslkey} 2> /dev/null +fi + +FQDN=`hostname` +if [ "x${FQDN}" = "x" ]; then + FQDN=localhost.localdomain +fi + +if [ ! -f %{sslcert} ] ; then +cat << EOF | %{_bindir}/openssl req -new -key %{sslkey} \ + -x509 -days 365 -set_serial $RANDOM \ + -out %{sslcert} 2>/dev/null +-- +SomeState +SomeCity +SomeOrganization +SomeOrganizationalUnit +${FQDN} +root@${FQDN} +EOF +fi + + +%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 +%postun +/bin/systemctl daemon-reload >/dev/null 2>&1 || : +if [ $1 -ge 1 ] ; then + # Package upgrade, not uninstall + /bin/systemctl try-restart %{name}.service >/dev/null 2>&1 || : +fi +%endif + + +%files +%defattr(-,root,root,-) +%doc AUTHORS COPYING HACKERS README TODO doc/* +%{_bindir}/%{name} +%{_bindir}/%{name}ctl +%dir %{_libdir}/%{name} +%{_libdir}/%{name}/* +%dir %{_sysconfdir}/%{name} +%config(noreplace) %{_sysconfdir}/%{name}/* +%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 +%config(noreplace) %{_sysconfdir}/tmpfiles.d/%{name}.conf +%{_unitdir}/%{name}.service +%else +%{_initddir}/%{name} +%endif +%{_mandir}/man1/*.1.gz +%dir %attr(-, %{name}, %{name}) %{_sharedstatedir}/%{name} +%dir %attr(-, %{name}, %{name}) %{_localstatedir}/run/%{name} + + +%changelog +* Mon May 07 2012 Johan Cwiklinski 0.8.2-5 +- Missing rhel %%ifs +- Change the way SSL certificate is generated + +* Sun May 06 2012 Johan Cwiklinski 0.8.2-4 +- ghost %%{_localstatedir}/run/%%{name} + +* Sun May 06 2012 Johan Cwiklinski 0.8.2-3 +- Add missing requires +- Add rhel %%ifs + +* Mon Mar 05 2012 Johan Cwiklinski 0.8.2-2 +- Switch to systemd for Fedora >= 15, keep sysv for EPEL builds +- Remove some macros that should not be used + +* Thu Jun 23 2011 Johan Cwiklinski 0.8.2-1.trashy +- 0.8.2 + +* Tue Jun 7 2011 Johan Cwiklinski 0.8.1-1.trashy +- 0.8.1 + +* Sun May 8 2011 Johan Cwiklinski 0.8.0-3.trashy +- tmpfiles.d configuration for F-15 + +* Sat Apr 16 2011 Johan Cwiklinski 0.8.0-2.trashy +- Now requires lua-dbi + +* Fri Apr 8 2011 Johan Cwiklinski 0.8.0-1.trashy +- 0.8.0 + +* Sun Jan 23 2011 Johan Cwiklinski 0.7.0-4.trashy +- Redefine _initddir and _sharedstatedir marcos for EL-5 + +* Sat Dec 11 2010 Johan Cwiklinski 0.7.0-3 +- Apply ssl patch before sed on libdir; to avoid a patch context issue + building on i686 + +* Sat Sep 11 2010 Johan Cwiklinski 0.7.0-2 +- No longer ships default ssl certificates, generates one at install + +* Wed Jul 14 2010 Johan Cwiklinski 0.7.0-1 +- Update to 0.7.0 + +* Wed Apr 28 2010 Johan Cwiklinski 0.6.2-1 +- Update to 0.6.2 + +* Thu Dec 31 2009 Johan Cwiklinski 0.6.1-1 +- Initial packaging diff --git a/prosody.sslcerts.patch b/prosody.sslcerts.patch new file mode 100644 index 0000000..d5bda62 --- /dev/null +++ b/prosody.sslcerts.patch @@ -0,0 +1,23 @@ +diff -up prosody-0.8.0/Makefile.patch prosody-0.8.0/Makefile +--- prosody-0.8.0/Makefile.patch 2011-04-08 14:27:59.795497482 +0200 ++++ prosody-0.8.0/Makefile 2011-04-08 14:29:51.175569107 +0200 +@@ -32,18 +32,16 @@ install: prosody.install prosodyctl.inst + install -m644 plugins/*.lua $(MODULES) + install -d $(MODULES)/muc + install -m644 plugins/muc/* $(MODULES)/muc +- install -m644 certs/* $(CONFIG)/certs + install -d $(MODULES)/adhoc + install -m644 plugins/adhoc/*.lua $(MODULES)/adhoc + install -m644 man/prosodyctl.man $(MAN)/man1/prosodyctl.1 +- test -e $(CONFIG)/prosody.cfg.lua || install -m644 prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua ++ test -e $(CONFIG)/prosody.cfg.lua || install -m644 prosody.cfg.lua.dist $(CONFIG)/prosody.cfg.lua + test -e prosody.version && install prosody.version $(SOURCE)/prosody.version || true + $(MAKE) install -C util-src + + clean: + rm -f prosody.install + rm -f prosodyctl.install +- rm -f prosody.cfg.lua.install + rm -f prosody.version + $(MAKE) clean -C util-src + diff --git a/prosody.tmpfiles b/prosody.tmpfiles new file mode 100644 index 0000000..563f04a --- /dev/null +++ b/prosody.tmpfiles @@ -0,0 +1 @@ +d /var/run/prosody 710 prosody prosody diff --git a/sources b/sources index e69de29..29da2f1 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +6e907bf0d0acf24f1011083020ba6ffb prosody-0.8.2.tar.gz