From 20ac984707d9e5c1fa18efc6946965f18cc92b8c Mon Sep 17 00:00:00 2001 From: Mukund Sivaraman Date: Thu, 19 Jun 2008 21:59:16 +0530 Subject: [PATCH] Add new Fedora packaging files These spec files were made by Jeremy Hinegardner and backported from master to the 1.6 branch by me. X-Banu-Bugzilla-Ids: 11 --- Makefile.am | 2 +- packaging/Makefile.am | 5 ++ packaging/fedora/.gitignore | 1 + packaging/fedora/Makefile.am | 9 +++ packaging/fedora/tinyproxy.init | 106 +++++++++++++++++++++++++++++ packaging/fedora/tinyproxy.spec.in | 92 +++++++++++++++++++++++++ 6 files changed, 214 insertions(+), 1 deletion(-) create mode 100644 packaging/Makefile.am create mode 100644 packaging/fedora/.gitignore create mode 100644 packaging/fedora/Makefile.am create mode 100644 packaging/fedora/tinyproxy.init create mode 100644 packaging/fedora/tinyproxy.spec.in diff --git a/Makefile.am b/Makefile.am index dc9c996..3246b6b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ EXTRA_DIST = $(CONFIG_FILES) TODO autogen.sh -SUBDIRS = src doc +SUBDIRS = src doc packaging install-data-local: tinyproxy-configure-file tinyproxy-html-files diff --git a/packaging/Makefile.am b/packaging/Makefile.am new file mode 100644 index 0000000..6fc8a1c --- /dev/null +++ b/packaging/Makefile.am @@ -0,0 +1,5 @@ + +# The various packaging directories + +SUBDIRS = fedora + diff --git a/packaging/fedora/.gitignore b/packaging/fedora/.gitignore new file mode 100644 index 0000000..b8b2953 --- /dev/null +++ b/packaging/fedora/.gitignore @@ -0,0 +1 @@ +tinyproxy.spec diff --git a/packaging/fedora/Makefile.am b/packaging/fedora/Makefile.am new file mode 100644 index 0000000..f3b4a7b --- /dev/null +++ b/packaging/fedora/Makefile.am @@ -0,0 +1,9 @@ + +# Packaging files + +PACKAGING_FILES = \ + tinyproxy.init \ + tinyproxy.spec + +EXTRA_DIST = $(PACKAGING_FILES) + diff --git a/packaging/fedora/tinyproxy.init b/packaging/fedora/tinyproxy.init new file mode 100644 index 0000000..9209674 --- /dev/null +++ b/packaging/fedora/tinyproxy.init @@ -0,0 +1,106 @@ +#!/bin/sh +# +# tinyproxy Startup script for the tinyproxy server +# +# chkconfig: - 85 15 +# description: small, efficient HTTP/SSL proxy daemon +# +# processname: tinyproxy +# config: /etc/tinyproxy/tinyproxy.conf +# config: /etc/sysconfig/tinyproxy +# pidfile: /var/run/tinyproxy.pid +# +# Note: pidfile is created by tinyproxy in its config +# see PidFile in the configuration file. + +# Source function library. +. /etc/rc.d/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +# Check that networking is up. +[ "$NETWORKING" = "no" ] && exit 0 + +exec="/usr/sbin/tinyproxy" +prog=$(basename $exec) +config="/etc/tinyproxy/tinyproxy.conf" + +[ -e /etc/sysconfig/tinyproxy ] && . /etc/sysconfig/tinyproxy + +lockfile=/var/lock/subsys/tinyproxy + +start() { + [ -x $exec ] || exit 5 + [ -f $config ] || exit 6 + echo -n $"Starting $prog: " + daemon $exec -c $config + retval=$? + echo + [ $retval -eq 0 ] && touch $lockfile + return $retval +} + +stop() { + echo -n $"Stopping $prog: " + # stop it here, often "killproc $prog" + killproc $prog + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + stop + start +} + +reload() { + restart +} + +force_reload() { + restart +} + +rh_status() { + status $prog +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + +case "$1" in + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + exit 2 +esac +exit $? + diff --git a/packaging/fedora/tinyproxy.spec.in b/packaging/fedora/tinyproxy.spec.in new file mode 100644 index 0000000..d228081 --- /dev/null +++ b/packaging/fedora/tinyproxy.spec.in @@ -0,0 +1,92 @@ +%define tinyproxy_confdir %{_sysconfdir}/tinyproxy +%define tinyproxy_datadir %{_datadir}/tinyproxy + +Name: tinyproxy +Version: @VERSION@ +Release: 2%{?dist} +Summary: A small, efficient HTTP/SSL proxy daemon + +Group: System Environment/Daemons +License: GPLv2+ +URL: http://tinyproxy.banu.com/ +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +Source0: http://files.banu.com/pub/tinyproxy/1.6/%{name}-%{version}.tar.gz +Source1: %{name}.init +Source2: %{name}.conf + +Requires(post): chkconfig +Requires(preun): chkconfig +Requires(preun): initscripts + +%description +tinyproxy is a small, efficient HTTP/SSL proxy daemon released under the +GNU General Public License (GPL). tinyproxy is very useful in a small +network setting, where a larger proxy like Squid would either be too +resource intensive, or a security risk. + +%prep +%setup -q + + +%build +%configure --with-config=%{tinyproxy_confdir}/%{name}.conf +make %{?_smp_mflags} + + +%install +rm -rf %{buildroot} +make install-exec DESTDIR=%{buildroot} + +# The default 'make install' installs too many items, so we trim it down +# and install manually +%{__install} -p -D -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/%{name} +%{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{tinyproxy_confdir}/%{name}.conf +%{__install} -d -m 0755 %{buildroot}%{tinyproxy_datadir} +%{__install} -p -D -m 0644 ./doc/%{name}.8 %{buildroot}%{_mandir}/man8/%{name}.8 + +for htmlfile in $(find ./doc/ -type f -name '*.html') +do + %{__install} -p -m 0644 $htmlfile %{buildroot}%{tinyproxy_datadir} +done + +%clean +rm -rf %{buildroot} + + +%post +/sbin/chkconfig --add %{name} + + +%preun +if [ $1 = 0 ]; then + /sbin/service %{name} stop >/dev/null 2>&1 + /sbin/chkconfig --del %{name} +fi + + +%postun +if [ "$1" -ge "1" ]; then + /sbin/service %{name} condrestart > /dev/null 2>&1 || : +fi + + + +%files +%defattr(-,root,root,-) +%doc AUTHORS COPYING README doc/*.txt +%{_sbindir}/%{name} +%{_mandir}/man8/%{name}.8.gz +%{_initrddir}/%{name} +%dir %{tinyproxy_datadir} +%dir %{tinyproxy_datadir}/* +%dir %{tinyproxy_confdir} +%config(noreplace) %{tinyproxy_confdir}/%{name}.conf + +%changelog +* Wed Apr 16 2008 Jeremy Hinegardner - 1.6.3-2 +- fix spec review issues +- fix initscript + +* Sun Mar 09 2008 Jeremy Hinegardner - 1.6.3-1 +- Initial rpm configuration