rpms/tor/devel tor.sysv,NONE,1.1 tor.spec,1.50,1.51

ensc ensc at fedoraproject.org
Sun Mar 28 21:15:13 UTC 2010


Author: ensc

Update of /cvs/extras/rpms/tor/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv18402

Modified Files:
	tor.spec 
Added Files:
	tor.sysv 
Log Message:
initial draft for sysv stuff



--- NEW FILE tor.sysv ---
#!/bin/bash
#
# Init file for tor - An Anonymizing overlay network for TCP
#
# chkconfig: - 99 01
# description:   An Anonymizing overlay network for TCP
#

. /etc/rc.d/init.d/functions

f=/etc/sysconfig/tor

TOR_SHUTDOWN_WAIT=30
TOR_OPTS=--quiet
TOR_PIDFILE=/var/run/tor/tor.pid
TOR_USER=toranon
test ! -r "$f" || . "$f"

prog="/usr/bin/tor"

lockfile=/var/lock/subsys/tor
pidfile=$TOR_PIDFILE

start() {
    echo -n $"Starting $prog: "
    daemon --pidfile="$pidfile" $prog --PIDFile "$pidfile" --RunAsDaemon 1 $TOR_OPTS || failure
    rc=$?
    test $rc -ne 0 || touch $lockfile
    return $rc
}

stop() {
    echo -n $"Stopping $prog: "
    if ! killproc -p "$pidfile" $prog -INT; then
	failure
    else
	cnt=$TOR_SHUTDOWN_WAIT
	while let '--cnt > 0' && killproc -p "$pidfile" $prog -0; do
	    sleep 1
	done

	if test $cnt -ne 0 || killproc -p "$pidfile" $prog; then
	    success
	else
	    failure
	fi
    fi

    rm -f $pidfile $lockfile
}

restart() {
    stop
    start
}

reload() {
    echo -n $"Reloading $prog: "
    killproc -p "$pidfile" $prog -HUP && success || failure || return 7
}

_status() {
    status -p $pidfile $prog
}

case $1 in
    (start|stop|reload|restart)
	$1
	;;
    (force-reload)
	restart
	;;
    (status)
	_status
	;;
    (condrestart|try-restart)
	if _status &>/dev/null; then
	    restart
	fi
	;;
    (*)
	echo $"Usage: $0 {start|stop|force-reload|reload|try-restart|status}"
	exit 3
esac


Index: tor.spec
===================================================================
RCS file: /cvs/extras/rpms/tor/devel/tor.spec,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -p -r1.50 -r1.51
--- tor.spec	18 Mar 2010 20:42:43 -0000	1.50
+++ tor.spec	28 Mar 2010 21:15:13 -0000	1.51
@@ -9,7 +9,7 @@
 %global logdir			%_var/log/%name
 
 %{?with_noarch:%global noarch	BuildArch:	noarch}
-%{!?release_func:%global release_func() %1%{?dist}}
+%{!?release_func:%global release_func() %%{?prerelease:0.}%1%%{?prerelease:.%%prerelease}%%{?dist}}
 
 Name:		tor
 Version:	0.2.1.25
@@ -47,6 +47,7 @@ Requires(postun):	/etc/logrotate.d
 Summary:	LSB initscripts for tor
 Group:		System Environment/Daemons
 Provides:	init(%name) = lsb
+Conflicts:	init(%name) = sysv
 Requires:	%name-core =  %version-%release
 Source10:	tor.lsb
 Requires(pre):		%name-core
@@ -56,6 +57,21 @@ Requires(preun):	lsb-core-noarch
 %{?noarch}
 
 
+%package sysv
+Summary:	Tor initscripts for Red Hat's proprietary initsystem
+Group:		System Environment/Daemons
+Provides:	init(%name) = sysv
+Conflicts:	init(%name) = lsb
+Requires:	%name-core =  %version-%release
+Source30:	tor.sysv
+Requires(pre):		%name-core
+Requires(post): chkconfig
+Requires(preun): chkconfig
+# This is for /sbin/service
+Requires(preun): initscripts
+%{?noarch}
+
+
 %package upstart
 Summary:		upstart initscripts for %name
 Group:			System Environment/Base
@@ -101,6 +117,13 @@ This package contains the LSB compliant 
 daemon.
 
 
+%description sysv
+Tor is a connection-based low-latency anonymous communication system.
+
+This package contains the initscripts to start the "tor" daemon with
+Red Hat's proprietary initsystem.
+
+
 %description upstart
 Tor is a connection-based low-latency anonymous communication system.
 
@@ -165,6 +188,16 @@ test "$1" != 0 || /usr/lib/lsb/remove_in
 test "$1"  = 0 || env -i %_initrddir/tor try-restart &>/dev/null
 
 
+%post sysv
+# This adds the proper /etc/rc*.d links for the script
+/sbin/chkconfig --add <script>
+
+%preun sysv
+if [ $1 = 0 ] ; then
+    /sbin/service <script> stop >/dev/null 2>&1
+    /sbin/chkconfig --del <script>
+fi
+
 %postun upstart
 /usr/bin/killall -u %username -s INT tor 2>/dev/null || :
 
@@ -224,6 +257,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Sun Mar 28 2010 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>
+- added -sysv subpackage
+
 * Thu Mar 18 2010 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de> - 0.2.1.25-1400
 - updated to 0.2.1.25
 



More information about the scm-commits mailing list