Import package vendor original specs for necessary manipulations.

Wed, 22 Jan 2014 21:02:10 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 22 Jan 2014 21:02:10 +0100
changeset 789
cbbc8daa8174
parent 788
221a37376cee
child 790
ab976cd2e548

Import package vendor original specs for necessary manipulations.

tor/rc.tor file | annotate | diff | comparison | revisions
tor/tor.spec file | annotate | diff | comparison | revisions
tor/torrc file | annotate | diff | comparison | revisions
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tor/rc.tor	Wed Jan 22 21:02:10 2014 +0100
     1.3 @@ -0,0 +1,60 @@
     1.4 +#!@l_prefix@/bin/openpkg rc
     1.5 +##
     1.6 +##  rc.tor -- Run-Commands
     1.7 +##
     1.8 +
     1.9 +%config
    1.10 +    tor_enable="$openpkg_rc_def"
    1.11 +    tor_log_prolog="true"
    1.12 +    tor_log_epilog="true"
    1.13 +    tor_log_numfiles="10"
    1.14 +    tor_log_minsize="1M"
    1.15 +    tor_log_complevel="9"
    1.16 +
    1.17 +%common
    1.18 +    tor_logfile="@l_prefix@/var/tor/tor.log"
    1.19 +    tor_pidfile="@l_prefix@/var/tor/tor.pid"
    1.20 +    tor_signal () {
    1.21 +        [ -f $tor_pidfile ] && kill -$1 `cat $tor_pidfile`
    1.22 +    }
    1.23 +
    1.24 +%status -u @l_rusr@ -o
    1.25 +    tor_usable="unknown"
    1.26 +    tor_active="no"
    1.27 +    rcService tor enable yes && \
    1.28 +        tor_signal 0 && tor_active="yes"
    1.29 +    echo "tor_enable=\"$tor_enable\""
    1.30 +    echo "tor_usable=\"$tor_usable\""
    1.31 +    echo "tor_active=\"$tor_active\""
    1.32 +
    1.33 +%start -u @l_rusr@
    1.34 +    rcService tor enable yes || exit 0
    1.35 +    rcService tor active yes && exit 0
    1.36 +    @l_prefix@/bin/tor
    1.37 +
    1.38 +%stop -u @l_rusr@
    1.39 +    rcService tor enable yes || exit 0
    1.40 +    rcService tor active no  && exit 0
    1.41 +    tor_signal TERM
    1.42 +    sleep 2
    1.43 +    rm -f $tor_pidfile >/dev/null 2>&1 || true
    1.44 +
    1.45 +%restart -u @l_rusr@
    1.46 +    rcService tor enable yes || exit 0
    1.47 +    rcService tor active no  && exit 0
    1.48 +    rc tor stop start
    1.49 +
    1.50 +%reload -u @l_rusr@
    1.51 +    rcService tor enable yes || exit 0
    1.52 +    rcService tor active no  && exit 0
    1.53 +    tor_signal HUP
    1.54 +
    1.55 +%daily -u @l_susr@
    1.56 +    rcService tor enable yes || exit 0
    1.57 +    shtool rotate -f \
    1.58 +        -n ${tor_log_numfiles} -s ${tor_log_minsize} -d \
    1.59 +        -z ${tor_log_complevel} -m 664 -o @l_rusr@ -g @l_rgrp@ \
    1.60 +        -P "${tor_log_prolog}" \
    1.61 +        -E "${tor_log_epilog}; rc tor restart" \
    1.62 +        ${tor_logfile}
    1.63 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tor/tor.spec	Wed Jan 22 21:02:10 2014 +0100
     2.3 @@ -0,0 +1,134 @@
     2.4 +##
     2.5 +##  tor.spec -- OpenPKG RPM Package Specification
     2.6 +##  Copyright (c) 2000-2012 OpenPKG Foundation e.V. <http://openpkg.net/>
     2.7 +##
     2.8 +##  Permission to use, copy, modify, and distribute this software for
     2.9 +##  any purpose with or without fee is hereby granted, provided that
    2.10 +##  the above copyright notice and this permission notice appear in all
    2.11 +##  copies.
    2.12 +##
    2.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    2.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    2.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    2.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    2.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    2.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    2.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    2.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    2.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    2.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    2.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    2.24 +##  SUCH DAMAGE.
    2.25 +##
    2.26 +
    2.27 +#   package version
    2.28 +%define       V_dist  0.2.3.14-alpha
    2.29 +%define       V_opkg  0.2.3.14
    2.30 +
    2.31 +#   package information
    2.32 +Name:         tor
    2.33 +Summary:      Anonymous Internet Communication System
    2.34 +URL:          http://www.torproject.org/
    2.35 +Vendor:       R. Dingledine & N. Mathewson
    2.36 +Packager:     OpenPKG Foundation e.V.
    2.37 +Distribution: OpenPKG Community
    2.38 +Class:        PLUS
    2.39 +Group:        Network
    2.40 +License:      LGPL
    2.41 +Version:      %{V_opkg}
    2.42 +Release:      20120427
    2.43 +
    2.44 +#   list of sources
    2.45 +Source0:      http://www.torproject.org/dist/tor-%{V_dist}.tar.gz
    2.46 +Source1:      rc.tor
    2.47 +Source2:      torrc
    2.48 +
    2.49 +#   build information
    2.50 +BuildPreReq:  OpenPKG, openpkg >= 20100101, gcc
    2.51 +PreReq:       OpenPKG, openpkg >= 20100101, tsocks
    2.52 +BuildPreReq:  openssl, libevent, zlib
    2.53 +PreReq:       openssl, libevent, zlib
    2.54 +
    2.55 +%description
    2.56 +   Tor is a toolset for a wide range of organizations and people
    2.57 +   that want to improve their safety and security on the Internet.
    2.58 +   Using Tor can help you anonymize web browsing and publishing,
    2.59 +   instant messaging, IRC, SSH, and other applications that use the TCP
    2.60 +   protocol. Tor also provides a platform on which software developers
    2.61 +   can build new applications with built-in anonymity, safety, and
    2.62 +   privacy features. Your traffic is safer when you use Tor, because
    2.63 +   communications are bounced around a distributed network of servers,
    2.64 +   called onion routers. Instead of taking a direct route from source to
    2.65 +   destination, data packets on the Tor network take a random pathway
    2.66 +   through several servers that cover your tracks so no observer at any
    2.67 +   single point can tell where the data came from or where it's going.
    2.68 +
    2.69 +%track
    2.70 +    prog tor = {
    2.71 +        version   = %{V_dist}
    2.72 +        url       = http://www.torproject.org/dist/
    2.73 +        regex     = tor-(\d+\.\d+(\.\d+)*(-(alpha|beta|rc))?)\.tar\.gz
    2.74 +    }
    2.75 +
    2.76 +%prep
    2.77 +    %setup -q -n tor-%{V_dist}
    2.78 +
    2.79 +%build
    2.80 +    libs=""
    2.81 +    case "%{l_platform -t}" in
    2.82 +        *-linux* ) libs="$libs -lrt" ;;
    2.83 +    esac
    2.84 +    CC="%{l_cc}" \
    2.85 +    CFLAGS="%{l_cflags -O}" \
    2.86 +    CPPFLAGS="%{l_cppflags}" \
    2.87 +    LDFLAGS="%{l_ldflags}" \
    2.88 +    LIBS="$libs" \
    2.89 +    ./configure \
    2.90 +        --prefix=%{l_prefix} \
    2.91 +        --mandir=%{l_prefix}/man \
    2.92 +        --with-ssl-dir=%{l_prefix} \
    2.93 +        --with-libevent-dir=%{l_prefix} \
    2.94 +        --disable-asciidoc
    2.95 +    %{l_make} %{l_mflags -O}
    2.96 +
    2.97 +%install
    2.98 +    %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
    2.99 +    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
   2.100 +    mv $RPM_BUILD_ROOT%{l_prefix}/etc/tor/torrc.sample \
   2.101 +       $RPM_BUILD_ROOT%{l_prefix}/etc/tor/torrc
   2.102 +    %{l_shtool} subst \
   2.103 +        -e 's;exec tsocks;exec %{l_prefix}/bin/tsocks;' \
   2.104 +        $RPM_BUILD_ROOT%{l_prefix}/bin/torify
   2.105 +    %{l_shtool} mkdir -f -p -m 755 \
   2.106 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   2.107 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   2.108 +        %{SOURCE rc.tor} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   2.109 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   2.110 +        %{SOURCE torrc} $RPM_BUILD_ROOT%{l_prefix}/etc/tor/
   2.111 +    %{l_shtool} mkdir -f -p -m 755 \
   2.112 +        $RPM_BUILD_ROOT%{l_prefix}/var/tor/db
   2.113 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   2.114 +        %{l_files_std} \
   2.115 +        '%config %{l_prefix}/etc/tor/*' \
   2.116 +        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/tor' \
   2.117 +        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/tor/db'
   2.118 +
   2.119 +%files -f files
   2.120 +
   2.121 +%clean
   2.122 +
   2.123 +%post
   2.124 +    #   after upgrade, restart service
   2.125 +    [ $1 -eq 2 ] || exit 0
   2.126 +    eval `%{l_rc} tor status 2>/dev/null`
   2.127 +    [ ".$tor_active" = .yes ] && %{l_rc} tor restart
   2.128 +    exit 0
   2.129 +
   2.130 +%preun
   2.131 +    #   before erase, stop service and remove log files
   2.132 +    [ $1 -eq 0 ] || exit 0
   2.133 +    %{l_rc} tor stop 2>/dev/null
   2.134 +    rm -f $RPM_INSTALL_PREFIX/var/tor/tor.* >/dev/null 2>&1 || true
   2.135 +    rm -f $RPM_INSTALL_PREFIX/var/tor/db/*  >/dev/null 2>&1 || true
   2.136 +    exit 0
   2.137 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tor/torrc	Wed Jan 22 21:02:10 2014 +0100
     3.3 @@ -0,0 +1,39 @@
     3.4 +##
     3.5 +##  torrc -- Tor Daemon Configuration
     3.6 +##
     3.7 +
     3.8 +#   ==== CLIENT CONFIGURATION ====
     3.9 +
    3.10 +RunAsDaemon          1
    3.11 +DataDirectory        @l_prefix@/var/tor/db
    3.12 +PIDFile              @l_prefix@/var/tor/tor.pid
    3.13 +Log                  notice file @l_prefix@/var/tor/tor.log
    3.14 +
    3.15 +SocksPort            9050
    3.16 +SocksBindAddress     127.0.0.1
    3.17 +SocksPolicy          accept 127.0.0.1/8
    3.18 +SocksPolicy          reject *
    3.19 +OutboundBindAddress  0.0.0.0
    3.20 +
    3.21 +AllowUnverifiedNodes middle,rendezvous
    3.22 +#DirServer           18.244.0.188:9031 FFCB 46DB 1339 DA84 674C 70D7 CB58 6434 C437 0441
    3.23 +#DirServer           18.244.0.114:80   719B E45D E224 B607 C537 07D0 E214 3E2D 423E 74CF
    3.24 +#DirServer           86.59.5.130:80    847B 1F85 0344 D787 6491 A548 92F9 0493 4E4E B85D
    3.25 +
    3.26 +#   ==== SERVER CONFIGURATION ====
    3.27 +
    3.28 +#HiddenServiceDir    @l_prefix@/var/tor/db/service/
    3.29 +#HiddenServicePort   80 127.0.0.1:80
    3.30 +#HiddenServicePort   22 127.0.0.1:22
    3.31 +
    3.32 +#Nickname            ExampleTOR
    3.33 +#Address             tor.example.com
    3.34 +#ContactInfo         TOR Administrator <tor@example.com>
    3.35 +#ORPort              9001
    3.36 +#ORBindAddress       0.0.0.0:9001
    3.37 +#DirPort             9030
    3.38 +#DirBindAddress      0.0.0.0:9030
    3.39 +#ExitPolicy          accept *:6660-6667,reject *:*
    3.40 +#ExitPolicy          accept *:119
    3.41 +#ExitPolicy          reject *:*
    3.42 +

mercurial