Sync Fedora initscript and specfile

This commit is contained in:
Jeremy Hinegardner 2008-05-01 19:47:58 +05:30 committed by Mukund Sivaraman
parent b110332ed3
commit fa7ecaca6d
2 changed files with 61 additions and 36 deletions

View File

@ -1,25 +1,17 @@
#!/bin/sh
#
# tinyproxy
# 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
# http://fedoraproject.org/wiki/FCNewInit/Initscripts
### BEGIN INIT INFO
# Provides:
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop:
# Short-Description:
# Description:
### END INIT INFO
#
# Note: pidfile is created by tinyproxy in its config
# see PidFile in the configuration file.
# Source function library.
. /etc/rc.d/init.d/functions
@ -32,14 +24,17 @@
exec="/usr/sbin/tinyproxy"
prog=$(basename $exec)
config="/etc/tinyproxy/tinyproxy.conf"
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
[ -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
daemon $exec -c $config
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
@ -61,29 +56,51 @@ restart() {
start
}
reload() {
restart
}
force_reload() {
restart
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start|stop|restart|reload)
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)
restart
force_reload
;;
status)
status $prog
rh_status
;;
try-restart|condrestart)
if status $prog >/dev/null ; then
condrestart|try-restart)
rh_status_q || exit 0
restart
fi
;;
reload)
# If config can be reloaded without restarting, implement it here,
# remove the "exit", and add "reload" to the usage message below.
action $"Service $prog does not support the reload action: " /bin/false
exit 3
;;
*)
echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
exit 2
;;
esac
exit $?

View File

@ -3,7 +3,7 @@
Name: tinyproxy
Version: @VERSION@
Release: 1%{?dist}
Release: 2%{?dist}
Summary: A small, efficient HTTP/SSL proxy daemon
Group: System Environment/Daemons
@ -15,6 +15,10 @@ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.
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
@ -31,8 +35,8 @@ make %{?_smp_mflags}
%install
rm -rf $RPM_BUILD_ROOT
make install-exec DESTDIR=$RPM_BUILD_ROOT
rm -rf %{buildroot}
make install-exec DESTDIR=%{buildroot}
# The default 'make install' installs too many items, so we trim it down
# and install manually
@ -47,7 +51,7 @@ do
done
%clean
rm -rf $RPM_BUILD_ROOT
rm -rf %{buildroot}
%post
@ -62,7 +66,7 @@ fi
%postun
if [ $1 -ge 1 ]; then
if [ "$1" -ge "1" ]; then
/sbin/service %{name} condrestart > /dev/null 2>&1 || :
fi
@ -80,5 +84,9 @@ fi
%config(noreplace) %{tinyproxy_confdir}/%{name}.conf
%changelog
* Wed Apr 16 2008 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.6.3-2
- fix spec review issues
- fix initscript
* Sun Mar 09 2008 Jeremy Hinegardner <jeremy at hinegardner dot org> - 1.6.3-1
- Initial rpm configuration