2007-09-23 08:04:46 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-09-02 11:12:37 +00:00
|
|
|
## live-build(7) - System Build Scripts
|
2012-02-04 19:41:41 -01:00
|
|
|
## Copyright (C) 2006-2012 Daniel Baumann <daniel@debian.org>
|
2010-09-02 11:12:37 +00:00
|
|
|
##
|
|
|
|
## live-build comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
|
|
|
|
## This is free software, and you are welcome to redistribute it
|
|
|
|
## under certain conditions; see COPYING for details.
|
|
|
|
|
2007-09-23 08:04:46 +00:00
|
|
|
|
|
|
|
Chroot ()
|
|
|
|
{
|
2008-10-28 14:44:06 -01:00
|
|
|
CHROOT="${1}"; shift
|
2008-02-24 13:19:41 -01:00
|
|
|
COMMANDS="${@}"
|
2007-09-23 08:04:46 +00:00
|
|
|
|
|
|
|
# Executing commands in chroot
|
2008-08-11 20:28:54 +00:00
|
|
|
Echo_debug "Executing: %s" "${COMMANDS}"
|
2007-11-10 16:39:49 -01:00
|
|
|
|
2012-05-24 07:41:27 +00:00
|
|
|
if [ -e config/environment.chroot ]
|
|
|
|
then
|
2012-05-31 11:16:19 +00:00
|
|
|
ENV="$(grep -v '^#' config/environment.chroot)"
|
2012-05-24 07:41:27 +00:00
|
|
|
else
|
|
|
|
ENV=""
|
|
|
|
fi
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ "${LB_USE_FAKEROOT}" != "true" ]
|
2007-11-10 16:39:49 -01:00
|
|
|
then
|
2012-05-31 11:19:36 +00:00
|
|
|
${LB_ROOT_COMMAND} ${_LINUX32} chroot "${CHROOT}" /usr/bin/env -i HOME="/root" PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" TERM="${TERM}" DEBIAN_FRONTEND="${LB_DEBCONF_FRONTEND}" DEBIAN_PRIORITY="${LB_DEBCONF_PRIORITY}" DEBCONF_NOWARNINGS="${LB_DEBCONF_NOWARNINGS}" ${ENV} ${COMMANDS}
|
2007-11-10 16:39:49 -01:00
|
|
|
else
|
|
|
|
# Building with fakeroot/fakechroot
|
2012-05-24 07:41:27 +00:00
|
|
|
${LB_ROOT_COMMAND} ${_LINUX32} chroot "${CHROOT}" ${ENV} ${COMMANDS}
|
2007-11-10 16:39:49 -01:00
|
|
|
fi
|
2007-09-23 08:05:09 +00:00
|
|
|
|
|
|
|
return "${?}"
|
2007-09-23 08:04:46 +00:00
|
|
|
}
|