diff options
author | Deposite Pirate | 2018-09-16 23:29:24 +0200 |
---|---|---|
committer | Deposite Pirate | 2018-09-16 23:29:24 +0200 |
commit | 569e598d38adb1918d127ee31af1cd332b072dcf (patch) | |
tree | 23a7204866591100db57f3acac53cd410ea8d3e4 /uhub/uhub.spec |
Diffstat (limited to 'uhub/uhub.spec')
-rw-r--r-- | uhub/uhub.spec | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/uhub/uhub.spec b/uhub/uhub.spec new file mode 100644 index 0000000..12f41ba --- /dev/null +++ b/uhub/uhub.spec @@ -0,0 +1,148 @@ +%define uhub_user uhub +%define uhub_group %{uhub_user} +%define uhub_confdir %{_sysconfdir}/uhub +%define uhub_pluginsdir %{_libdir}/uhub +%define uhub_homedir %{_localstatedir}/lib/uhub +%define uhub_logdir %{_localstatedir}/log/uhub +%define sslcert %{_sysconfdir}/pki/tls/certs/uhub.crt +%define sslkey %{_sysconfdir}/pki/tls/private/uhub.key + +Name: uhub +Version: 0.5.0 +Release: 1%{?dist} +Summary: Advanced Direct Connect hub daemon +Group: System Environment/Daemons +License: GPLv3 +URL: https://www.uhub.org +Packager: Christoph J. Thompson <cjsthompson@gmail.com> +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release} +BuildRequires: cmake,openssl-devel,systemd-devel,sqlite-devel +Requires(pre): shadow-utils +Requires(post): systemd,openssl +Requires(preun): systemd +Requires(postun): systemd +Source0: http://www.extatic.org/downloads/uhub/%{name}-%{version}-src.tar.bz2 +Patch0: 0001-Install-man-pages.patch +Patch1: 0002-Add-a-default-MOTD-file-which-was-missing.patch +Patch2: 0003-Most-unices-including-most-Linux-distro-have-logrota.patch +Patch3: 0004-Conditionally-install-systemd-support-files.patch +Patch4: 0005-Also-install-users.conf.patch + +%description +uhub is a high performance peer-to-peer hub for the ADC network. +Its low memory footprint allows it to handle several thousand users on +high-end servers, or a small private hub on embedded hardware. + +Key features: +- High performance and low memory usage +- IPv4 and IPv6 support +- Experimental SSL support (optional) +- Advanced access control support +- Easy configuration +- plugin support + - mod_welcome - MOTD\RULES messages + - mod_auth_sipmle - auth with sqlite DB + - mod_logging - log hub activity + +%prep +%autosetup -p1 + +%build +%{__cmake} \ + -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DINSTALL_LIB_DIR=%{_libdir} \ + -DSYSTEMD_SUPPORT=yes \ + -DSSL_SUPPORT=yes \ + -DUSE_OPENSSL=yes +%{__make} %{?_smp_mflags} + +%install +%{__rm} -rf %{buildroot} +%{__make} install DESTDIR="%{buildroot}" +%{__install} -d -p -m 0755 %{buildroot}%{uhub_logdir} +%{__install} -d -p -m 0755 %{buildroot}%{uhub_homedir} +sed -i 's|/var/log/uhub.log|/var/log/uhub/uhub.log|g' %{buildroot}%{uhubconfdir}/plugins.conf +cat >> %{buildroot}%{_tmpfilesdir}/%{name}.conf <<EOF +d /var/lib/uhub 0750 uhub uhub +d /var/log/uhub 0750 uhub uhub +EOF + +%clean +%{__rm} -rf %{buildroot} + +%pre +%{_sbindir}/groupadd -r %{uhub_group} 2>/dev/null || : +%{_sbindir}/useradd -r -g %{uhub_group} -c "Uhub user" -s /bin/nologin -d %{uhub_homedir} %{uhub_user} 2>/dev/null || : + +%post +%tmpfiles_create %{name}.conf +%systemd_post %{name}.service + +if [ ! -f /etc/uhub/users.db ]; then + %{_bindir}/uhub-passwd /etc/uhub/users.db create 2> /dev/null +fi + +umask 077 + +if [ -f %{sslkey} -o -f %{sslcert} ]; then + exit 0 +fi + +%{_bindir}/openssl genrsa -rand /proc/apm:/proc/cpuinfo:/proc/dma:/proc/filesystems:/proc/interrupts:/proc/ioports:/proc/pci:/proc/rtc:/proc/uptime 1024 > %{sslkey} 2> /dev/null + +FQDN=`hostname` + +if [ "x${FQDN}" = "x" ]; then + FQDN=localhost.localdomain +fi + +cat << EOF | %{_bindir}/openssl req -new -key %{sslkey} \ + -x509 -days 365 -set_serial $RANDOM -extensions v3_req \ + -out %{sslcert} 2>/dev/null +-- +SomeState +SomeCity +SomeOrganization +SomeOrganizationalUnit +${FQDN} +root@${FQDN} +EOF + +%preun +%systemd_preun %{name}.service + +%postun +%systemd_postun_with_restart %{name}.service + +%files +%defattr(-,root,root,0755) +%doc AUTHORS ChangeLog README +%{_bindir}/uhub +%{_bindir}/uhub-passwd +%{_mandir}/man1/*.1* +%{_unitdir}/%{name}.service +%{_tmpfilesdir}/%{name}.conf +%config(noreplace) %{uhub_confdir}/%{name}.conf +%config(noreplace) %{uhub_confdir}/plugins.conf +%config(noreplace) %{uhub_confdir}/users.conf +%config(noreplace) %{uhub_confdir}/rules.txt +%config(noreplace) %{uhub_confdir}/motd.txt +%config(noreplace) %{_sysconfdir}/logrotate.d/uhub +%dir %{uhub_confdir} +%dir %{uhub_pluginsdir} +%dir %{uhub_logdir} +%dir %{uhub_homedir} +%{uhub_pluginsdir}/mod_auth_simple.so +%{uhub_pluginsdir}/mod_auth_sqlite.so +%{uhub_pluginsdir}/mod_chat_history.so +%{uhub_pluginsdir}/mod_chat_history_sqlite.so +%{uhub_pluginsdir}/mod_chat_only.so +%{uhub_pluginsdir}/mod_example.so +%{uhub_pluginsdir}/mod_logging.so +%{uhub_pluginsdir}/mod_no_guest_downloads.so +%{uhub_pluginsdir}/mod_topic.so +%{uhub_pluginsdir}/mod_welcome.so + +%changelog +* Sat Dec 13 2014 Christoph J. Thompson <cjsthompson-at-gmail.com> 0.5.0-1 +- Initial spec. |