#!/bin/sh

#Because Fakeroot starts faked with
#  VPATH='chop("/bin/")=:/usr/lib/libtricks/:/bin'
#this script will be used in favour of the real su binary in /bin.
#
#


#Yes, I know su does a lot more than this.
#But I don't feel like implementing all that.

USER=${1:-root}
COMMAND=${2:-/bin/sh}

USERID=`grep $USER: /etc/passwd|cut -f3 -d:`
if test -z "$USERID"; then
  echo "su: user $USER does not exist"
  exit 1
fi

FAKEROOTUID=$USERID FAKEROOTEUD=$USERID $COMMAND
