diff options
Diffstat (limited to 'uhub')
-rw-r--r-- | uhub/0001-Install-man-pages.patch | 206 | ||||
-rw-r--r-- | uhub/0002-Add-a-default-MOTD-file-which-was-missing.patch | 21 | ||||
-rw-r--r-- | uhub/0003-Most-unices-including-most-Linux-distro-have-logrota.patch | 78 | ||||
-rw-r--r-- | uhub/0004-Conditionally-install-systemd-support-files.patch | 65 | ||||
-rw-r--r-- | uhub/0005-Also-install-users.conf.patch | 26 | ||||
-rw-r--r-- | uhub/uhub.spec | 148 |
6 files changed, 544 insertions, 0 deletions
diff --git a/uhub/0001-Install-man-pages.patch b/uhub/0001-Install-man-pages.patch new file mode 100644 index 0000000..04bdf66 --- /dev/null +++ b/uhub/0001-Install-man-pages.patch @@ -0,0 +1,206 @@ +From ecefce8b7466e4866a47587df4a1364f4f250c5e Mon Sep 17 00:00:00 2001 +From: "Christoph J. Thompson" <cjsthompson@gmail.com> +Date: Sat, 13 Dec 2014 22:08:00 +0100 +Subject: [PATCH 1/5] * Install man pages * Support multilib distros such as + fedora/slackware + + modified: CMakeLists.txt + renamed: doc/plugins.conf -> doc/plugins.conf.in +--- + CMakeLists.txt | 14 ++++++++--- + doc/plugins.conf | 72 ----------------------------------------------------- + doc/plugins.conf.in | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 82 insertions(+), 76 deletions(-) + delete mode 100644 doc/plugins.conf + create mode 100644 doc/plugins.conf.in + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2f3941d..80a1a85 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -22,6 +22,12 @@ option(USE_OPENSSL "Use OpenSSL's SSL support" ON ) + option(SYSTEMD_SUPPORT "Enable systemd notify and journal logging" OFF) + option(ADC_STRESS "Enable the stress tester client" OFF) + ++set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") ++set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") ++set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages") ++ ++configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/plugins.conf.in plugins.conf @ONLY) ++ + find_package(Git) + find_package(Sqlite3) + +@@ -240,9 +246,9 @@ if (LOWLEVEL_DEBUG) + endif() + + if (UNIX) +- install( TARGETS uhub uhub-passwd RUNTIME DESTINATION bin ) +- install( TARGETS mod_example mod_welcome mod_logging mod_auth_simple mod_auth_sqlite mod_chat_history mod_chat_history_sqlite mod_chat_only mod_topic mod_no_guest_downloads DESTINATION /usr/lib/uhub/ OPTIONAL ) +- install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.conf ${CMAKE_SOURCE_DIR}/doc/plugins.conf ${CMAKE_SOURCE_DIR}/doc/rules.txt ${CMAKE_SOURCE_DIR}/doc/motd.txt DESTINATION /etc/uhub OPTIONAL ) ++ install( TARGETS uhub uhub-passwd RUNTIME DESTINATION ${INSTALL_BIN_DIR} ) ++ install( TARGETS mod_example mod_welcome mod_logging mod_auth_simple mod_auth_sqlite mod_chat_history mod_chat_history_sqlite mod_chat_only mod_topic mod_no_guest_downloads DESTINATION ${INSTALL_LIB_DIR}/uhub/ OPTIONAL ) ++ install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.conf ${CMAKE_SOURCE_DIR}/plugins.conf ${CMAKE_SOURCE_DIR}/doc/rules.txt ${CMAKE_SOURCE_DIR}/doc/motd.txt DESTINATION /etc/uhub/ OPTIONAL ) ++ install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.1 ${CMAKE_SOURCE_DIR}/doc/uhub-passwd.1 DESTINATION ${INSTALL_MAN_DIR}/man1/ OPTIONAL ) + endif() + +- +diff --git a/doc/plugins.conf b/doc/plugins.conf +deleted file mode 100644 +index 6e5a9a0..0000000 +--- a/doc/plugins.conf ++++ /dev/null +@@ -1,72 +0,0 @@ +-# ATTENTION! +-# Plugins are invoked in the order of listing in the plugin config file. +- +- +-# Sqlite based user authentication. +-# +-# This plugin provides a Sqlite based authentication database for +-# registered users. +-# Use the uhub-passwd utility to create the database and add/remove users. +-# +-# Parameters: +-# file: path/filename for database. +-# +-plugin /usr/lib/uhub/mod_auth_sqlite.so "file=/etc/uhub/users.db" +- +-# Topic commands. +-# Note: "topic" == "hub description" (as configured in uhub.conf) +-# +-# !topic - change the topic (op required) +-# !showtopic - show the topic +-# !resettopic - reset the topic to the default (op required) +-# +-# This plugins takes no parameters. +-#plugin /usr/lib/uhub/mod_topic.so +- +-# Log file writer +-# +-# Parameters: +-# file: path/filename for log file. +-# syslog: if true then syslog is used instead of writing to a file (Unix only) +-plugin /usr/lib/uhub/mod_logging.so "file=/var/log/uhub.log" +- +-# A simple example plugin +-#plugin /usr/lib/uhub/mod_example.so +- +-# A plugin sending a welcome message. +-# +-# This plugin provides the following commands: +-# !motd - Message of the day +-# !rules - Show hub rules. +-# +-# Parameters: +-# motd: path/filename for the welcome message (message of the day) +-# rules: path/filenam for the rules file +-# +-# NOTE: The files MUST exist, however if you do not wish to provide one then these parameters can be omitted. +-# +-# The motd/rules files can do the following substitutions: +-# %n - Nickname of the user who entered the hub or issued the command. +-# %a - IP address of the user +-# %c - The credentials of the user (guest, user, op, super, admin). +-# %% - Becomes '%' +-# %H - Hour 24-hour format (00-23) (Hub local time) +-# %I - Hour 12-hour format (01-12) (Hub local time) +-# %P - 'AM' or 'PM' +-# %p - 'am' or 'pm' +-# %M - Minutes (00-59) (Hub local time) +-# %S - Seconds (00-60) (Hub local time) +-plugin /usr/lib/uhub/mod_welcome.so "motd=/etc/uhub/motd.txt rules=/etc/uhub/rules.txt" +- +-# Load the chat history plugin. +-# +-# This plugin provides chat history when users are connecting, or +-# when users invoke the !history command. +-# The history command can optionally take a parameter to indicate how many lines of history is requested. +-# +-# Parameters: +-# history_max: the maximum number of messages to keep in history +-# history_default: when !history is provided without arguments, then this default number of messages are returned. +-# history_connect: the number of chat history messages to send when users connect (0 = do not send any history) +-plugin /usr/lib/uhub/mod_chat_history.so "history_max=200 history_default=10 history_connect=5" +- +diff --git a/doc/plugins.conf.in b/doc/plugins.conf.in +new file mode 100644 +index 0000000..873abcd +--- /dev/null ++++ b/doc/plugins.conf.in +@@ -0,0 +1,72 @@ ++# ATTENTION! ++# Plugins are invoked in the order of listing in the plugin config file. ++ ++ ++# Sqlite based user authentication. ++# ++# This plugin provides a Sqlite based authentication database for ++# registered users. ++# Use the uhub-passwd utility to create the database and add/remove users. ++# ++# Parameters: ++# file: path/filename for database. ++# ++plugin @INSTALL_LIB_DIR@/uhub/mod_auth_sqlite.so "file=/etc/uhub/users.db" ++ ++# Topic commands. ++# Note: "topic" == "hub description" (as configured in uhub.conf) ++# ++# !topic - change the topic (op required) ++# !showtopic - show the topic ++# !resettopic - reset the topic to the default (op required) ++# ++# This plugins takes no parameters. ++#plugin @INSTALL_LIB_DIR@/uhub/mod_topic.so ++ ++# Log file writer ++# ++# Parameters: ++# file: path/filename for log file. ++# syslog: if true then syslog is used instead of writing to a file (Unix only) ++plugin @INSTALL_LIB_DIR@/uhub/mod_logging.so "file=/var/log/uhub.log" ++ ++# A simple example plugin ++#plugin @INSTALL_LIB_DIR@/uhub/mod_example.so ++ ++# A plugin sending a welcome message. ++# ++# This plugin provides the following commands: ++# !motd - Message of the day ++# !rules - Show hub rules. ++# ++# Parameters: ++# motd: path/filename for the welcome message (message of the day) ++# rules: path/filenam for the rules file ++# ++# NOTE: The files MUST exist, however if you do not wish to provide one then these parameters can be omitted. ++# ++# The motd/rules files can do the following substitutions: ++# %n - Nickname of the user who entered the hub or issued the command. ++# %a - IP address of the user ++# %c - The credentials of the user (guest, user, op, super, admin). ++# %% - Becomes '%' ++# %H - Hour 24-hour format (00-23) (Hub local time) ++# %I - Hour 12-hour format (01-12) (Hub local time) ++# %P - 'AM' or 'PM' ++# %p - 'am' or 'pm' ++# %M - Minutes (00-59) (Hub local time) ++# %S - Seconds (00-60) (Hub local time) ++plugin @INSTALL_LIB_DIR@/uhub/mod_welcome.so "motd=/etc/uhub/motd.txt rules=/etc/uhub/rules.txt" ++ ++# Load the chat history plugin. ++# ++# This plugin provides chat history when users are connecting, or ++# when users invoke the !history command. ++# The history command can optionally take a parameter to indicate how many lines of history is requested. ++# ++# Parameters: ++# history_max: the maximum number of messages to keep in history ++# history_default: when !history is provided without arguments, then this default number of messages are returned. ++# history_connect: the number of chat history messages to send when users connect (0 = do not send any history) ++plugin @INSTALL_LIB_DIR@/uhub/mod_chat_history.so "history_max=200 history_default=10 history_connect=5" ++ +-- +2.1.3 + diff --git a/uhub/0002-Add-a-default-MOTD-file-which-was-missing.patch b/uhub/0002-Add-a-default-MOTD-file-which-was-missing.patch new file mode 100644 index 0000000..065a5d0 --- /dev/null +++ b/uhub/0002-Add-a-default-MOTD-file-which-was-missing.patch @@ -0,0 +1,21 @@ +From 33927d5b951ba97eab2bd0d8a37e2b7534f4ef08 Mon Sep 17 00:00:00 2001 +From: "Christoph J. Thompson" <cjsthompson@gmail.com> +Date: Sat, 13 Dec 2014 22:22:44 +0100 +Subject: [PATCH 2/5] * Add a default MOTD file which was missing + + new file: doc/motd.txt +--- + doc/motd.txt | 1 + + 1 file changed, 1 insertion(+) + create mode 100644 doc/motd.txt + +diff --git a/doc/motd.txt b/doc/motd.txt +new file mode 100644 +index 0000000..8db1118 +--- /dev/null ++++ b/doc/motd.txt +@@ -0,0 +1 @@ ++The admin didn't edit the default MOTD. +-- +2.1.3 + diff --git a/uhub/0003-Most-unices-including-most-Linux-distro-have-logrota.patch b/uhub/0003-Most-unices-including-most-Linux-distro-have-logrota.patch new file mode 100644 index 0000000..7e3f371 --- /dev/null +++ b/uhub/0003-Most-unices-including-most-Linux-distro-have-logrota.patch @@ -0,0 +1,78 @@ +From 1bdc47aa519b873b71ede1ce064a758e8cb6d468 Mon Sep 17 00:00:00 2001 +From: "Christoph J. Thompson" <cjsthompson@gmail.com> +Date: Sat, 13 Dec 2014 22:56:02 +0100 +Subject: [PATCH 3/5] * Most unices including most Linux distro have logrotate + + modified: CMakeLists.txt + deleted: doc/init.d.RedHat/etc/logrotate.d/uhub + new file: doc/uhub.logrotate + modified: doc/uhub.spec +--- + CMakeLists.txt | 1 + + doc/init.d.RedHat/etc/logrotate.d/uhub | 14 -------------- + doc/uhub.logrotate | 7 +++++++ + doc/uhub.spec | 2 +- + 4 files changed, 9 insertions(+), 15 deletions(-) + delete mode 100644 doc/init.d.RedHat/etc/logrotate.d/uhub + create mode 100644 doc/uhub.logrotate + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 80a1a85..c879185 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -250,5 +250,6 @@ if (UNIX) + install( TARGETS mod_example mod_welcome mod_logging mod_auth_simple mod_auth_sqlite mod_chat_history mod_chat_history_sqlite mod_chat_only mod_topic mod_no_guest_downloads DESTINATION ${INSTALL_LIB_DIR}/uhub/ OPTIONAL ) + install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.conf ${CMAKE_SOURCE_DIR}/plugins.conf ${CMAKE_SOURCE_DIR}/doc/rules.txt ${CMAKE_SOURCE_DIR}/doc/motd.txt DESTINATION /etc/uhub/ OPTIONAL ) + install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.1 ${CMAKE_SOURCE_DIR}/doc/uhub-passwd.1 DESTINATION ${INSTALL_MAN_DIR}/man1/ OPTIONAL ) ++ install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.logrotate DESTINATION /etc/logrotate.d/ RENAME uhub OPTIONAL ) + endif() + +diff --git a/doc/init.d.RedHat/etc/logrotate.d/uhub b/doc/init.d.RedHat/etc/logrotate.d/uhub +deleted file mode 100644 +index a0849cb..0000000 +--- a/doc/init.d.RedHat/etc/logrotate.d/uhub ++++ /dev/null +@@ -1,14 +0,0 @@ +-# Log rotate for Uhub +-# see man logrotate +-# +-# +-/var/log/uhub.log { +- compress +- size 10M +- rotate 10 +- missingok +- notifempty +- +- +-} +- +diff --git a/doc/uhub.logrotate b/doc/uhub.logrotate +new file mode 100644 +index 0000000..73142f9 +--- /dev/null ++++ b/doc/uhub.logrotate +@@ -0,0 +1,7 @@ ++/var/log/uhub.log { ++ compress ++ size 10M ++ rotate 10 ++ missingok ++ notifempty ++} +diff --git a/doc/uhub.spec b/doc/uhub.spec +index 7a487f9..9574015 100644 +--- a/doc/uhub.spec ++++ b/doc/uhub.spec +@@ -49,7 +49,7 @@ install uhub-passwd $RPM_BUILD_ROOT/usr/bin/ + install -m644 doc/uhub.conf doc/users.conf doc/rules.txt doc/motd.txt doc/plugins.conf doc/users.db $RPM_BUILD_ROOT/etc/uhub + install doc/init.d.RedHat/etc/init.d/uhub $RPM_BUILD_ROOT/etc/init.d + install -m644 doc/init.d.RedHat/etc/sysconfig/uhub $RPM_BUILD_ROOT/etc/sysconfig/ +-install -m644 doc/init.d.RedHat/etc/logrotate.d/uhub $RPM_BUILD_ROOT/etc/logrotate.d/ ++install -m644 doc/uhub.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/ + /bin/gzip -9c doc/uhub.1 > doc/uhub.1.gz && + install -m644 doc/uhub.1.gz $RPM_BUILD_ROOT/usr/share/man/man1 + install -m644 mod_*.so $RPM_BUILD_ROOT/usr/lib/uhub +-- +2.1.3 + diff --git a/uhub/0004-Conditionally-install-systemd-support-files.patch b/uhub/0004-Conditionally-install-systemd-support-files.patch new file mode 100644 index 0000000..9accb57 --- /dev/null +++ b/uhub/0004-Conditionally-install-systemd-support-files.patch @@ -0,0 +1,65 @@ +From f645797aeced86ce78d2ad7d0c9cf869e1200b3a Mon Sep 17 00:00:00 2001 +From: "Christoph J. Thompson" <cjsthompson@gmail.com> +Date: Sat, 13 Dec 2014 23:09:53 +0100 +Subject: [PATCH 4/5] * Conditionally install systemd support files + + modified: CMakeLists.txt + new file: doc/uhub.service + new file: doc/uhub.tmpfiles +--- + CMakeLists.txt | 7 +++++++ + doc/uhub.service | 16 ++++++++++++++++ + doc/uhub.tmpfiles | 1 + + 3 files changed, 24 insertions(+) + create mode 100644 doc/uhub.service + create mode 100644 doc/uhub.tmpfiles + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c879185..d08310e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -251,5 +251,12 @@ if (UNIX) + install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.conf ${CMAKE_SOURCE_DIR}/plugins.conf ${CMAKE_SOURCE_DIR}/doc/rules.txt ${CMAKE_SOURCE_DIR}/doc/motd.txt DESTINATION /etc/uhub/ OPTIONAL ) + install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.1 ${CMAKE_SOURCE_DIR}/doc/uhub-passwd.1 DESTINATION ${INSTALL_MAN_DIR}/man1/ OPTIONAL ) + install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.logrotate DESTINATION /etc/logrotate.d/ RENAME uhub OPTIONAL ) ++ ++ if(SYSTEMD_SUPPORT) ++ install ( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.service DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/systemd/system/ OPTIONAL ) ++ install ( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.tmpfiles DESTINATION ++${CMAKE_INSTALL_PREFIX}/lib/tmpfiles.d/ RENAME uhub.conf OPTIONAL ) ++ endif() ++ + endif() + +diff --git a/doc/uhub.service b/doc/uhub.service +new file mode 100644 +index 0000000..24d922d +--- /dev/null ++++ b/doc/uhub.service +@@ -0,0 +1,16 @@ ++[Unit] ++Description=uHub ADC hub Server ++Documentation=man:uhub(1) ++After=network.target ++ ++[Service] ++Type=simple ++User=uhub ++ExecStart=/usr/bin/uhub -p /run/uhub/uhub.pid ++ExecReload=/usr/bin/uhub -C ; \ ++ /bin/kill -HUP $MAINPID ++StandardError=journal ++ ++[Install] ++WantedBy=multi-user.target ++ +diff --git a/doc/uhub.tmpfiles b/doc/uhub.tmpfiles +new file mode 100644 +index 0000000..c548637 +--- /dev/null ++++ b/doc/uhub.tmpfiles +@@ -0,0 +1 @@ ++d /run/uhub 0755 uhub uhub +-- +2.1.3 + diff --git a/uhub/0005-Also-install-users.conf.patch b/uhub/0005-Also-install-users.conf.patch new file mode 100644 index 0000000..e7a275b --- /dev/null +++ b/uhub/0005-Also-install-users.conf.patch @@ -0,0 +1,26 @@ +From d01031c4a4169d515855d8765b872e09a2f45eef Mon Sep 17 00:00:00 2001 +From: "Christoph J. Thompson" <cjsthompson@gmail.com> +Date: Sat, 13 Dec 2014 23:15:50 +0100 +Subject: [PATCH 5/5] * Also install users.conf + + modified: CMakeLists.txt +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d08310e..97355b1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -248,7 +248,7 @@ endif() + if (UNIX) + install( TARGETS uhub uhub-passwd RUNTIME DESTINATION ${INSTALL_BIN_DIR} ) + install( TARGETS mod_example mod_welcome mod_logging mod_auth_simple mod_auth_sqlite mod_chat_history mod_chat_history_sqlite mod_chat_only mod_topic mod_no_guest_downloads DESTINATION ${INSTALL_LIB_DIR}/uhub/ OPTIONAL ) +- install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.conf ${CMAKE_SOURCE_DIR}/plugins.conf ${CMAKE_SOURCE_DIR}/doc/rules.txt ${CMAKE_SOURCE_DIR}/doc/motd.txt DESTINATION /etc/uhub/ OPTIONAL ) ++ install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.conf ${CMAKE_SOURCE_DIR}/plugins.conf ${CMAKE_SOURCE_DIR}/doc/users.conf ${CMAKE_SOURCE_DIR}/doc/rules.txt ${CMAKE_SOURCE_DIR}/doc/motd.txt DESTINATION /etc/uhub/ OPTIONAL ) + install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.1 ${CMAKE_SOURCE_DIR}/doc/uhub-passwd.1 DESTINATION ${INSTALL_MAN_DIR}/man1/ OPTIONAL ) + install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.logrotate DESTINATION /etc/logrotate.d/ RENAME uhub OPTIONAL ) + +-- +2.1.3 + 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. |