summaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2007-11-10 18:39:49 +0100
committerDaniel Baumann <daniel@debian.org>2011-03-09 18:22:28 +0100
commitba83790488c83520e656a71003147bda45a8c6f5 (patch)
tree3bf6760140cc4af0264925a1d865a7025392692d /helpers
parentee91e98161fcd14e1c28f659357d33e9fda7019b (diff)
downloadlive-build-ba83790488c83520e656a71003147bda45a8c6f5.zip
live-build-ba83790488c83520e656a71003147bda45a8c6f5.tar.gz
Adding option to allow building in fakeroot/fakechroot environment, thanks to An-Cheng Huang <ancheng@vyatta.com>.
Diffstat (limited to 'helpers')
-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
5 files changed, 89 insertions, 31 deletions
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}"