/usr/bin/env.fakechroot is in fakechroot 2.18-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | #!/bin/sh
# env
#
# Replacement for env command which preserves fakechroot enviroment even with
# --ignore-environment option.
#
# (c) 2013, 2015 Piotr Roszatycki <dexter@debian.org>, LGPL
fakechroot_env_args=
fakechroot_env_extra_args=
fakechroot_env_fakechroot_base=${FAKECHROOT_BASE_ORIG:-$FAKECHROOT_BASE}
fakechroot_env_fakechroot_env=
fakechroot_env_ignore_env=no
fakechroot_env_unset_path=no
fakechroot_env_null=no
fakechroot_env_path=$PATH
help () {
cat << END
Usage: env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]
Set each NAME to VALUE in the environment and run COMMAND.
-i, --ignore-environment start with an empty environment
-0, --null end each output line with 0 byte rather than newline
-u, --unset=NAME remove variable from the environment
--help display this help and exit
--version output version information and exit
A mere - implies -i. If no COMMAND, print the resulting environment.
END
exit 0
}
while [ $# -gt 0 ]; do
case "$1" in
-h|--help)
help
;;
-i|--ignore-environment)
fakechroot_env_ignore_env=yes
shift
;;
-0|--null)
fakechroot_env_null=yes
shift
;;
--unset=*)
fakechroot_env_key=${1#--unset=}
case "$fakechroot_env_key" in
LD_LIBRARY_PATH|LD_PRELOAD) ;;
*) unset $fakechroot_env_key
esac
shift
;;
-u|--unset)
fakechroot_env_key=$2
case "$fakechroot_env_key" in
LD_LIBRARY_PATH|LD_PRELOAD) ;;
*) unset $fakechroot_env_key
esac
shift 2
;;
-)
fakechroot_env_ignore_env=yes
shift
break
;;
*)
break
esac
done
if [ $# -eq 0 ]; then
export | while read line; do
if [ "$line" = "${line#declare -x }" ]; then
continue
fi
fakechroot_env_key="${line#declare -x }"
fakechroot_env_key="${fakechroot_env_key#export }"
fakechroot_env_key="${fakechroot_env_key%%=*}"
printf "%s=" "$fakechroot_env_key"
eval printf "%s" '$'$fakechroot_env_key
if [ $fakechroot_env_null = yes ]; then
printf "\0"
else
printf "\n"
fi
done
else
if [ $fakechroot_env_null = yes ]; then
echo 'env: cannot specify --null (-0) with command' 1>&2
exit 125
fi
if [ $fakechroot_env_ignore_env = yes ]; then
fakechroot_env_keys=`export | while read line; do
if [ "$line" = "${line#declare -x }" ]; then
continue
fi
fakechroot_env_key="${line#declare -x }"
fakechroot_env_key="${fakechroot_env_key#export }"
fakechroot_env_key="${fakechroot_env_key%%=*}"
case "$fakechroot_env_key" in
FAKEROOTKEY|FAKED_MODE|FAKECHROOT|FAKECHROOT_*|LD_LIBRARY_PATH|LD_PRELOAD) ;;
*) echo $fakechroot_env_key
esac
done`
for fakechroot_env_key in $fakechroot_env_keys; do
unset $fakechroot_env_key
done
fi
while [ $# -gt 1 ]; do
case "$1" in
*=*)
fakechroot_env_key=${1%%=*}
eval $1
eval export $fakechroot_env_key
shift
;;
*)
break
esac
done
fakechroot_env_cmd=`PATH=$fakechroot_env_path command -v $1 2>/dev/null`
fakechroot_env_cmd=${fakechroot_env_cmd:-$1}
shift
$fakechroot_env_cmd "$@"
exit $?
fi
exit 0
|