michael@428: #!@l_prefix@/lib/openpkg/bash michael@428: ## michael@428: ## rpm -- OpenPKG Registry "rpm" overload command michael@428: ## Copyright (c) 2000-2012 OpenPKG GmbH michael@428: ## michael@428: ## This software is property of the OpenPKG GmbH, DE MUC HRB 160208. michael@428: ## All rights reserved. Licenses which grant limited permission to use, michael@428: ## copy, modify and distribute this software are available from the michael@428: ## OpenPKG GmbH. michael@428: ## michael@428: ## THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED michael@428: ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF michael@428: ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. michael@428: ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR michael@428: ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@428: ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@428: ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF michael@428: ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND michael@428: ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, michael@428: ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT michael@428: ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF michael@428: ## SUCH DAMAGE. michael@428: ## michael@428: michael@428: # determine path to OpenPKG instance michael@428: PREFIX="@l_prefix@" michael@428: if [ ".${OPENPKG_PREFIX}" != . ]; then michael@428: PREFIX="${OPENPKG_PREFIX}" michael@428: fi michael@428: michael@428: # determine rpm michael@428: rpm="$PREFIX/libexec/openpkg/rpm" michael@428: [ -x "$PREFIX/lib/openpkg/rpm" ] && rpm="$PREFIX/lib/openpkg/rpm" michael@428: michael@428: # determine whether URL rewriting is active michael@428: rewrite=0 michael@428: #$PREFIX/bin/openpkg register --printstatus >/dev/null 2>&1 && rewrite=1 michael@428: michael@428: # main michael@428: if [ $rewrite = 1 ]; then michael@428: # URL rewriting michael@428: declare -a a michael@428: declare -i i=0 michael@428: while [ ".$1" != . ]; do michael@428: arg="$1" michael@428: printf '%s\n' "$arg" | grep :// >/dev/null && arg=`$PREFIX/bin/openpkg register --rewriteurls "$arg"` michael@428: a[$i]="$arg" michael@428: i=i+1 michael@428: shift michael@428: done michael@428: set -- "${a[@]}" michael@428: unset arg i a michael@428: else michael@428: # stealth mode michael@428: : michael@428: fi michael@428: michael@428: # execute underlying application michael@428: exec $rpm "$@" michael@428: