[packages/prosody] pld deps, pld systemd macros, rc-scripts, %config for files, not dirs, specify attr in files
glen
glen at pld-linux.org
Sat Feb 8 12:34:58 CET 2014
commit 8c2cd589148175733c206cd006ec92aa2d92eae6
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Sat Feb 8 13:32:21 2014 +0200
pld deps, pld systemd macros, rc-scripts, %config for files, not dirs, specify attr in files
prosody.spec | 149 ++++++++++++++++++++++++++++++++---------------------------
1 file changed, 82 insertions(+), 67 deletions(-)
---
diff --git a/prosody.spec b/prosody.spec
index 76fb8e2..ea284aa 100644
--- a/prosody.spec
+++ b/prosody.spec
@@ -1,27 +1,32 @@
+# TODO
+# - register uid/gid
+# - register group (default "users" is not fine!)
+# - bashism in %post
Summary: Flexible communications server for Jabber/XMPP
Name: prosody
Version: 0.9.2
-Release: 1
+Release: 0.1
+License: MIT
Group: Daemons
-URL: http://prosody.im/
-License: MIT
Source0: http://prosody.im/downloads/source/%{name}-%{version}.tar.gz
# Source0-md5: bb91f73be0e19d049f1a57951b52c3a2
Source1: %{name}.init
Source2: %{name}.tmpfiles
Source3: %{name}.service
-BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+URL: http://prosody.im/
BuildRequires: libidn-devel
BuildRequires: lua51-devel
BuildRequires: openssl-devel
+BuildRequires: rpmbuild(macros) >= 1.647
+BuildRequires: sed >= 4.0
BuildRequires: systemd-units
Requires: lua-dbi
Requires: lua-expat
Requires: lua-filesystem
Requires: lua-sec
-Requires(post): systemd-units
-Requires(preun): systemd-units
-Requires(postun): systemd-units
+Requires: systemd-units >= 0.38
+Requires(post,preun,postun): systemd-units >= 38
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
Prosody is a flexible communications server for Jabber/XMPP written in
@@ -29,7 +34,6 @@ 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
sed -e 's|$(PREFIX)/lib|$(PREFIX)/%{_lib}|' -i Makefile
@@ -41,101 +45,112 @@ sed -i -e 's|\r||g' doc/stanza.txt doc/session.txt doc/roster_format.txt
--with-lua-include=%{_includedir}/lua51 \
--lua-suffix=51 \
--prefix=%{_prefix}
-%{__make} CFLAGS="$RPM_OPT_FLAGS -fPIC"
+%{__make} \
+ CFLAGS="%{rpmcflags} -fPIC"
%install
rm -rf $RPM_BUILD_ROOT
-%{__make} install DESTDIR=$RPM_BUILD_ROOT
+%{__make} install \
+ DESTDIR=$RPM_BUILD_ROOT
-#fix perms
+# fix perms
chmod -x $RPM_BUILD_ROOT%{_libdir}/%{name}/%{name}.version
-#avoid rpmlint unstripped-binary-or-object warnings
+# avoid rpmlint unstripped-binary-or-object warnings
chmod 0755 $RPM_BUILD_ROOT%{_libdir}/%{name}/util/*.so
-#directories for datadir and pids
-install -d $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}
-chmod 0755 $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}
-install -d $RPM_BUILD_ROOT%{_localstatedir}/run/%{name}
+# directories for datadir and pids
+install -d $RPM_BUILD_ROOT{%{_sharedstatedir}/%{name},%{_localstatedir}/run/%{name}}
-#systemd stuff
+# systemd stuff
install -d $RPM_BUILD_ROOT%{systemdunitdir}
-install -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
-
-#tmpfiles.d stuff
-install -d $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d
-install -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf
+cp -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
-#install initd script
-install -d $RPM_BUILD_ROOT%{_initddir}
-install %{SOURCE1} $RPM_BUILD_ROOT%{_initddir}/%{name}
+# tmpfiles.d stuff
+install -d $RPM_BUILD_ROOT%{systemdtmpfilesdir}
+cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
+# install initd script
+install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
+install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
%clean
rm -rf $RPM_BUILD_ROOT
-
%pre
-%{_sbindir}/useradd -d %{_sharedstatedir}/%{name} -r -s /sbin/nologin %{name} 2> /dev/null || :
+%useradd -u xxx -d %{_sharedstatedir}/%{name} -c "prosody daemon" %{name} -g XXX
%preun
-if [ $1 = 0 ]; then
- %service prosody stop
- /sbin/chkconfig --del prosody
+if [ "$1" = "0" ]; then
+ /sbin/chkconfig --del prosody
+ %service -q prosody stop
fi
%systemd_preun prosody.service
%post
-/sbin/chkconfig --add prosody
-%systemd_post prosody.service
umask 077
-if [ ! -f %{sslkey} ] ; then
- %{_bindir}/openssl genrsa 1024 > %{sslkey} 2> /dev/null
- chown root:%{name} %{sslkey}
- chmod 640 %{sslkey}
-fi
-
-FQDN=`hostname`
-if [ "x${FQDN}" = "x" ]; then
- FQDN=localhost.localdomain
+if [ ! -f %{sslkey} ]; then
+ %{_bindir}/openssl genrsa 1024 > %{sslkey} 2> /dev/null
+ chown root:%{name} %{sslkey}
+ chmod 640 %{sslkey}
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
-chmod 644 %{sslcert}
+if [ ! -f %{sslcert} ]; then
+ FQDN=`hostname`
+ if [ "x${FQDN}" = "x" ]; then
+ FQDN=localhost.localdomain
+ fi
+
+ # FIXME: $RANDOM is bashism!
+ 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
+ chmod 644 %{sslcert}
fi
+/sbin/chkconfig --add prosody
+%service prosody restart
+%systemd_post prosody.service
%postun
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
-if [ $1 -ge 1 ] ; then
- %service -q prosody reload
- %systemd_service_reload prosody.service
+if [ "$1" = "0" ]; then
+ %userremove %{name}
fi
-
+%systemd_reload
%files
%defattr(644,root,root,755)
%doc AUTHORS COPYING HACKERS README TODO doc/*
%attr(755,root,root) %{_bindir}/%{name}
%attr(755,root,root) %{_bindir}/%{name}ctl
+%{_mandir}/man1/*.1*
+%attr(754,root,root) /etc/rc.d/init.d/%{name}
%dir %{_libdir}/%{name}
-%{_libdir}/%{name}/*
+%{_libdir}/%{name}/core
+%{_libdir}/%{name}/modules
+%{_libdir}/%{name}/net
+%{_libdir}/%{name}/util
+%{_libdir}/%{name}/prosody.version
%dir %{_sysconfdir}/%{name}
-%config(noreplace) %attr(640, root, %{name}) %{_sysconfdir}/%{name}/*
-%config(noreplace) %{_sysconfdir}/tmpfiles.d/%{name}.conf
-%{systemdunitdir}/%{name}.service
-%attr(755,root,root) %{_initddir}/%{name}
-%{_mandir}/man1/*.1*
-%dir %attr(-,prosody,prosody) %{_sharedstatedir}/prosody
-%dir %attr(-,prosody,prosody) %{_localstatedir}/run/prosody
+%dir %{_sysconfdir}/%{name}/certs
+%config(noreplace) %attr(640,root,prosody) %{_sysconfdir}/%{name}/certs/example.com.cnf
+%config(noreplace) %attr(640,root,prosody) %{_sysconfdir}/%{name}/certs/example.com.crt
+%config(noreplace) %attr(640,root,prosody) %{_sysconfdir}/%{name}/certs/example.com.key
+%config(noreplace) %attr(640,root,prosody) %{_sysconfdir}/%{name}/certs/localhost.cnf
+%config(noreplace) %attr(640,root,prosody) %{_sysconfdir}/%{name}/certs/localhost.crt
+%config(noreplace) %attr(640,root,prosody) %{_sysconfdir}/%{name}/certs/localhost.key
+%config(noreplace) %attr(640,root,prosody) %{_sysconfdir}/%{name}/certs/openssl.cnf
+%config(noreplace) %attr(640,root,prosody) %{_sysconfdir}/%{name}/certs/Makefile
+%config(noreplace) %attr(640,root,prosody) %{_sysconfdir}/%{name}/prosody.cfg.lua
+%{systemdtmpfilesdir}/prosody.conf
+%{systemdunitdir}/prosody.service
+%dir %attr(755,prosody,prosody) %{_sharedstatedir}/prosody
+%dir %attr(755,prosody,prosody) %{_localstatedir}/run/prosody
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/prosody.git/commitdiff/0454fc78c9a6d2f264717ec7c2a1b264bd312bb3
More information about the pld-cvs-commit
mailing list