Import package vendor original specs for necessary manipulations.

Fri, 09 Jan 2009 00:45:56 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 09 Jan 2009 00:45:56 +0100
changeset 52
d42d557c7a5a
parent 51
64165e101f08
child 53
11a94c8e617e

Import package vendor original specs for necessary manipulations.

stun/rc.stun file | annotate | diff | comparison | revisions
stun/stun.patch file | annotate | diff | comparison | revisions
stun/stun.spec file | annotate | diff | comparison | revisions
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/stun/rc.stun	Fri Jan 09 00:45:56 2009 +0100
     1.3 @@ -0,0 +1,49 @@
     1.4 +#!@l_prefix@/bin/openpkg rc
     1.5 +##
     1.6 +##  rc.stun -- Run-Commands
     1.7 +##
     1.8 +
     1.9 +%config
    1.10 +    stun_enable="$openpkg_rc_def"
    1.11 +    stun_bind_addr1="127.0.0.1"
    1.12 +    stun_bind_addr2="127.0.0.2"
    1.13 +    stun_bind_port1="3478"
    1.14 +    stun_bind_port2="3479"
    1.15 +
    1.16 +%common
    1.17 +    stun_pidfile="@l_prefix@/var/stun/stun.pid"
    1.18 +    stun_signal () {
    1.19 +        [ -f $stun_pidfile ] && kill -$1 `cat $stun_pidfile`
    1.20 +    }
    1.21 +
    1.22 +%status -u @l_susr@ -o
    1.23 +    stun_usable="unknown"
    1.24 +    stun_active="no"
    1.25 +    rcService stun enable yes && \
    1.26 +        stun_signal 0 && stun_active="yes"
    1.27 +    echo "stun_enable=\"$stun_enable\""
    1.28 +    echo "stun_usable=\"$stun_usable\""
    1.29 +    echo "stun_active=\"$stun_active\""
    1.30 +
    1.31 +%start -u @l_susr@
    1.32 +    rcService stun enable yes || exit 0
    1.33 +    rcService stun active yes && exit 0
    1.34 +    @l_prefix@/sbin/stund -b \
    1.35 +        -h "${stun_bind_addr1}" \
    1.36 +        -a "${stun_bind_addr2}" \
    1.37 +        -p "${stun_bind_port1}" \
    1.38 +        -o "${stun_bind_port2}" \
    1.39 +        -P "${stun_pidfile}"
    1.40 +
    1.41 +%stop -u @l_susr@
    1.42 +    rcService stun enable yes || exit 0
    1.43 +    rcService stun active no  && exit 0
    1.44 +    stun_signal TERM
    1.45 +    sleep 2
    1.46 +    rm -f $stun_pidfile >/dev/null 2>&1 || true
    1.47 +
    1.48 +%restart -u @l_susr@
    1.49 +    rcService stun enable yes || exit 0
    1.50 +    rcService stun active no  && exit 0
    1.51 +    rc stun stop start
    1.52 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/stun/stun.patch	Fri Jan 09 00:45:56 2009 +0100
     2.3 @@ -0,0 +1,85 @@
     2.4 +Index: client.cxx
     2.5 +--- client.cxx.orig	2005-08-14 02:43:10 +0200
     2.6 ++++ client.cxx	2005-11-16 10:28:17 +0100
     2.7 +@@ -178,13 +178,13 @@
     2.8 +                retval[nic] = 0x02;
     2.9 +                break;
    2.10 +             case StunTypeDependentFilter:
    2.11 +-               cout << "Independedt Mapping, Address Dependendent Filter";
    2.12 ++               cout << "Independedt Mapping, Address Dependent Filter";
    2.13 +                if ( presPort ) cout << ", preserves ports"; else cout << ", random port";
    2.14 +                if ( hairpin  ) cout << ", will hairpin"; else cout << ", no hairpin";
    2.15 +                retval[nic] = 0x04;
    2.16 +                break;
    2.17 +             case StunTypePortDependedFilter:
    2.18 +-               cout << "Indepndent Mapping, Port Dependent Filter";
    2.19 ++               cout << "Independent Mapping, Port Dependent Filter";
    2.20 +                if ( presPort ) cout << ", preserves ports"; else cout << ", random port";
    2.21 +                if ( hairpin  ) cout << ", will hairpin"; else cout << ", no hairpin";
    2.22 +                retval[nic] = 0x06;
    2.23 +Index: server.cxx
    2.24 +--- server.cxx.orig	2005-08-13 22:19:29 +0200
    2.25 ++++ server.cxx	2005-11-16 10:33:51 +0100
    2.26 +@@ -23,7 +23,7 @@
    2.27 + usage()
    2.28 + {
    2.29 +    cerr << "Usage: " << endl
    2.30 +-        << " ./server [-v] [-h] [-h IP_Address] [-a IP_Address] [-p port] [-o port] [-m mediaport]" << endl
    2.31 ++        << " ./server [-v] [-h] [-h IP_Address] [-a IP_Address] [-p port] [-o port] [-b] [-m mediaport] [-P pidfile]" << endl
    2.32 +         << " " << endl
    2.33 +         << " If the IP addresses of your NIC are 10.0.1.150 and 10.0.1.151, run this program with" << endl
    2.34 +         << "    ./server -v  -h 10.0.1.150 -a 10.0.1.151" << endl
    2.35 +@@ -32,7 +32,7 @@
    2.36 +         << "  -a sets the secondary IP" << endl
    2.37 +         << "  -p sets the primary port and defaults to 3478" << endl
    2.38 +         << "  -o sets the secondary port and defaults to 3479" << endl
    2.39 +-        << "  -b makes the program run in the backgroud" << endl
    2.40 ++        << "  -b makes the program run in the background" << endl
    2.41 +         << "  -m sets up a STERN server starting at port m" << endl
    2.42 +         << "  -v runs in verbose mode" << endl
    2.43 +       // in makefile too
    2.44 +@@ -55,6 +55,7 @@
    2.45 +    StunAddress4 altAddr;
    2.46 +    bool verbose=false;
    2.47 +    bool background=false;
    2.48 ++   char *myPidFile = 0;
    2.49 +    
    2.50 +    myAddr.addr = 0;
    2.51 +    altAddr.addr = 0;
    2.52 +@@ -135,6 +136,16 @@
    2.53 +          }
    2.54 +          myMediaPort = UInt16(strtol( argv[arg], NULL, 10));
    2.55 +       }
    2.56 ++      else if ( !strcmp( argv[arg] , "-P" ) )
    2.57 ++      {
    2.58 ++         arg++;
    2.59 ++         if ( argc <= arg ) 
    2.60 ++         {
    2.61 ++            usage();
    2.62 ++            exit(-1);
    2.63 ++         }
    2.64 ++         myPidFile = argv[arg];
    2.65 ++      }
    2.66 +       else
    2.67 +       {
    2.68 +          usage();
    2.69 +@@ -213,6 +224,19 @@
    2.70 + 
    2.71 +    if (pid == 0) //child or not using background
    2.72 +    {
    2.73 ++      /* write a daemon pidfile */
    2.74 ++      if (myPidFile) {
    2.75 ++          pid_t pid;
    2.76 ++          FILE *fp;
    2.77 ++          pid = getpid();
    2.78 ++          if ((fp = fopen(myPidFile, "w")) == NULL) {
    2.79 ++              fprintf(stderr, "stund: Can't write pidfile '%s'", myPidFile);
    2.80 ++              exit(1);
    2.81 ++          }
    2.82 ++          fprintf(fp, "%ld\n", (long)pid);
    2.83 ++          fclose(fp);
    2.84 ++      }
    2.85 ++
    2.86 +       StunServerInfo info;
    2.87 +       bool ok = stunInitServer(info, myAddr, altAddr, myMediaPort, verbose);
    2.88 +       
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/stun/stun.spec	Fri Jan 09 00:45:56 2009 +0100
     3.3 @@ -0,0 +1,124 @@
     3.4 +##
     3.5 +##  stun.spec -- OpenPKG RPM Package Specification
     3.6 +##  Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
     3.7 +##
     3.8 +##  Permission to use, copy, modify, and distribute this software for
     3.9 +##  any purpose with or without fee is hereby granted, provided that
    3.10 +##  the above copyright notice and this permission notice appear in all
    3.11 +##  copies.
    3.12 +##
    3.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    3.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    3.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    3.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    3.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    3.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    3.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    3.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    3.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    3.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    3.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    3.24 +##  SUCH DAMAGE.
    3.25 +##
    3.26 +
    3.27 +#   package version
    3.28 +%define       V_dist  0.96_Aug13
    3.29 +%define       V_opkg  0.96
    3.30 +
    3.31 +#   package information
    3.32 +Name:         stun
    3.33 +Summary:      STUN Client & Server
    3.34 +URL:          http://www.vovida.org/applications/downloads/stun/
    3.35 +Vendor:       Vovida
    3.36 +Packager:     OpenPKG Foundation e.V.
    3.37 +Distribution: OpenPKG Community
    3.38 +Class:        EVAL
    3.39 +Group:        VoIP
    3.40 +License:      Open Source
    3.41 +Version:      %{V_opkg}
    3.42 +Release:      20080101
    3.43 +
    3.44 +#   list of sources
    3.45 +Source0:      http://switch.dl.sourceforge.net/stun/stund_%{V_dist}.tgz
    3.46 +Source1:      rc.stun
    3.47 +Patch0:       stun.patch
    3.48 +
    3.49 +#   build information
    3.50 +Prefix:       %{l_prefix}
    3.51 +BuildRoot:    %{l_buildroot}
    3.52 +BuildPreReq:  OpenPKG, openpkg >= 20060823, make, gcc
    3.53 +PreReq:       OpenPKG, openpkg >= 20060823
    3.54 +AutoReq:      no
    3.55 +AutoReqProv:  no
    3.56 +
    3.57 +%description
    3.58 +    The STUN (Simple Traversal of UDP through NATs (Network Address
    3.59 +    Translation)) server is an implementation of the STUN protocol that
    3.60 +    enables STUN functionality in SIP-based systems. The STUN server
    3.61 +    tar ball also include a client API to enable STUN functionality in
    3.62 +    SIP endpoints. In addition there is a command line UNIX client and
    3.63 +    a graphical windows client that check what type of NAT the user is
    3.64 +    using. STUN is an application-layer protocol that can determine the
    3.65 +    public IP and nature of a NAT device that sits between the STUN
    3.66 +    client and STUN server. The current version of the code supports
    3.67 +    most of RFC 3489 except the ability to get OTPs from the server.
    3.68 +
    3.69 +%track
    3.70 +    prog stun = {
    3.71 +        version   = %{V_dist}
    3.72 +        url       = http://prdownloads.sourceforge.net/stun/
    3.73 +        regex     = stund_(.+?)\.tgz
    3.74 +    }
    3.75 +
    3.76 +%prep
    3.77 +    %setup -q -n stund
    3.78 +    %patch -p0
    3.79 +
    3.80 +%build
    3.81 +    %{l_make} %{l_mflags} \
    3.82 +        CXX="%{l_cxx}" \
    3.83 +        CXXFLAGS="%{l_cxxflags -O}" \
    3.84 +        LDFLAGS=""
    3.85 +
    3.86 +%install
    3.87 +    rm -rf $RPM_BUILD_ROOT
    3.88 +    %{l_shtool} mkdir -f -p -m 755 \
    3.89 +        $RPM_BUILD_ROOT%{l_prefix}/bin \
    3.90 +        $RPM_BUILD_ROOT%{l_prefix}/sbin \
    3.91 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
    3.92 +        $RPM_BUILD_ROOT%{l_prefix}/var/stun
    3.93 +    %{l_shtool} install -c -s -m 755 \
    3.94 +        client $RPM_BUILD_ROOT%{l_prefix}/bin/stun
    3.95 +    %{l_shtool} install -c -s -m 755 \
    3.96 +        server $RPM_BUILD_ROOT%{l_prefix}/sbin/stund
    3.97 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
    3.98 +        %{SOURCE rc.stun} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
    3.99 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
   3.100 +
   3.101 +%files -f files
   3.102 +
   3.103 +%clean
   3.104 +    rm -rf $RPM_BUILD_ROOT
   3.105 +
   3.106 +%post
   3.107 +    if [ $1 -eq 1 ]; then
   3.108 +        #   display final hints on initial installation
   3.109 +        ( echo "Before starting the STUN daemon, please set the configuration"
   3.110 +          echo "variables \"stun_bind_addr{1,2}\" in $RPM_INSTALL_PREFIX/etc/rc.conf"
   3.111 +          echo "to two *different* IP addresses bound to your host. STUN requires this."
   3.112 +        ) | %{l_rpmtool} msg -b -t notice
   3.113 +    fi
   3.114 +
   3.115 +    #   after upgrade, restart service
   3.116 +    [ $1 -eq 2 ] || exit 0
   3.117 +    eval `%{l_rc} stun status 2>/dev/null`
   3.118 +    [ ".$stun_active" = .yes ] && %{l_rc} stun restart
   3.119 +    exit 0
   3.120 +
   3.121 +%preun
   3.122 +    #   before erase, stop service and remove log files
   3.123 +    [ $1 -eq 0 ] || exit 0
   3.124 +    %{l_rc} stun stop 2>/dev/null
   3.125 +    rm -f $RPM_INSTALL_PREFIX/var/stun/stun.pid >/dev/null 2>&1 || true
   3.126 +    exit 0
   3.127 +

mercurial