tun/tun.spec

changeset 75
b3a835aa617c
child 85
e6a1cd7ed6ba
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tun/tun.spec	Mon Jan 12 19:09:19 2009 +0100
     1.3 @@ -0,0 +1,137 @@
     1.4 +##
     1.5 +##  tun.spec -- OpenPKG RPM Specification
     1.6 +##  Copyright (c) 2009 Michael Schloh von Bennewitz <michael@schloh.com>
     1.7 +##
     1.8 +##  Permission to use, copy, modify, and distribute this software for
     1.9 +##  any purpose with or without fee is hereby granted, provided that
    1.10 +##  the above copyright notice and this permission notice appear in all
    1.11 +##  copies.
    1.12 +##
    1.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    1.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    1.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    1.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    1.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    1.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    1.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    1.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.24 +##  SUCH DAMAGE.
    1.25 +##
    1.26 +
    1.27 +# MSvB Fixme: Device driver could possibly be stripped
    1.28 +#    %{l_shtool} install -c -m -s 755 \
    1.29 +#        tun $RPM_BUILD_ROOT%{l_prefix}/lib/tun
    1.30 +
    1.31 +#   package information
    1.32 +Name:         tun
    1.33 +Summary:      Universal TUN/TAP Device Driver
    1.34 +URL:          http://vtun.sourceforge.net/tun/
    1.35 +Vendor:       Maxim Krasnyansky
    1.36 +Packager:     Michael Schloh von Bennewitz
    1.37 +Distribution: Michael Schloh von Bennewitz
    1.38 +Class:        EVAL
    1.39 +Group:        Driver
    1.40 +License:      GPL
    1.41 +Version:      1.1
    1.42 +Release:      20090106
    1.43 +
    1.44 +#   list of sources
    1.45 +Source0:      http://vtun.sourceforge.net/tun/tun-%{version}.tar.gz
    1.46 +Patch0:       tun.patch
    1.47 +
    1.48 +#   build information
    1.49 +Prefix:       %{l_prefix}
    1.50 +BuildRoot:    %{l_buildroot}
    1.51 +BuildPreReq:  OpenPKG, openpkg >= 20050726
    1.52 +PreReq:       OpenPKG, openpkg >= 20050726
    1.53 +AutoReq:      no
    1.54 +AutoReqProv:  no
    1.55 +
    1.56 +%description
    1.57 +    Tun provides packet reception and transmission for user space       
    1.58 +    programs. It can be viewed as a simple Point-to-Point device, which 
    1.59 +    instead of receiving packets from a physical media, receives them   
    1.60 +    from user space program and instead of sending packets via physical 
    1.61 +    media writes them to the user space program.                        
    1.62 +
    1.63 +%track
    1.64 +    prog tun = {
    1.65 +        version   = %{version}
    1.66 +        url       = http://vtun.sourceforge.net/tun/
    1.67 +        regex     = tun-(__VER__)\.tar\.gz
    1.68 +    }
    1.69 +
    1.70 +%prep
    1.71 +    %setup -q -n tun-%{version}
    1.72 +    %patch -p0
    1.73 +
    1.74 +%build
    1.75 +    CC="%{l_cc}" \
    1.76 +    CFLAGS="%{l_cflags -O}" \
    1.77 +    ./configure \
    1.78 +        --prefix=%{l_prefix}
    1.79 +    locplat=`grep 'OS_DIR *=' Makefile | sed -e 's;OS_DIR[^=][^=]*= *\([^ ][^ ]*\);\1;'`
    1.80 +    ( cd $locplat
    1.81 +      %{l_make} %{l_mflags -O}
    1.82 +    ) || exit $?
    1.83 +
    1.84 +%install
    1.85 +    rm -rf $RPM_BUILD_ROOT
    1.86 +    %{l_shtool} mkdir -f -p -m 755 \
    1.87 +        $RPM_BUILD_ROOT%{l_prefix}/lib/tun
    1.88 +    locplat=`grep 'OS_DIR *=' Makefile | sed -e 's;OS_DIR[^=][^=]*= *\([^ ][^ ]*\);\1;'`
    1.89 +    ( cd $locplat
    1.90 +      %{l_shtool} install -c -m 644 \
    1.91 +          tun tun.conf if_tun.h $RPM_BUILD_ROOT%{l_prefix}/lib/tun
    1.92 +    ) || exit $?
    1.93 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
    1.94 +
    1.95 +%files -f files
    1.96 +
    1.97 +%clean
    1.98 +    rm -rf $RPM_BUILD_ROOT
    1.99 +
   1.100 +%post
   1.101 +    if [ $1 -eq 1 -o $1 -eq 2 ]; then
   1.102 +        #   announce special nature of this package
   1.103 +        ( echo "Attention: The special nature of the package contents require privileged"
   1.104 +          echo "interation, and must be carefully copied and nonportably installed to"
   1.105 +          echo "system areas outside of the OpenPKG instance."
   1.106 +          echo ""
   1.107 +          echo "This package therefore does not conform to basic OpenPKG principles, and"
   1.108 +          echo "should be removed immediately after its short term utility is exhausted."
   1.109 +          echo ""
   1.110 +          echo "To complete the installation on a SVR4 style operating system:"
   1.111 +          echo ""
   1.112 +          echo "  $ su -"
   1.113 +          echo "  # find %{l_prefix}/lib/tun/ -print"
   1.114 +          echo "  # shtool install -c -m 755 -o root -g sys tun /usr/kernel/drv/"
   1.115 +          echo "  # shtool install -c -m 644 -o root -g sys tun.conf /usr/kernel/drv/"
   1.116 +          echo "  # shtool install -c -m 644 -o root -g bin if_tun.h /usr/include/net/"
   1.117 +          echo "  # /usr/sbin/rem_drv tun"
   1.118 +          echo "  # /usr/sbin/add_drv tun"
   1.119 +        ) | %{l_rpmtool} msg -b -t notice
   1.120 +    fi
   1.121 +    exit 0
   1.122 +
   1.123 +%postun
   1.124 +    [ $1 -eq 0 ] || exit 0
   1.125 +    #   announce special nature of this package on uninstall
   1.126 +    ( echo "Attention: The special nature of the package contents require privileged"
   1.127 +      echo "interation, and must be carefully deleted and nonportably uninstalled"
   1.128 +      echo "from system areas outside of the OpenPKG instance."
   1.129 +      echo ""
   1.130 +      echo "  $ su -"
   1.131 +      echo "  # ls -ld /usr/kernel/drv/*tun* /usr/include/net/*tun*"
   1.132 +      echo "  # /usr/sbin/rem_drv tun"
   1.133 +      echo "  # ls -ld /usr/kernel/drv/*tun*"
   1.134 +      echo "  # ls -ld /usr/include/net/*tun*"
   1.135 +      echo "  # rm -f /usr/kernel/drv/tun"
   1.136 +      echo "  # rm -f /usr/kernel/drv/tun.conf"
   1.137 +      echo "  # rm -f /usr/include/net/if_tun.h"
   1.138 +    ) | %{l_rpmtool} msg -b -t notice
   1.139 +    exit 0
   1.140 +

mercurial