summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xfunctions/chroot.sh9
-rwxr-xr-xfunctions/defaults.sh3
-rwxr-xr-xhelpers/lh_binary_chroot23
-rwxr-xr-xhelpers/lh_bootstrap_debootstrap19
-rwxr-xr-xhelpers/lh_chroot_proc38
-rwxr-xr-xhelpers/lh_chroot_sysfs28
-rwxr-xr-xhelpers/lh_config12
7 files changed, 100 insertions, 32 deletions
diff --git a/functions/chroot.sh b/functions/chroot.sh
index ca48e00..17c5f36 100755
--- a/functions/chroot.sh
+++ b/functions/chroot.sh
@@ -15,7 +15,14 @@ Chroot ()
# Executing commands in chroot
Echo_debug "Executing: ${COMMANDS}"
- ${LH_ROOT_COMMAND} chroot chroot /usr/bin/env -i HOME="/root" PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" TERM="${TERM}" ftp_proxy="${LH_APT_FTP_PROXY}" http_proxy="${LH_APT_HTTP_PROXY}" DEBIAN_FRONTEND="${LH_DEBCONF_FRONTEND}" DEBIAN_PRIORITY="${LH_DEBCONF_PRIORITY}" DEBCONF_NOWARNINGS="${LH_DEBCONF_NOWARNINGS}" XORG_CONFIG="custom" ${COMMANDS}
+
+ if [ "${LH_USE_FAKEROOT}" != "enabled" ]
+ then
+ ${LH_ROOT_COMMAND} chroot chroot /usr/bin/env -i HOME="/root" PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" TERM="${TERM}" ftp_proxy="${LH_APT_FTP_PROXY}" http_proxy="${LH_APT_HTTP_PROXY}" DEBIAN_FRONTEND="${LH_DEBCONF_FRONTEND}" DEBIAN_PRIORITY="${LH_DEBCONF_PRIORITY}" DEBCONF_NOWARNINGS="${LH_DEBCONF_NOWARNINGS}" XORG_CONFIG="custom" ${COMMANDS}
+ else
+ # Building with fakeroot/fakechroot
+ ${LH_ROOT_COMMAND} chroot chroot ${COMMANDS}
+ fi
return "${?}"
}
diff --git a/functions/defaults.sh b/functions/defaults.sh
index c389a6c..cc0747a 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -590,4 +590,7 @@ Set_defaults ()
# Setting image type
LH_SOURCE_IMAGES="${LH_SOURCE_IMAGES:-tar}"
+
+ # Setting fakeroot/fakechroot
+ LH_USE_FAKEROOT="${LH_USE_FAKEROOT:-disabled}"
}
diff --git a/helpers/lh_binary_chroot b/helpers/lh_binary_chroot
index 50d3d67..c0727e0 100755
--- a/helpers/lh_binary_chroot
+++ b/helpers/lh_binary_chroot
@@ -50,12 +50,31 @@ Create_lockfile .lock
# Normally, virtual filesystems are not mounted here, but people tend to be lazy
if [ -f chroot/proc/version ]
then
- ${LH_ROOT_COMMAND} umount chroot/proc
+ if [ "${LH_USE_FAKEROOT}" != "enabled" ]
+then
+ ${LH_ROOT_COMMAND} umount chroot/proc
+ else
+ rm -rf chroot/proc
+ mkdir -p chroot/proc
+ fi
fi
if [ -d chroot/sys/kernel ]
then
- ${LH_ROOT_COMMAND} umount chroot/sys
+ if [ "${LH_USE_FAKEROOT}" != "enabled" ]
+ then
+ ${LH_ROOT_COMMAND} umount chroot/sys
+ else
+ rm -rf chroot/sys
+ mkdir -p chroot/sys
+ fi
+fi
+
+# Copying /dev if using fakeroot
+if [ "${LH_USE_FAKEROOT}" = "enabled" ]
+then
+ rm -rf chroot/dev
+ find /dev | cpio -dmpu chroot
fi
if [ "${LH_CHROOT_BUILD}" = "disabled" ]
diff --git a/helpers/lh_bootstrap_debootstrap b/helpers/lh_bootstrap_debootstrap
index 3ae6075..838a3de 100755
--- a/helpers/lh_bootstrap_debootstrap
+++ b/helpers/lh_bootstrap_debootstrap
@@ -82,15 +82,20 @@ then
DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --exclude=${LH_BOOTSTRAP_EXCLUDE}"
fi
-if [ -z "${LH_BOOTSTRAP_FLAVOUR}" ]
+if [ "${LH_USE_FAKEROOT}" != "enabled" ]
then
- case "${LH_PACKAGES_LISTS}" in
- minimal|mini)
- DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --variant=buildd"
- ;;
- esac
+ if [ -z "${LH_BOOTSTRAP_FLAVOUR}" ]
+ then
+ case "${LH_PACKAGES_LISTS}" in
+ minimal|mini)
+ DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --variant=buildd"
+ ;;
+ esac
+ else
+ DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --variant=${LH_BOOTSTRAP_FLAVOUR}"
+ fi
else
- DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --variant=${LH_BOOTSTRAP_FLAVOUR}"
+ DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --variant=fakechroot"
fi
if [ "${LH_VERBOSE}" = "true" ]
diff --git a/helpers/lh_chroot_proc b/helpers/lh_chroot_proc
index 0dc12ab..7d5688d 100755
--- a/helpers/lh_chroot_proc
+++ b/helpers/lh_chroot_proc
@@ -52,14 +52,20 @@ case "${1}" in
# Creating lock file
Create_lockfile .lock
- # Creating mountpoint
- mkdir -p chroot/proc
+ if [ "${LH_USE_FAKEROOT}" != "enabled" ]
+ then
+ # Creating mountpoint
+ mkdir -p chroot/proc
- # Mounting /proc
- ${LH_ROOT_COMMAND} mount proc-live -t proc chroot/proc
+ # Mounting /proc
+ ${LH_ROOT_COMMAND} mount proc-live -t proc chroot/proc
- # Creating stage file
- Create_stagefile .stage/chroot_proc
+ # Creating stage file
+ Create_stagefile .stage/chroot_proc
+ else
+ rm -rf chroot/proc
+ ln -s /proc chroot/
+ fi
;;
remove)
@@ -69,16 +75,22 @@ case "${1}" in
# Creating lock file
Create_lockfile .lock
- # Workaround binfmt-support /proc locking
- if [ -e chroot/proc/sys/fs/binfmt_misc/status ]
+ if [ "${LH_USE_FAKEROOT}" != "enabled" ]
then
- ${LH_ROOT_COMMAND} umount chroot/proc/sys/fs/binfmt_misc
+ # Workaround binfmt-support /proc locking
+ if [ -e chroot/proc/sys/fs/binfmt_misc/status ]
+ then
+ ${LH_ROOT_COMMAND} umount chroot/proc/sys/fs/binfmt_misc
+ fi
+
+ # Unmounting /proc
+ #fuser -km chroot/proc
+ ${LH_ROOT_COMMAND} umount chroot/proc > /dev/null 2>&1
+ else
+ rm -rf chroot/proc
+ mkdir -p chroot/proc
fi
- # Unmounting /proc
- #fuser -km chroot/proc
- ${LH_ROOT_COMMAND} umount chroot/proc > /dev/null 2>&1
-
# Removing stage file
rm -f .stage/chroot_proc
;;
diff --git a/helpers/lh_chroot_sysfs b/helpers/lh_chroot_sysfs
index f9d1f41..fef710d 100755
--- a/helpers/lh_chroot_sysfs
+++ b/helpers/lh_chroot_sysfs
@@ -52,11 +52,17 @@ case "${1}" in
# Creating lock file
Create_lockfile .lock
- # Create mountpoint
- mkdir -p chroot/sys
-
- # Mounting /sys
- ${LH_ROOT_COMMAND} mount sysfs-live -t sysfs chroot/sys
+ if [ "${LH_USE_FAKEROOT}" != "enabled" ]
+ then
+ # Create mountpoint
+ mkdir -p chroot/sys
+
+ # Mounting /sys
+ ${LH_ROOT_COMMAND} mount sysfs-live -t sysfs chroot/sys
+ else
+ rm -rf chroot/sys
+ ln -s /sys chroot/
+ fi
# Creating stage file
Create_stagefile .stage/chroot_sysfs
@@ -69,9 +75,15 @@ case "${1}" in
# Creating lock file
Create_lockfile .lock
- # Unmounting /sys
- #fuser -km chroot/sys
- ${LH_ROOT_COMMAND} umount chroot/sys > /dev/null 2>&1
+ if [ "${LH_USE_FAKEROOT}" != "enabled" ]
+ then
+ # Unmounting /sys
+ #fuser -km chroot/sys
+ ${LH_ROOT_COMMAND} umount chroot/sys > /dev/null 2>&1
+ else
+ rm -rf chroot/sys
+ mkdir -p chroot/sys
+ fi
# Removing stage file
rm -f .stage/chroot_sysfs
diff --git a/helpers/lh_config b/helpers/lh_config
index bb723ec..f17b300 100755
--- a/helpers/lh_config
+++ b/helpers/lh_config
@@ -88,6 +88,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
\t [--packages PACKAGE|\"PACKAGES\"]\n\
\t [--quiet]\n\
\t [--root-command sudo]\n\
+\t [--use-fakeroot enabled|disabled]\n\
\t [--sections SECTION|\"SECTIONS\"]\n\
\t [--security enabled|disabled]\n\
\t [--source enabled|disabled]\n\
@@ -107,7 +108,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
Local_arguments ()
{
- ARGUMENTS="$(getopt --longoptions apt:,apt-ftp-proxy:,apt-http-proxy:,apt-pdiffs:,apt-pipeline:,apt-recommends:,apt-secure:,bootstrap:,cache:,cache-indices:,cache-packages:,cache-stages:,debconf-frontend:,debconf-nowarnings:,debconf-priority:,genisoimage:,initramfs:,losetup:,mode:,root-command:,tasksel:,includes:,templates:,architecture:,bootstrap-config:,bootstrap-flavour:,bootstrap-keyring:,distribution:,mirror-bootstrap:,mirror-bootstrap-security:,mirror-binary:,mirror-binary-security:,sections:,chroot-filesystem:,union-filesystem:,exposed-root:,hooks:,interactive:,keyring-packages:,language:,linux-flavours:,linux-packages:,packages:,packages-lists:,tasks:,security:,symlinks:,sysvinit:,binary-images:,binary-indices:,bootappend-install:,bootappend-live:,bootloader:,chroot-build:,debian-installer:,debian-installer-daily:,encryption:,grub-splash:,hostname:,iso-application:,iso-preparer:,iso-publisher:,iso-volume:,memtest:,net-root-filesystem:,net-root-mountoptions:,net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:,net-cow-server:,syslinux-splash:,syslinux-timeout:,syslinux-menu:,username:,source:,source-images:,breakpoints,conffile:,debug,force,help,quiet,usage,verbose,version --name=${PROGRAM} --options a:f:d:m:l:k:p:b:e:s:c:huv --shell sh -- "${@}")"
+ ARGUMENTS="$(getopt --longoptions apt:,apt-ftp-proxy:,apt-http-proxy:,apt-pdiffs:,apt-pipeline:,apt-recommends:,apt-secure:,bootstrap:,cache:,cache-indices:,cache-packages:,cache-stages:,debconf-frontend:,debconf-nowarnings:,debconf-priority:,genisoimage:,initramfs:,losetup:,mode:,root-command:,use-fakeroot:,tasksel:,includes:,templates:,architecture:,bootstrap-config:,bootstrap-flavour:,bootstrap-keyring:,distribution:,mirror-bootstrap:,mirror-bootstrap-security:,mirror-binary:,mirror-binary-security:,sections:,chroot-filesystem:,union-filesystem:,exposed-root:,hooks:,interactive:,keyring-packages:,language:,linux-flavours:,linux-packages:,packages:,packages-lists:,tasks:,security:,symlinks:,sysvinit:,binary-images:,binary-indices:,bootappend-install:,bootappend-live:,bootloader:,chroot-build:,debian-installer:,debian-installer-daily:,encryption:,grub-splash:,hostname:,iso-application:,iso-preparer:,iso-publisher:,iso-volume:,memtest:,net-root-filesystem:,net-root-mountoptions:,net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:,net-cow-server:,syslinux-splash:,syslinux-timeout:,syslinux-menu:,username:,source:,source-images:,breakpoints,conffile:,debug,force,help,quiet,usage,verbose,version --name=${PROGRAM} --options a:f:d:m:l:k:p:b:e:s:c:huv --shell sh -- "${@}")"
if [ "${?}" != "0" ]
then
@@ -216,6 +217,11 @@ Local_arguments ()
shift 2
;;
+ --use-fakeroot)
+ LH_USE_FAKEROOT="${2}"
+ shift 2
+ ;;
+
--tasksel)
LH_TASKSEL="${2}"
shift 2
@@ -702,6 +708,10 @@ LH_MODE="${LH_MODE}"
# (Default: empty)
#LH_ROOT_COMMAND="sudo"
+# \$LH_USE_FAKEROOT: use fakeroot/fakechroot
+# (Default: ${LH_USE_FAKEROOT})
+LH_USE_FAKEROOT="${LH_USE_FAKEROOT}"
+
# \$LH_TASKSEL: set tasksel program
# (Default: ${LH_TASKSEL})
LH_TASKSEL="${LH_TASKSEL}"