X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fscripts%2Fvrpm-preload;h=1036e5cd40c840373824fd05fb3f5c600a17b871;hb=d45518897217889e8571d94d4459ee12c4db56a0;hp=50a5f5c2921958431fc3070872841dd80d9af2c3;hpb=b562f3d09686bb1686646c949b6f92c94eb2d64c;p=util-vserver.git diff --git a/util-vserver/scripts/vrpm-preload b/util-vserver/scripts/vrpm-preload index 50a5f5c..1036e5c 100755 --- a/util-vserver/scripts/vrpm-preload +++ b/util-vserver/scripts/vrpm-preload @@ -1,55 +1,54 @@ -#! /bin/bash -x - -: ${UTIL_VSERVER_VARS:=$(dirname $0)/util-vserver-vars} +#! /bin/bash +# $Id$ + +# Copyright (C) 2003 Enrico Scholz +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +set -e + +: ${UTIL_VSERVER_VARS:=/usr/lib/util-vserver/util-vserver-vars} test -e "$UTIL_VSERVER_VARS" || { - echo "Can not find util-vserver installation; aborting..." + echo "Can not find util-vserver installation; aborting..." >&2 exit 1 } . "$UTIL_VSERVER_VARS" lib=$_RPM_FAKE_SO -function getSyscallParams -{ - set -- `grep '^__NR_new_s_context:' /proc/self/status` - scall_nr=$2 - test "$3" && scall_rev=${3##rev} -} - -need_cfg= -case "$CUR_VSERVER" in - /*) vdir=$CUR_VSERVER;; - *) vdir=$CONFDIR/$CUR_VSERVER/vdir - need_cfg=1;; -esac +#scall_nr=$($_VSERVER_INFO x SYSCALL_NEW_S_CONTEXT_NR 2>/dev/null) +#scall_rev=$($_VSERVER_INFO x SYSCALL_NEW_S_CONTEXT_REV 2>/dev/null) +vdir=$($_VSERVER_INFO "$CUR_VSERVER" VDIR) || vdir="$CUR_VSERVER" +ctx=$($_VSERVER_INFO "$CUR_VSERVER" CONTEXT) || ctx= -test "$CUR_VSERVER" -a -d "$vdir" || { - echo "No or invalid vserver-name given" +test -d "$vdir" || { + echo $"Can not find chroot environment at '$vdir' for '$CUR_VSERVER'" >&2 exit 1 } - -ctxfile=/var/run/vservers/${CUR_VSERVER}.ctx -if test -f "$ctxfile"; then - . "$ctxfile" -else - S_CONTEXT= -fi - -for bin in `which rpm` /bin/rpm /usr/lib/rpm/rpmi ""; do +for bin in `which rpm` /bin/rpm /usr/lib/rpm/rpm${RPM_FLAVOR:-i} ""; do ldd "$bin" &>/dev/null && break done test "$bin" || { - echo "No dynamically linked rpm binary found; exiting..." + echo $"No dynamically linked rpm binary found; exiting..." >&2 exit 1 } - -getSyscallParams - -RPM_FAKE_S_CONTEXT_REV=$scall_rev \ -RPM_FAKE_S_CONTEXT_NR=$scall_nr \ -RPM_FAKE_CTX=$S_CONTEXT \ -RPM_FAKE_CAP=$[ ~0x3404040f ] \ +#RPM_FAKE_S_CONTEXT_REV=$scall_rev \ +#RPM_FAKE_S_CONTEXT_NR=$scall_nr \ +RPM_FAKE_CHROOT=$vdir \ +RPM_FAKE_CTX=$ctx \ +RPM_FAKE_CAP=$[ ~0xd40c04ff ] \ LD_PRELOAD=$lib${LD_PRELOAD:+:$LD_PRELOAD} \ exec $bin "$@"