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 #!/bin/sh
# #
# tinyproxy # tinyproxy Startup script for the tinyproxy server
# #
# chkconfig: - 85 15 # chkconfig: - 85 15
# description: small, efficient HTTP/SSL proxy daemon # description: small, efficient HTTP/SSL proxy daemon
#
# processname: tinyproxy # processname: tinyproxy
# config: /etc/tinyproxy/tinyproxy.conf # config: /etc/tinyproxy/tinyproxy.conf
# config: /etc/sysconfig/tinyproxy
# pidfile: /var/run/tinyproxy.pid # pidfile: /var/run/tinyproxy.pid
#
# http://fedoraproject.org/wiki/FCNewInit/Initscripts # Note: pidfile is created by tinyproxy in its config
### BEGIN INIT INFO # see PidFile in the configuration file.
# Provides:
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop:
# Short-Description:
# Description:
### END INIT INFO
# Source function library. # Source function library.
. /etc/rc.d/init.d/functions . /etc/rc.d/init.d/functions
@ -32,14 +24,17 @@
exec="/usr/sbin/tinyproxy" exec="/usr/sbin/tinyproxy"
prog=$(basename $exec) 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 lockfile=/var/lock/subsys/tinyproxy
start() { start() {
[ -x $exec ] || exit 5
[ -f $config ] || exit 6
echo -n $"Starting $prog: " echo -n $"Starting $prog: "
daemon $exec daemon $exec -c $config
retval=$? retval=$?
echo echo
[ $retval -eq 0 ] && touch $lockfile [ $retval -eq 0 ] && touch $lockfile
@ -61,29 +56,51 @@ restart() {
start start
} }
reload() {
restart
}
force_reload() {
restart
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in 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 $1
;; ;;
force-reload) force-reload)
restart force_reload
;; ;;
status) status)
status $prog rh_status
;; ;;
try-restart|condrestart) condrestart|try-restart)
if status $prog >/dev/null ; then rh_status_q || exit 0
restart 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 exit 2
;;
esac esac
exit $?

View File

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