Commit 30b43d4c authored by Piotr Roszatycki's avatar Piotr Roszatycki

Imported Upstream version 2.17.1

parent 7fce294a
fakechroot is distributed under the GNU Lesser General Public License (LGPL
2.1 or greater).
Additional copyrights:
dedotdot function taken from mini_httpd - small HTTP server
Copyright (C) 1999,2000 by Jef Poskanzer <jef@mail.acme.com>.
execl function taken from GNU C Library.
Copyright (C) 1991,92,94,97,98,99,2002,2005 Free Software Foundation, Inc.
execle function taken from GNU C Library.
Copyright (C) 1991,97,98,99,2002,2005 Free Software Foundation, Inc.
execlp function taken from GNU C Library.
Copyright (C) 1991,93,96,97,98,99,2002,2005 Free Software Foundation, Inc.
execvp function taken from GNU C Library.
Copyright (C) 1991,92, 1995-99, 2002, 2004, 2005, 2007, 2009
Free Software Foundation, Inc.
fts_* functions taken from OpenBSD.
Copyright (c) 1990, 1993, 1994
The Regents of the University of California.
This software is distributed under the BSD-style license.
ftw function taken from GNU C Library.
Copyright (C) 1996-2004, 2006-2008, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
getcwd_real function taken from OpenBSD.
Copyright (c) 1989, 1991, 1993 The Regents of the University of California.
All rights reserved.
getcwd_real function taken from uClibc.
Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
Licensed under the LGPL v2.1.
__opendir2 function taken from FreeBSD.
Copyright (c) 1983, 1993 The Regents of the University of California.
Copyright (c) 2000 Daniel Eischen.
This software is distributed under the BSD-style license.
popen function taken from OpenBSD.
Copyright (c) 1988, 1993 The Regents of the University of California.
rawmemchr function taken from uClibc
Copyright (C) 2002 Manuel Novoa III
Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
realpath function taken from Gnulib.
Copyright (c) 1996-2010 Free Software Foundation, Inc.
rpl_lstat function taken from Gnulib.
Copyright (C) 1997-2006, 2008-2010 Free Software Foundation, Inc.
setenv, clearenv, unsetenv functions taken from uClibc.
Copyright (C) 1992,95,96,97,98,99,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
modified for uClibc by Erik Andersen <andersen@codepoet.org>
stpcpy function taken from Gnulib.
Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2010 Free Software
Foundation, Inc.
strchrnul function taken from Gnulib.
Copyright (C) 2003, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
strlcpy function taken from OpenBSD.
Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
......@@ -3,7 +3,7 @@ ACLOCAL_AMFLAGS = -I m4
SUBDIRS = man src scripts test
EXTRA_DIST = LICENSE NEWS.md README.md THANKS autogen.sh makedist.sh
EXTRA_DIST = COPYING LICENSE NEWS.md README.md THANKS autogen.sh makedist.sh
test: all
( cd test && $(MAKE) $(AM_MAKEFLAGS) test )
......
......@@ -80,7 +80,7 @@ host_triplet = @host@
subdir = .
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/configure $(am__configure_deps) \
$(srcdir)/config.h.in THANKS build-aux/compile \
$(srcdir)/config.h.in COPYING THANKS build-aux/compile \
build-aux/config.guess build-aux/config.sub \
build-aux/install-sh build-aux/missing build-aux/ltmain.sh \
$(top_srcdir)/build-aux/compile \
......@@ -276,6 +276,8 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
POD2MAN = @POD2MAN@
PROVE = @PROVE@
RANLIB = @RANLIB@
SED = @SED@
......@@ -340,7 +342,7 @@ top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = man src scripts test
EXTRA_DIST = LICENSE NEWS.md README.md THANKS autogen.sh makedist.sh
EXTRA_DIST = COPYING LICENSE NEWS.md README.md THANKS autogen.sh makedist.sh
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
......
## Version 2.17.1
5 Dec 2013
* The `fakechroot`(1) command runs proper wrapper rather than original
command, if it is listed on `FAKECHROOT_CMD_SUBST` variable.
* Fixes were made for `chroot`(8) wrapper. It scanned /etc/ld.so.conf
incorrectly and now enters to physical path, avoiding symlinks.
* The `chroot`(2) function allows to use more than 2048 bytes for
`LD_LIBRARY_PATH` environment variable.
## Version 2.17
24 Nov 2013
......
......@@ -5,6 +5,7 @@
[![Build Status](https://travis-ci.org/dex4er/fakechroot.png?branch=master)](https://travis-ci.org/dex4er/fakechroot)
What is it?
===========
......@@ -14,46 +15,57 @@ users to create own chrooted environment with possibility to install another
packages without need for root privileges.
News
====
### 24 Nov 2013
Version 2.17 is released. The `FAKECHROOT_ELFLOADER` environment variable
changes the default dynamic linker. New `env`(1) wrapper was added. It is safe
to use relative paths which won't escape from fake chroot. Fixes were make for
`readline`(2), `mktemp`(3), `_xftw64`(glibc), `__realpath_chk`(glibc)
functions. New functions `mkostemp`(3), `mkostemp64`(3), `mkostemps`(3),
`mkostemps64`(3), `mkstemps`(3) and `mkstemps64`(3) were implemented.
### 11 Dec 2011
Version 2.16 is released. The fakechroot script loads additional environment
settings from configuration directory (`--config-dir` option). By default
additional settings are provided for `chroot`(8) and `debootstrap`(8)
commands. Wrapped `chroot`(8) command loads `ld.so.conf` paths to
`LD_LIBRARY_PATH` environment variable. Fixes were made for `getpeeraddr`(3)
and `getsockaddr`(3) functions.
### 29 Sep 2011
Version 2.15 is released. New function `faccessat`(2) was added: it fixes
`test -r` command. The `popen`(3) function were reimplemented based on OpenBSD
source to prevent some coredumps with newer GNU C Library.
How does it work?
=================
fakechroot replaces more library functions (`chroot`(2), `open`(2), etc.) by
ones that simulate the effect the real library functions would have had, had
the user really been in chroot. These wrapper functions are in a shared
library `/usr/lib/fakechroot/libfakechroot.so` which is loaded through the
`LD_PRELOAD` mechanism of the dynamic loader. (See `ld.so`(8))
In fake chroot you can install Debian bootstrap with `debootstrap` command.
In this environment you can use i.e. `apt-get`(8) command to install another
packages from common user's account.
fakechroot replaces some libc library functions (`chroot`(2), `open`(2), etc.)
by ones that simulate the effect of being called with root privileges.
These wrapper functions are in a shared library `libfakechroot.so` which is
loaded through the `LD_PRELOAD` mechanism of the dynamic loader. (See
`ld.so`(8))
In fake chroot you can install Debian bootstrap with `debootstrap` command. In
this environment you can use i.e. `apt-get`(8) command to install another
packages. You don't need a special privileges and you can run it from common
user's account.
An example session
==================
```sh
$ id
uid=1000(dexter) gid=1000(dexter) groups=1000(dexter)
$ fakechroot fakeroot debootstrap sid /tmp/sid
I: Retrieving Release
I: Retrieving Release.gpg
I: Checking Release signature
...
I: Base system installed successfully.
$ fakechroot fakeroot chroot /tmp/sid apt-get install -q hello
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
hello
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 57.4 kB of archives.
After this operation, 558 kB of additional disk space will be used.
Get:1 http://ftp.us.debian.org/debian/ sid/main hello amd64 2.8-4 [57.4 kB]
Fetched 57.4 kB in 0s (127 kB/s)
Selecting previously unselected package hello.
(Reading database ... 24594 files and directories currently installed.)
Unpacking hello (from .../archives/hello_2.8-4_amd64.deb) ...
Processing triggers for man-db ...
Processing triggers for install-info ...
Setting up hello (2.8-4) ...
$ fakechroot chroot /tmp/sid hello
Hello, world!
```
Where is it used?
......@@ -69,6 +81,5 @@ fakechroot had found another purposes:
* to be a supporter for [pbuilder](http://pbuilder.alioth.debian.org/) building system
* to be a supporter for [Apport](https://wiki.ubuntu.com/Apport) retracer
* to be a supporter for [libguestfs tools](http://libguestfs.org/) for accessing and modifying virtual machine disk images
* to be a part of [Slind](https://www.slind.org/Main_Page) - a minimal Debian-based distro for embedded devices as libfakechroot-cross project
* to be a supporter for [febootstrap](http://et.redhat.com/~rjones/febootstrap/), the tool which can set up new Fedora system.
* to be a part of [cuntubuntu](https://play.google.com/store/apps/details?id=com.cuntubuntu) - Ubuntu for Android without root
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for fakechroot 2.17.
# Generated by GNU Autoconf 2.69 for fakechroot 2.17.1.
#
# Report bugs to <dexter@debian.org>.
#
......@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='fakechroot'
PACKAGE_TARNAME='fakechroot'
PACKAGE_VERSION='2.17'
PACKAGE_STRING='fakechroot 2.17'
PACKAGE_VERSION='2.17.1'
PACKAGE_STRING='fakechroot 2.17.1'
PACKAGE_BUGREPORT='dexter@debian.org'
PACKAGE_URL='http://fakechroot.alioth.debian.org/'
......@@ -639,6 +639,7 @@ LIBOBJS
ALLOCA
HAVE_VISIBILITY
CFLAG_VISIBILITY
PERL
LDD
LDCONFIG
ISCHROOT
......@@ -647,6 +648,7 @@ ECHO
CHROOT
SEQ
PROVE
POD2MAN
libpath
CPP
OTOOL64
......@@ -1327,7 +1329,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures fakechroot 2.17 to adapt to many kinds of systems.
\`configure' configures fakechroot 2.17.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1397,7 +1399,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of fakechroot 2.17:";;
short | recursive ) echo "Configuration of fakechroot 2.17.1:";;
esac
cat <<\_ACEOF
......@@ -1509,7 +1511,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
fakechroot configure 2.17
fakechroot configure 2.17.1
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
......@@ -2043,7 +2045,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by fakechroot $as_me 2.17, which was
It was created by fakechroot $as_me 2.17.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
......@@ -2912,7 +2914,7 @@ fi
# Define the identity of the package.
PACKAGE='fakechroot'
VERSION='2.17'
VERSION='2.17.1'
cat >>confdefs.h <<_ACEOF
......@@ -12530,6 +12532,48 @@ else
$as_echo "no, using $LN_S" >&6; }
fi
for ac_prog in pod2man
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_POD2MAN+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$POD2MAN"; then
ac_cv_prog_POD2MAN="$POD2MAN" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_POD2MAN="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
POD2MAN=$ac_cv_prog_POD2MAN
if test -n "$POD2MAN"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $POD2MAN" >&5
$as_echo "$POD2MAN" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$POD2MAN" && break
done
for ac_prog in prove
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
......@@ -12866,6 +12910,90 @@ $as_echo "no" >&6; }
fi
# Extract the first word of "perl", so it can be a program name with args.
set dummy perl; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_PERL+:} false; then :
$as_echo_n "(cached) " >&6
else
case $PERL in
[\\/]* | ?:[\\/]*)
ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_dummy="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:$PATH"
for as_dir in $as_dummy
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="/usr/bin/perl"
;;
esac
fi
PERL=$ac_cv_path_PERL
if test -n "$PERL"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5
$as_echo "$PERL" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
# Extract the first word of "bash ksh sh", so it can be a program name with args.
set dummy bash ksh sh; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_SHELL+:} false; then :
$as_echo_n "(cached) " >&6
else
case $SHELL in
[\\/]* | ?:[\\/]*)
ac_cv_path_SHELL="$SHELL" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
as_dummy="/usr/sbin:/sbin:/usr/bin:/bin:/usr/local/bin:/usr/local/sbin:$PATH"
for as_dir in $as_dummy
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_SHELL="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
test -z "$ac_cv_path_SHELL" && ac_cv_path_SHELL="/bin/sh"
;;
esac
fi
SHELL=$ac_cv_path_SHELL
if test -n "$SHELL"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $SHELL" >&5
$as_echo "$SHELL" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
# Checks for compilator features
......@@ -16021,7 +16149,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by fakechroot $as_me 2.17, which was
This file was extended by fakechroot $as_me 2.17.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -16088,7 +16216,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
fakechroot config.status 2.17
fakechroot config.status 2.17.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
......
AC_PREREQ(2.64)
AC_INIT([fakechroot], [2.17], [dexter@debian.org], [fakechroot], [http://fakechroot.alioth.debian.org/])
AC_INIT([fakechroot], [2.17.1], [dexter@debian.org], [fakechroot], [http://fakechroot.alioth.debian.org/])
AC_CONFIG_SRCDIR([src/libfakechroot.c])
AC_CONFIG_AUX_DIR([build-aux])
......@@ -37,6 +37,7 @@ AC_PROG_MAKE_SET
AM_PROG_LIBTOOL
AC_PROG_CC
AC_PROG_LN_S
AC_CHECK_PROGS([POD2MAN], [pod2man])
AC_CHECK_PROGS([PROVE], [prove])
AC_CHECK_PROGS([SEQ], [seq gseq])
AC_PATH_PROG([CHROOT], [chroot], [/usr/sbin/chroot], [/usr/sbin:/sbin:/usr/bin:/bin:/usr/local/bin:/usr/local/sbin:$PATH])
......@@ -45,6 +46,8 @@ AC_PATH_PROG([ENV], [env], [/usr/bin/env], [/usr/bin:/bin:/usr/sbin:/sbin:/usr/l
AC_PATH_PROG([ISCHROOT], [ischroot], [/usr/bin/ischroot], [/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:$PATH])
AC_PATH_PROG([LDCONFIG], [ldconfig], [/sbin/chroot], [/usr/sbin:/sbin:/usr/bin:/bin:/usr/local/bin:/usr/local/sbin:$PATH])
AC_PATH_PROG([LDD], [ldd], [/usr/bin/ldd], [/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:$PATH])
AC_PATH_PROG([PERL], [perl], [/usr/bin/perl], [/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:$PATH])
AC_PATH_PROG([SHELL], [bash ksh sh], [/bin/sh], [/usr/sbin:/sbin:/usr/bin:/bin:/usr/local/bin:/usr/local/sbin:$PATH])
# Checks for compilator features
ACX_CHECK_C_ALIGNOF
......
......@@ -3,4 +3,4 @@ man_MANS = fakechroot.1
EXTRA_DIST = $(man_MANS) fakechroot.pod
fakechroot.1: fakechroot.pod
eval pod2man `head -n1 $(srcdir)/fakechroot.pod | sed 's/^# pod2man //'` $(srcdir)/fakechroot.pod > $@
eval $(POD2MAN) `head -n1 $(srcdir)/fakechroot.pod | sed 's/^# pod2man //'` $(srcdir)/fakechroot.pod $@
......@@ -217,6 +217,8 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
POD2MAN = @POD2MAN@
PROVE = @PROVE@
RANLIB = @RANLIB@
SED = @SED@
......@@ -521,7 +523,7 @@ uninstall-man: uninstall-man1
fakechroot.1: fakechroot.pod
eval pod2man `head -n1 $(srcdir)/fakechroot.pod | sed 's/^# pod2man //'` $(srcdir)/fakechroot.pod > $@
eval $(POD2MAN) `head -n1 $(srcdir)/fakechroot.pod | sed 's/^# pod2man //'` $(srcdir)/fakechroot.pod $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
......
This diff is collapsed.
This diff is collapsed.
......@@ -22,6 +22,8 @@ do_subst = sed -e 's,[@]bindir[@],$(bindir),g' \
-e 's,[@]ISCHROOT[@],$(ISCHROOT),g' \
-e 's,[@]LDCONFIG[@],$(LDCONFIG),g' \
-e 's,[@]LDD[@],$(LDD),g' \
-e 's,[@]PERL[@],$(PERL),g' \
-e 's,[@]SHELL[@],$(SHELL),g' \
-e 's,[@]VERSION[@],$(VERSION),g'
chroot.env: $(srcdir)/chroot.env.sh
......
......@@ -219,6 +219,8 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL = @PERL@
POD2MAN = @POD2MAN@
PROVE = @PROVE@
RANLIB = @RANLIB@
SED = @SED@
......@@ -299,6 +301,8 @@ do_subst = sed -e 's,[@]bindir[@],$(bindir),g' \
-e 's,[@]ISCHROOT[@],$(ISCHROOT),g' \
-e 's,[@]LDCONFIG[@],$(LDCONFIG),g' \
-e 's,[@]LDD[@],$(LDD),g' \
-e 's,[@]PERL[@],$(PERL),g' \
-e 's,[@]SHELL[@],$(SHELL),g' \
-e 's,[@]VERSION[@],$(VERSION),g'
all: all-am
......
# Additional environment setting for chroot
# Add /usr/sbin and /sbin to PATH if chroot command can't be found
if ! command -v chroot >/dev/null; then
PATH="${PATH:-/usr/bin:/bin}:/usr/sbin:/sbin"
export PATH
fi
# Set a list of command substitutions based on PATH variable
fakechroot_chroot_env_cmd_subst=""
for fakechroot_chroot_env_d in `echo $PATH | tr ':' ' '`; do
fakechroot_chroot_env_cmd_subst="$fakechroot_chroot_env_cmd_subst
$fakechroot_chroot_env_d/chroot=@sbindir@/chroot.fakechroot
$fakechroot_chroot_env_d/env=@bindir@/env.fakechroot
......@@ -16,9 +16,10 @@ for fakechroot_chroot_env_d in `echo $PATH | tr ':' ' '`; do
$fakechroot_chroot_env_d/ldconfig=/bin/true
$fakechroot_chroot_env_d/ldd=@bindir@/ldd.fakechroot
"
done
FAKECHROOT_CMD_SUBST="${FAKECHROOT_CMD_SUBST:+$FAKECHROOT_CMD_SUBST:}`echo $fakechroot_chroot_env_cmd_subst | tr ' ' ':'`"
export FAKECHROOT_CMD_SUBST
# Set the default list of directories excluded from being chrooted
FAKECHROOT_EXCLUDE_PATH="${FAKECHROOT_EXCLUDE_PATH:-/dev:/proc:/sys}"
FAKECHROOT_CMD_SUBST="${FAKECHROOT_CMD_SUBST:+$FAKECHROOT_CMD_SUBST:}`echo $fakechroot_chroot_env_cmd_subst | tr ' ' ':'`"
export FAKECHROOT_EXCLUDE_PATH FAKECHROOT_CMD_SUBST
export FAKECHROOT_EXCLUDE_PATH
#!/bin/sh
#!@SHELL@
# chroot
#
......@@ -19,7 +19,7 @@ fakechroot_chroot_load_ldsoconf () {
sed -e 's/#.*//' -e '/^ *$/d' "$fakechroot_chroot_newroot$fakechroot_chroot_file" 2>/dev/null | while read fakechroot_chroot_line; do
case "$fakechroot_chroot_line" in
include*)
include=`echo "$fakechroot_chroot_line" | sed -e 's/^include *//' -e 's/ *$//'`
fakechroot_chroot_include=`echo "$fakechroot_chroot_line" | sed -e 's/^include *//' -e 's/ *$//'`
for fakechroot_chroot_incfile in `eval echo $fakechroot_chroot_newroot$fakechroot_chroot_include`; do
fakechroot_chroot_incfile="${fakechroot_chroot_incfile#$fakechroot_chroot_newroot}"
fakechroot_chroot_load_ldsoconf "$fakechroot_chroot_incfile" "$fakechroot_chroot_newroot"
......@@ -34,23 +34,29 @@ fakechroot_chroot_load_ldsoconf () {
done
}
fakechroot_chroot_chroot="${FAKECHROOT_CMD_ORIG:-chroot}"
fakechroot_chroot_base="$FAKECHROOT_BASE_ORIG"
fakechroot_chroot_n=1
for fakechroot_chroot_opt in "$@"; do
case "$fakechroot_chroot_opt" in
-*)
continue
;;
*)
fakechroot_chroot_newroot="$1"
fakechroot_chroot_newroot="$fakechroot_chroot_opt"
break
;;
esac
fakechroot_chroot_n=$(($fakechroot_chroot_n + 1))
done
if [ -n "$fakechroot_chroot_newroot" ]; then
if [ -d "$fakechroot_chroot_newroot" ]; then
fakechroot_chroot_newroot=`cd "$fakechroot_chroot_opt"; pwd -P`
fakechroot_chroot_paths=
# append newroot to each directory from original LD_LIBRARY_PATH
......@@ -74,5 +80,14 @@ if [ -n "$fakechroot_chroot_newroot" ]; then
fi
# call real chroot
env -u FAKECHROOT_BASE_ORIG FAKECHROOT_CMD_ORIG= LD_LIBRARY_PATH="$fakechroot_chroot_paths" FAKECHROOT_BASE="$fakechroot_chroot_base" "$fakechroot_chroot_chroot" "$@"
exit $?
if [ -n "$fakechroot_chroot_newroot" ] && ( test "$1" = "${@:1:$((1+0))}" ) 2>/dev/null && [ $fakechroot_chroot_n -le $# ]; then
# shell with arrays and built-in expr
env -u FAKECHROOT_BASE_ORIG FAKECHROOT_CMD_ORIG= LD_LIBRARY_PATH="$fakechroot_chroot_paths" FAKECHROOT_BASE="$fakechroot_chroot_base" \
"$fakechroot_chroot_chroot" "${@:1:$(($fakechroot_chroot_n - 1))}" "${fakechroot_chroot_newroot#$FAKECHROOT_BASE_ORIG}" "${@:$(($fakechroot_chroot_n + 1))}"
exit $?
else
# POSIX shell
env -u FAKECHROOT_BASE_ORIG FAKECHROOT_CMD_ORIG= LD_LIBRARY_PATH="$fakechroot_chroot_paths" FAKECHROOT_BASE="$fakechroot_chroot_base" \
"$fakechroot_chroot_chroot" "$@"
exit $?
fi
# Additional environment setting for debootstrap
# Add /usr/sbin and /sbin to PATH if chroot command can't be found
if ! command -v chroot >/dev/null; then
PATH="${PATH:-/usr/bin:/bin}:/usr/sbin:/sbin"
export PATH
fi
# Set a list of command substitutions needed by debootstrap
fakechroot_debootstrap_env_cmd_subst="
/bin/mount=/bin/true
/sbin/devfs=/bin/true
......@@ -11,13 +18,24 @@ fakechroot_debootstrap_env_cmd_subst="
/var/lib/dpkg/info/freebsd-utils.postinst=/bin/true
/var/lib/dpkg/info/kbdcontrol.postinst=/bin/true
"
FAKECHROOT_CMD_SUBST="${FAKECHROOT_CMD_SUBST:+$FAKECHROOT_CMD_SUBST:}$(echo $fakechroot_debootstrap_env_cmd_subst | tr ' ' ':')"
export FAKECHROOT_CMD_SUBST
# Set the default list of directories excluded from being chrooted
FAKECHROOT_EXCLUDE_PATH="${FAKECHROOT_EXCLUDE_PATH:-/dev:/proc:/sys}"
export FAKECHROOT_EXCLUDE_PATH
# Change path for unix sockets because we don't want to exceed 108 bytes
FAKECHROOT_AF_UNIX_PATH=/tmp
FAKECHROOT_CMD_SUBST="${FAKECHROOT_CMD_SUBST:+$FAKECHROOT_CMD_SUBST:}$(echo $fakechroot_debootstrap_env_cmd_subst | tr ' ' ':')"
export FAKECHROOT_EXCLUDE_PATH FAKECHROOT_AF_UNIX_PATH FAKECHROOT_CMD_SUBST
export FAKECHROOT_AF_UNIX_PATH
if ! command -v chroot >/dev/null; then
PATH="${PATH:-/usr/bin:/bin}:/usr/sbin:/sbin"
export PATH
# Set the LD_LIBRARY_PATH based on host's /etc/ld.so.conf.d/*
fakechroot_debootstrap_env_paths=`
cat /etc/ld.so.conf /etc/ld.so.conf.d/* 2>/dev/null | grep ^/ | while read fakechroot_debootstrap_env_d; do
printf '%s:' "$fakechroot_debootstrap_env_d"
done
`
if [ -n "$fakechroot_debootstrap_env_paths" ]; then
LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}${fakechroot_debootstrap_env_paths%:}"
export LD_LIBRARY_PATH
fi
#!/bin/sh
#!@SHELL@
# fakechroot
#
......@@ -180,13 +180,34 @@ if [ "$fakechroot_environment" != "none" ]; then
fi
# Check if substituted command is called
fakechroot_cmd=`command -v "$1"`
fakechroot_cmd_wrapper=`
IFS=:
for fakechroot_cmd_subst in $FAKECHROOT_CMD_SUBST; do
case "$fakechroot_cmd_subst" in
"$fakechroot_cmd="*)
echo "${fakechroot_cmd_subst#*=}"
break 2
;;
esac
done
`
fakechroot_cmd=${fakechroot_cmd_wrapper:-$1}
# Execute command
if [ -z "$*" ]; then
LD_LIBRARY_PATH="$fakechroot_paths" LD_PRELOAD="$fakechroot_lib" ${SHELL:-/bin/sh}
fakechroot_result=$?
exit $?
else
LD_LIBRARY_PATH="$fakechroot_paths" LD_PRELOAD="$fakechroot_lib" "$@"
fakechroot_result=$?
if [ -n "$fakechroot_cmd" ] && ( test "$1" = "${@:1:$((1+0))}" ) 2>/dev/null && [ $# -gt 0 ]; then
# shell with arrays and built-in expr
LD_LIBRARY_PATH="$fakechroot_paths" LD_PRELOAD="$fakechroot_lib" "$fakechroot_cmd" "${@:2}"
exit $?
else
# POSIX shell
LD_LIBRARY_PATH="$fakechroot_paths" LD_PRELOAD="$fakechroot_lib" "$@"
exit $?
fi
fi
exit $fakechroot_result
#!/usr/bin/perl
#!@PERL@
# fakeldd
#
......
# Additional environment setting for rinse
# Add /usr/sbin and /sbin to PATH if chroot command can't be found
if ! command -v chroot >/dev/null; then
PATH="${PATH:-/usr/bin:/bin}:/usr/sbin:/sbin"
export PATH
fi
# Set a list of command substitutions needed by rinse
fakechroot_rinse_env_cmd_subst="
/bin/mount=/bin/true
/sbin/ldconfig=/bin/true
......@@ -12,13 +19,12 @@ fakechroot_rinse_env_cmd_subst="
/usr/sbin/libgcc_post_upgrade=/bin/true
/usr/sbin/nscd=/bin/true
"
FAKECHROOT_CMD_SUBST="${FAKECHROOT_CMD_SUBST:+$FAKECHROOT_CMD_SUBST:}$(echo $fakechroot_rinse_env_cmd_subst | tr ' ' ':')"
# Set the default list of directories excluded from being chrooted
FAKECHROOT_EXCLUDE_PATH="${FAKECHROOT_EXCLUDE_PATH:-/dev:/proc:/sys}"
FAKECHROOT_AF_UNIX_PATH=/tmp
FAKECHROOT_CMD_SUBST="${FAKECHROOT_CMD_SUBST:+$FAKECHROOT_CMD_SUBST:}$(echo $fakechroot_rinse_env_cmd_subst | tr ' ' ':')"
export FAKECHROOT_EXCLUDE_PATH FAKECHROOT_AF_UNIX_PATH FAKECHROOT_CMD_SUBST
export FAKECHROOT_EXCLUDE_PATH
if ! command -v chroot >/dev/null; then
PATH="${PATH:-/usr/bin:/bin}:/usr/sbin:/sbin"