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.

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

mercurial