소스 검색

SUSEisms to enable "make dist-rpm" functionality in SuSe

svn:r6499
Andrew Lewman 18 년 전
부모
커밋
63c1395509
4개의 변경된 파일136개의 추가작업 그리고 7개의 파일을 삭제
  1. 2 2
      contrib/Makefile.am
  2. 3 0
      contrib/suse/Makefile.am
  3. 107 0
      contrib/suse/tor.sh.in
  4. 24 5
      tor.spec.in

+ 2 - 2
contrib/Makefile.am

@@ -1,5 +1,5 @@
-SUBDIRS = osx
-DIST_SUBDIRS = osx
+SUBDIRS = osx suse
+DIST_SUBDIRS = osx suse
 
 confdir = $(sysconfdir)/tor
 

+ 3 - 0
contrib/suse/Makefile.am

@@ -0,0 +1,3 @@
+confdir = $(sysconfdir)/tor
+
+EXTRA_DIST = tor.sh.in tor.sh

+ 107 - 0
contrib/suse/tor.sh.in

@@ -0,0 +1,107 @@
+#!/bin/sh
+#
+# tor    The Onion Router
+#
+# Startup/shutdown script for tor. This is a wrapper around torctl;
+# torctl does the actual work in a relatively system-independent, or at least
+# distribution-independent, way, and this script deals with fitting the
+# whole thing into the conventions of the particular system at hand.
+#
+# These next couple of lines "declare" tor for the "chkconfig" program,
+# originally from SGI, used on Red Hat/Fedora and probably elsewhere.
+#
+# chkconfig: 2345 90 10
+# description: Onion Router - A low-latency anonymous proxy
+#
+
+### BEGIN INIT INFO
+# Provides: tor
+# Required-Start: $network
+# Required-Stop: $network
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 6
+# Description: Start the tor daemon
+### END INIT INFO
+
+. /etc/rc.status
+
+# Shell functions sourced from /etc/rc.status:
+#      rc_check         check and set local and overall rc status
+#      rc_status        check and set local and overall rc status
+#      rc_status -v     ditto but be verbose in local rc status
+#      rc_status -v -r  ditto and clear the local rc status
+#      rc_failed        set local and overall rc status to failed
+#      rc_reset         clear local rc status (overall remains)
+#      rc_exit          exit appropriate to overall rc status
+
+# First reset status of this service
+rc_reset
+
+# Increase open file descriptors a reasonable amount
+ulimit -n 8192
+
+TORCTL=/usr/local/bin/torctl
+
+# torctl will use these environment variables
+TORUSER=_tor
+export TORUSER
+TORGROUP=_tor
+export TORGROUP
+
+if [ -x /bin/su ] ; then
+    SUPROG=/bin/su
+elif [ -x /sbin/su ] ; then
+    SUPROG=/sbin/su
+elif [ -x /usr/bin/su ] ; then
+    SUPROG=/usr/bin/su
+elif [ -x /usr/sbin/su ] ; then
+    SUPROG=/usr/sbin/su
+else
+    SUPROG=/bin/su
+fi
+
+case "$1" in
+
+    start)
+    echo -n "Starting tor daemon"
+    ## Start daemon with startproc(8). If this fails
+    ## the echo return value is set appropriate.
+
+    startproc -f $TORCTL start
+    # Remember status and be verbose
+    rc_status -v
+    ;;
+
+    stop)
+    echo -n "Stopping tor daemon" 
+    startproc -f $TORCTL stop
+    # Remember status and be verbose
+    rc_status -v
+    ;;
+
+    restart)
+    echo -n "Restarting tor daemon" 
+    startproc -f $TORCTL restart
+    # Remember status and be verbose
+    rc_status -v
+    ;;
+
+    reload)
+    echo -n "Reloading tor daemon" 
+    startproc -f $TORCTL reload
+    # Remember status and be verbose
+    rc_status -v
+    ;;
+
+    status)
+    startproc -f $TORCTL status
+    # Remember status and be verbose
+    rc_status -v
+    ;;
+
+    *)
+    echo "Usage: $0 (start|stop|restart|reload|status)"
+    RETVAL=1
+esac
+
+rc_exit

+ 24 - 5
tor.spec.in

@@ -30,7 +30,7 @@
 %define _host %{target_cpu}-pc-%{target_os}-%{target}
 %define _host_cpu %{target_cpu}
 %define _host_vendor %{target_os}
-%define optflags -march=%{target_cpu} -mcpu=%{target_cpu} -O
+%define optflags -march=%{target_cpu} -mtune=%{target_cpu} -O2
 
 ## Version song and dance
 #
@@ -124,14 +124,16 @@ License: BSD-like
 Vendor: R. Dingledine <arma@seul.org>
 Packager: Nick Mathewson <nickm@seul.org>
 
+%if %{is_suse}
+Requires: openssl >= 0.9.6
+BuildRequires: openssl-devel >= 0.9.6, rpm >= 4.0, zlib-devel
+%else 
 Requires: openssl >= 0.9.6, libevent >= 1.1a
 BuildRequires: openssl-devel >= 0.9.6, libevent-devel >= 1.1a
+%endif
 %if %{is_fc}
 BuildRequires: rpm-build >= 4.0
 %endif
-%if %{is_suse}
-BuildRequires: rpm >= 4.0, zlib-devel
-%endif
 Requires(pre): /usr/bin/id, /bin/date, /bin/sh
 Requires(pre): %{_sbindir}/useradd, %{_sbindir}/groupadd
 
@@ -166,8 +168,14 @@ for high-stakes anonymity.
 %setup -q -n %{name}-%{native_version}
 
 %build
+%if %{is_suse}
+%configure --with-tor-user=%{toruser} --with-tor-group=%{torgroup} \
+	--build=%{_host} --host=%{_host} --target=%{_host} \
+	--enable-static --disable-shared
+%else
 %configure --with-tor-user=%{toruser} --with-tor-group=%{torgroup} \
-	--build=%{_host} --host=%{_host} --target=%{_host}
+	--build=%{_host} --host=%{_host} --target=%{_host} 
+%endif
 %make
 
 %install
@@ -175,7 +183,11 @@ for high-stakes anonymity.
 
 # Install init script and control script
 %__mkdir_p ${RPM_BUILD_ROOT}%{_initrddir}
+%if %{is_suse}
+%__install -p -m 755 contrib/suse/tor.sh ${RPM_BUILD_ROOT}%{_initrddir}/%{name}
+%else
 %__install -p -m 755 contrib/tor.sh ${RPM_BUILD_ROOT}%{_initrddir}/%{name}
+%endif
 %__install -p -m 755 contrib/torctl ${RPM_BUILD_ROOT}%{_bindir}
 
 # Set up config file; "sample" file implements a basic user node.
@@ -232,6 +244,7 @@ exit 0
 # configuration alone.
 if [ $1 -eq 1 ]; then
     /sbin/chkconfig --add %{name}
+    /sbin/chkconfig %{name} on
 fi
 
 # Older tor RPMS used a different username for the tor daemon.
@@ -283,6 +296,12 @@ exit 0
 
 %changelog
 
+* Fri May 26 2006 Andrew Lewman <phobos@interloper.org>
+- Add in a few "SUSEisms" to make dist-rpm actually work on suse
+- Turn Tor "on" via chkconfig
+- Update -mcpu to -mtune to make GCC happy
+- see OR-CVS for details
+
 * Tue Mar 28 2006 Andrew Lewman <phobos@interloper.org>
 - converted to build the specified target cpu and arch
 - override related rpm macros to build correctly