openpkg/rpm.sh

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

     1 #!@l_prefix@/lib/openpkg/bash
     2 ##
     3 ##  rpm -- OpenPKG Registry "rpm" overload command
     4 ##  Copyright (c) 2000-2012 OpenPKG GmbH <http://openpkg.com/>
     5 ##
     6 ##  This software is property of the OpenPKG GmbH, DE MUC HRB 160208.
     7 ##  All rights reserved. Licenses which grant limited permission to use,
     8 ##  copy, modify and distribute this software are available from the
     9 ##  OpenPKG GmbH.
    10 ##
    11 ##  THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
    12 ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    13 ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    14 ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    15 ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    16 ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    17 ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    18 ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    19 ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    20 ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    21 ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    22 ##  SUCH DAMAGE.
    23 ##
    25 #   determine path to OpenPKG instance
    26 PREFIX="@l_prefix@"
    27 if [ ".${OPENPKG_PREFIX}" != . ]; then
    28     PREFIX="${OPENPKG_PREFIX}"
    29 fi
    31 #   determine rpm
    32 rpm="$PREFIX/libexec/openpkg/rpm"
    33 [ -x "$PREFIX/lib/openpkg/rpm" ] && rpm="$PREFIX/lib/openpkg/rpm"
    35 #   determine whether URL rewriting is active
    36 rewrite=0
    37 #$PREFIX/bin/openpkg register --printstatus >/dev/null 2>&1 && rewrite=1
    39 #   main
    40 if [ $rewrite = 1 ]; then
    41     #   URL rewriting
    42     declare -a a
    43     declare -i i=0
    44     while [ ".$1" != . ]; do
    45         arg="$1"
    46         printf '%s\n' "$arg" | grep :// >/dev/null && arg=`$PREFIX/bin/openpkg register --rewriteurls "$arg"`
    47         a[$i]="$arg"
    48         i=i+1
    49         shift
    50     done
    51     set -- "${a[@]}"
    52     unset arg i a
    53 else
    54     #   stealth mode
    55     :
    56 fi
    58 #   execute underlying application
    59 exec $rpm "$@"

mercurial