%global webroot /var/www/thttpd %global _hardened_build 1 %global commit 2845bf5bff2b820d2336c8c8061cbfc5f271e720 %global gittag 2.27.1 %global shortcommit %(c=%{commit}; echo ${c:0:7}) Name: sthttpd Version: 2.27.1 Release: 1%{?dist} Summary: A fork of thttpd, a tiny/turbo/throttling HTTP server License: BSD URL: https://github.com/blueness/sthttpd Source0: https://github.com/blueness/%{name}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz Source1: thttpd.service Source2: thttpd.logrotate # https://github.com/blueness/sthttpd/pull/8 Patch0: sthttpd-warnings.patch BuildRequires: systemd BuildRequires: automake BuildRequires: autoconf BuildRequires: gcc %{?systemd_requires} %description Thttpd is a very compact no-frills httpd serving daemon that can handle very high loads. While lacking many of the advanced features of Apache, thttpd operates without forking and is extremely efficient in memory use. Basic support for cgi scripts, authentication, and ssi is provided for. Advanced features include the ability to throttle traffic. %prep %autosetup -p1 -n %{name}-%{commit} # https://github.com/blueness/sthttpd/pull/7 for man in docs/*.8 docs/*.1; do iconv -f iso8859-1 -t utf-8 -o tmp ${man} mv -f tmp ${man} done %build ./autogen.sh %configure /usr/bin/perl -pi -e 's/.*chgrp.*//g; s/.*chmod.*//g' extras/Makefile %make_build %install # Prepare required directories mkdir -p %{buildroot}%{webroot} \ %{buildroot}%{_mandir}/man{1,8} \ %{buildroot}%{_sbindir} \ %{buildroot}%{_bindir} \ %{buildroot}%{_unitdir} %make_install # Install init script and logrotate entry install -Dpm0644 %{SOURCE1} %{buildroot}%{_unitdir}/ install -Dpm0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/thttpd # Rename htpasswd so we don't conflict with apache. Move to bindir mv %{buildroot}%{_sbindir}/htpasswd %{buildroot}%{_bindir}/thtpasswd mv %{buildroot}%{_mandir}/man1/htpasswd.1 %{buildroot}%{_mandir}/man1/thtpasswd.1 # remove cgi-bin and related man pages rm -rf %{buildroot}/usr/local/www/cgi-bin rm -f %{buildroot}%{_mandir}/man8/ssi.8 rm -f %{buildroot}%{_mandir}/man8/redirect.8 # Put index.html in /var/www/httpd mv %{buildroot}/usr/local/www/index.html %{buildroot}%{webroot}/index.html # Install a default configuration file mkdir -p %{buildroot}%{_sysconfdir} cat << EOF > %{buildroot}%{_sysconfdir}/thttpd.conf # BEWARE : No empty lines are allowed! # This section overrides defaults dir=%{webroot} chroot user=thttpd # default = nobody logfile=/var/log/thttpd.log pidfile=/run/thttpd.pid # This section _documents_ defaults in effect # port=80 # nosymlink # default = !chroot # novhost # nocgipat # nothrottles # host=0.0.0.0 # charset=iso-8859-1 EOF %pre /usr/sbin/groupadd -r www &>/dev/null || : /usr/sbin/useradd -s /bin/false -c "Thttpd Web Server User" \ -d %{webroot} -M -r -g www thttpd &>/dev/null || : %post %systemd_post thttpd.service %preun %systemd_preun thttpd.service %postun %systemd_postun thttpd.service %files %doc README.md TODO %{_unitdir}/thttpd.service %config(noreplace) %{_sysconfdir}/logrotate.d/thttpd %config(noreplace) %{_sysconfdir}/thttpd.conf %{_bindir}/thtpasswd %if 0%{?_with_makeweb:1} %attr(2755,root,www) %{_sbindir}/makeweb %{_mandir}/man1/makeweb.1* %else %exclude %{_sbindir}/makeweb %exclude %{_mandir}/man1/makeweb.1* %endif %{_sbindir}/syslogtocern %{_sbindir}/thttpd %{webroot}/ %{_mandir}/man1/thtpasswd.1* %{_mandir}/man8/syslogtocern.8* %{_mandir}/man8/thttpd.8* # Hack to own parent directory for the default "webroot". Remove if needed. %dir /var/www %changelog * Thu Mar 08 2018 Matt Tyson - 2.27.0 - Created sthttpd package. Based on thttpd.