From 9542aab497039cd308835bdba3538994cfe0b8a157dba1d9a654c2c03114b4f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=C4=9Bzslav=20=C4=8C=C3=AD=C5=BEek?= Date: Fri, 3 Jul 2015 07:55:09 +0000 Subject: [PATCH] Accepting request 312678 from home:thehejik:branches:server:http Please check and forward to Factory, requested by bnc#899218 - package cleanup (bnc#899218) * removed SUSE branding * added logrotate support * changed note about default codepage OBS-URL: https://build.opensuse.org/request/show/312678 OBS-URL: https://build.opensuse.org/package/show/server:http/thttpd?expand=0&rev=31 --- thttpd-SuSE.tar.bz2 | 3 -- thttpd-initd.script | 86 +++++++++++++++++++++++++++++++++++++++++++++ thttpd.changes | 8 +++++ thttpd.conf | 70 ++++++++++++++++++++++++++++++++++++ thttpd.logrotate | 10 ++++++ thttpd.spec | 44 +++++++++++------------ 6 files changed, 194 insertions(+), 27 deletions(-) delete mode 100644 thttpd-SuSE.tar.bz2 create mode 100644 thttpd-initd.script create mode 100644 thttpd.conf create mode 100644 thttpd.logrotate diff --git a/thttpd-SuSE.tar.bz2 b/thttpd-SuSE.tar.bz2 deleted file mode 100644 index e67ead3..0000000 --- a/thttpd-SuSE.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:eee1ce423ec3f6ecd7bd4ceca7bef9cdf5a07f21fca5a8acbac8e152bdc26cbc -size 133331 diff --git a/thttpd-initd.script b/thttpd-initd.script new file mode 100644 index 0000000..e050c4b --- /dev/null +++ b/thttpd-initd.script @@ -0,0 +1,86 @@ +#! /bin/sh +# Copyright (c) 1996-1999 SuSE Gmbh Nuernberg, Germany. All rights reserved. +# +# /etc/init.d/thttpd +# +### BEGIN INIT INFO +# Provides: thttpd +# Required-Start: $network $remote_fs $syslog +# Required-Stop: $network $remote_fs $syslog +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: thttpd +# Description: Starts the http daemon thttpd +### END INIT INFO + +THTTPD_BIN=/usr/sbin/thttpd +test -x $THTTPD_BIN || exit 5 + +. /etc/rc.status + +rc_reset + +# Return values acc. to LSB for all commands but status: +# 0 - success +# 1 - generic or unspecified error +# 2 - invalid or excess argument(s) +# 3 - unimplemented feature (e.g. "reload") +# 4 - insufficient privilege +# 5 - program is not installed +# 6 - program is not configured +# 7 - program is not running +# +# Note that starting an already running service, stopping +# or restarting a not-running service as well as the restart +# with force-reload (in case signalling is not supported) are +# considered a success. + +case "$1" in + start) + echo -n "Starting service thttpd" + startproc $THTTPD_BIN -C /etc/thttpd.conf + rc_status -v + ;; + stop) + echo -n "Shutting down service thttpd" + killproc -TERM $THTTPD_BIN + rc_status -v + ;; + try-restart) + ## Stop the service and if this succeeds (i.e. the + ## service was running before), start it again. + $0 status >/dev/null && $0 restart + # Remember status and be quiet + rc_status + ;; + force-reload) + ## Stop the service and if this succeeds (i.e. the + ## service was running before), start it again. + $0 stop && sleep 1 && $0 start + # Remember status and be quiet + rc_status + ;; + restart) + $0 stop + sleep 1 + $0 start + rc_status + ;; + reload) + rc_failed 3 + rc_status -v + ;; + status) + echo -n "Checking for service thttpd: " + checkproc $THTTPD_BIN + rc_status -v + ;; + probe) + # + ;; + *) + echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" + exit 1 +esac +rc_exit + diff --git a/thttpd.changes b/thttpd.changes index 4d38641..5fde36c 100644 --- a/thttpd.changes +++ b/thttpd.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Jun 18 15:07:51 UTC 2015 - thehejik@suse.com + +- package cleanup (bnc#899218) + * removed SUSE branding + * added logrotate support + * changed note about default codepage + ------------------------------------------------------------------- Thu Jun 4 15:09:12 UTC 2015 - vcizek@suse.com diff --git a/thttpd.conf b/thttpd.conf new file mode 100644 index 0000000..31fe409 --- /dev/null +++ b/thttpd.conf @@ -0,0 +1,70 @@ +# thttpd.conf -- configuration file for thttpd +# +# The strategy used is similar to e.g. OpenSSH: +# specify options with their default value where possible, +# but leave them commented. Uncommented options change +# a default value. Parenthesis state the command line option + +# Port to listen on (-p) +#port=80 + +# www root directory (-d) +dir=/srv/www/htdocs + +# The eternal question whether to chroot() or not to chroot() +# into "dir" above. If you don't want thttpd to chroot() change +# the next line to "nochroot" (-r|-nor) +#chroot + +# data directory in the chroot dir +# as the default configuration just chroots into "dir" +# we leave this unset. Use it for running more complex webs with +# thttpd (note, that at some point something more robust +# (e.g. apache)might be a better choice). (-dd) +#data_dir= + +# Instructs thttpd to check whether symlinked documents really +# belong to the document tree. Disable with "nosymlinkcheck", +# although this is not recommended (-s|-nos) +#symlinkcheck + +# "El-cheapo" webhosting, enable with "vhost" (-v|-nov) +#novhost + +# Use server-global .htpasswd file (see man page). Enable with +# "globalpasswd" (-g|-nog) +#noglobalpasswd + +# User to switch to after initialization when started as root +# (-u) +#user=wwwrun + +# CGI scripts pattern (-c) +#cgipat=/cgi-bin/*|**.cgi + +# File of throttle settings (-t) - see manpage +#throttles= + +# Hostname to bind to for multihoming (-h) +#host=your.hostname.here + +# Log-file; empty = use syslog(), /dev/null = without log. (-l) +logfile=/var/log/thttpd.log + +# File to write the process-id to (-i), can be used for signalling +# thttpd +pidfile=/var/run/thttpd.pid + +# Character set to use with text MIME types. +# Defaults to UTF-8 (-t) +#charset= + +# P3P server privacy header is returned with all responses +# (see manpage). Use p3p to enable it (-P|-noP) +## + +# seconds to be used in a "Cache-Control: max-age" header and +# generates equivalent Expires meta tag +#max_age= + +# -- end of thttpd.conf diff --git a/thttpd.logrotate b/thttpd.logrotate new file mode 100644 index 0000000..0f1515f --- /dev/null +++ b/thttpd.logrotate @@ -0,0 +1,10 @@ +/var/log/thttpd.log { + compress + dateext + maxage 365 + rotate 99 + size=+4096k + notifempty + missingok + copytruncate +} diff --git a/thttpd.spec b/thttpd.spec index 9eba1fc..a03250a 100644 --- a/thttpd.spec +++ b/thttpd.spec @@ -16,6 +16,7 @@ # +%define serverroot /srv/www %if 0%{?suse_version} > 1220 %define with_systemd 1 %else @@ -29,8 +30,10 @@ License: BSD-3-Clause Group: Productivity/Networking/Web/Servers Url: http://www.acme.com/software/thttpd/ Source: %{name}-%{version}.tar.gz -Source1: %{name}-SuSE.tar.bz2 +Source1: %{name}-initd.script Source2: %{name}.service +Source3: %{name}.logrotate +Source4: %{name}.conf Patch0: %{name}-2.25b-configure.patch Patch1: %{name}-2.25b-dirs.patch Patch2: %{name}-2.25b-time_h.patch @@ -50,9 +53,10 @@ Patch15: thttpd-crypt_is_in_crypt.h.patch BuildRequires: automake BuildRequires: libtool Requires(post): permissions -Provides: http_daemon +Recommends: logrotate # both packages provide /usr/bin/htpasswd Conflicts: apache2-utils +Provides: http_daemon BuildRoot: %{_tmppath}/%{name}-%{version}-build %if %{with_systemd} BuildRequires: systemd @@ -70,10 +74,8 @@ in memory use. Basic support for cgi scripts, authentication, and ssi is provided for. Advanced features include the ability to throttle traffic. -%define serverroot /srv/www - %prep -%setup -q -a 1 +%setup -q %patch0 %patch1 %patch2 @@ -92,24 +94,17 @@ traffic. %build cp %{_datadir}/automake-1.*/config.* . -# update server root path -sed -i "s@__SRVROOT__@%{serverroot}/htdocs@g" README.SuSE SuSE%{_sysconfdir}/thttpd.conf -sed -i "s@__PREFIX__@%{_prefix}@g;\ - s@__SYSCONFDIR__@%{_sysconfdir}@g;\ - s@__NAME__@%{name}@g;\ - s@__VERSION__@%{version}@g" SuSE%{_initddir}/thttpd -chmod 744 SuSE%{_initddir}/thttpd -chmod 644 SuSE%{_sysconfdir}/thttpd.conf mv aclocal.m4 acinclude.m4 libtoolize --force aclocal --force autoconf -f -V_CCOPT="%{optflags} -Wall" \ +export V_CCOPT="%{optflags}" +export CFLAGS="%{optflags}" %configure %ifarch s390 s390x -make F_PIE="-fPIE" %{?_smp_mflags} +make F_PIE="-fPIE" -j1 %else -make F_PIE="-fpie" %{?_smp_mflags} +make F_PIE="-fpie" -j1 %endif %install @@ -119,18 +114,18 @@ install -d %{buildroot}%{_bindir} \ %{buildroot}%{_mandir}/man8 \ %{buildroot}%{serverroot}/htdocs/users make DESTDIR=%{buildroot} install %{?_smp_mflags} -cp -a SuSE/* %{buildroot} -rm -f %{buildroot}%{serverroot}/htdocs/index.html +install -D -m0644 index.html %{buildroot}/%{serverroot}/htdocs/index.html +install -D -m0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/%{name}.conf +install -D -m0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} %if %{with_systemd} -rm -rf %{buildroot}%{_sysconfdir}/init.d -rm %{buildroot}%{_sbindir}/rc%{name} -mkdir -p %{buildroot}%{_unitdir} -install -m 644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service +install -D -m0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name} +%else +install -D -m0644 %{SOURCE1} %{buildroot}%{_initddir}/%{name} +ln -s %{buildroot}%{_initddir}/%{name} %{buildroot}%{_sbindir}/rc%{name} %endif %if %{with_systemd} - %pre %service_add_pre %{name}.service %endif @@ -167,13 +162,14 @@ ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name} %files %defattr(-, root, root) -%doc README README.SuSE config.h +%doc README config.h %{serverroot}/htdocs/* %attr(775, root, www) %{serverroot}/htdocs/users %verify(not mode) %attr(2750, root, www) %{_bindir}/makeweb %{_bindir}/htpasswd %{_sbindir}/* %{_mandir}/*/* +%config %{_sysconfdir}/logrotate.d/%{name} %if %{with_systemd} %{_unitdir}/%{name}.service %else