Commit 083f4fd2 authored by Alessandro Elias's avatar Alessandro Elias
Browse files

Fix how to bind the log, from chroot in the target machine generating isos.


Signed-off-by: Alessandro Elias's avatarAlessandro Elias <ae11@c3sl.ufpr.br>
parent a0ba184a
......@@ -20,6 +20,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
set -x
type initChroot >/dev/null 2>&1 || . common.sh
_DIST=$1
CHROOTDIR=$2
CHROOTFILE=$3
......@@ -35,12 +39,13 @@ SCRIPTSDIR=${12}
SHORTNAME=${13}
SOURCESLISTDEFAULT=${14}
TMP=${15}
LOG_FILE=${16}
PREFIX=$PWD
OVERLAY=$(mktemp --suffix \-overlay --directory)
mkdir --mode=0700 --parents "${OVERLAY}/upper"
mkdir --mode=0700 --parents "${OVERLAY}/work"
mkdir --mode=0700 ${CHROOTDIR}
mkdir --mode=0700 --parents "$CHROOTDIR"
if [ ! -d "${OVERLAY}" ]; then
echo "overlay path: '${OVERLAY}' has not been found."
......@@ -71,3 +76,34 @@ if ! mount -t overlay overlay -o rw,lowerdir="${PREFIX}/chroot",upperdir="${OVER
echo "mount point: '${CHROOTDIR}'" >&2
exit 1
fi
set -x
# Create the log file; this file will be bind to appear in $VARLOG
# directory in the target machine that generates the iso.
touch "${CHROOTDIR}/${LOG_FILE}"
touch "$LOG_FILE"
mount --bind /dev "${CHROOTDIR}/dev"
mount --bind /dev/pts "${CHROOTDIR}/dev/pts"
mount --bind /proc "${CHROOTDIR}/proc"
mount --bind /sys "${CHROOTDIR}/sys"
mount --bind "$LOG_FILE" "${CHROOTDIR}/${LOG_FILE}" ||
log ERROR "Failed to bind log file from: '${LOG_FILE}' to '${CHROOTDIR}/${LOG_FILE}'."
mount --bind "/etc/resolv.conf" "${CHROOTDIR}/etc/resolv.conf"
#chroot ${CHROOTDIR} dbus-uuidgen > ${CHROOTDIR}/var/lib/dbus/machine-id
#Prevent services from being started in the chrooted environment
rm -rf ${CHROOTDIR}/fakebin
chroot ${CHROOTDIR} mkdir /fakebin
chroot ${CHROOTDIR} ln -s /bin/true /fakebin/initctl
chroot ${CHROOTDIR} ln -s /bin/true /fakebin/invoke-rc.d
chroot ${CHROOTDIR} ln -s /bin/true /fakebin/restart
chroot ${CHROOTDIR} ln -s /bin/true /fakebin/start
chroot ${CHROOTDIR} ln -s /bin/true /fakebin/stop
chroot ${CHROOTDIR} ln -s /bin/true /fakebin/service
chroot ${CHROOTDIR} ln -s /bin/true /fakebin/start-stop-daemon
exit 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment