From 32322960234c8ec91e0d42835a3ec5ee63305070 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 2 Feb 2019 11:00:00 +0100 Subject: Adding upstream version 20190202. Signed-off-by: Daniel Baumann --- system-build/functions/chroot_bind_path.sh | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 system-build/functions/chroot_bind_path.sh (limited to 'system-build/functions/chroot_bind_path.sh') diff --git a/system-build/functions/chroot_bind_path.sh b/system-build/functions/chroot_bind_path.sh new file mode 100755 index 0000000..b296f69 --- /dev/null +++ b/system-build/functions/chroot_bind_path.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2015 Daniel Baumann +## +## This program 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. + + +Chroot_bind_path () +{ + CHROOT="$(readlink -f ${1})" + BIND_SRC="$(readlink -f ${2})" + + BIND_DEST=$(echo "${BIND_SRC}" | sed -e 's|/\+||') + if [ ! -d "${CHROOT}/${BIND_DEST}" -o \ + -z "$(cat /proc/mounts | awk -vdir="${CHROOT}/${BIND_DEST}" '$2 ~ dir { print $2}')" ] + then + Echo_message "Binding local repository path" + mkdir -p "${CHROOT}/${BIND_DEST}" + mount --bind "${LB_PARENT_MIRROR_CHROOT#file:}" \ + "${CHROOT}/${BIND_DEST}" + fi +} + +Chroot_unbind_path () +{ + CHROOT="$(readlink -f ${1})" + BIND_SRC="$(readlink -f ${2})" + + BIND_DEST=$(echo "${BIND_SRC}" | sed -e 's|/\+||') + if [ -d "${CHROOT}/${BIND_DEST}" ] + then + Echo_message "Unbinding local repository path" + umount "${CHROOT}/${BIND_DEST}" > /dev/null 2>&1 || true + fi +} -- cgit v1.2.3