From e87e89a9567b2052fd233b5dec964f726c66b0f2 Mon Sep 17 00:00:00 2001 From: Christian Rößler Date: Thu, 20 Mar 2014 17:10:04 +0100 Subject: [chroot.inc] Added parameter to bind-remount --- remote/includes/chroot.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'remote/includes') diff --git a/remote/includes/chroot.inc b/remote/includes/chroot.inc index f0940bba..f6581680 100644 --- a/remote/includes/chroot.inc +++ b/remote/includes/chroot.inc @@ -50,8 +50,8 @@ chroot_prepare_dirs() { chroot_prepare_mounts() { # first mount / on CHROOT_BINDDIR and remount read-only - mount -o bind "${CHROOT_LOWERDIR}" "${CHROOT_BINDDIR}" || perror "Could not bind-mount '$CHROOT_LOWERDIR' to '$CHROOT_BINDDIR'." - mount -o remount,ro "${CHROOT_BINDDIR}" || perror "Could not remount '$CHROOT_BINDDIR' read-only." + mount -o bind "${CHROOT_LOWERDIR}" "${CHROOT_BINDDIR}" || perror "Could not bind-mount '$CHROOT_LOWERDIR' to '$CHROOT_BINDDIR'." + mount -o remount,ro,bind "${CHROOT_BINDDIR}" || perror "Could not remount '$CHROOT_BINDDIR' read-only." # check that it really is read-only [ "x$(mount | grep -E "^/ on ${CHROOT_BINDDIR}" | grep -v '\(.*ro.*\)')" != "x" ] && perror "'${CHROOT_BINDDIR}' is not read-only! Aborting..." -- cgit v1.2.3-55-g7522 From 52c75b7e40c9655495418c0c776bafefd75bc458 Mon Sep 17 00:00:00 2001 From: Christian Rößler Date: Fri, 21 Mar 2014 15:01:32 +0100 Subject: [logging.inc, chroot.inc] Some redirections for debugging within a chroot --- helper/logging.inc | 2 ++ remote/includes/chroot.inc | 3 ++- remote/modules/vmware/vmware.build | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'remote/includes') diff --git a/helper/logging.inc b/helper/logging.inc index eb20775c..8b102d4c 100644 --- a/helper/logging.inc +++ b/helper/logging.inc @@ -10,6 +10,8 @@ LOG_DIR=${ROOT_DIR}/logs mkdir -p "$LOG_DIR" +exec 8>&0 # This redirection is used for chroot debugging + set_quiet () { if [ "x$MLTK_QUIET" != "x1" ]; then exec 6>&1 > "$LOG_DIR/stdout.log" diff --git a/remote/includes/chroot.inc b/remote/includes/chroot.inc index f6581680..fc9738ec 100644 --- a/remote/includes/chroot.inc +++ b/remote/includes/chroot.inc @@ -72,7 +72,7 @@ chroot_gen_autoexec() { # create the script to be automatically executed. cat >"${CHROOT_MOUNTDIR}/autoexec.bat"<<-EOF #!/bin/bash - echo "chroot success." + echo "chroot started successfully." EOF # dump the piped input to it @@ -128,6 +128,7 @@ chroot_run() { chroot_gen_autoexec || perror "'chroot_gen_autoexec' failed with $?." # do the chroot + exec 0>&8 chroot --userspec root:root "${CHROOT_MOUNTDIR}" /autoexec.bat local RET=$? if [ "$RET" -eq 0 ]; then diff --git a/remote/modules/vmware/vmware.build b/remote/modules/vmware/vmware.build index 8636f335..8dba3c11 100644 --- a/remote/modules/vmware/vmware.build +++ b/remote/modules/vmware/vmware.build @@ -21,16 +21,17 @@ fetch_source() { } build() { - # prepare the build directory with the files needed during the chroot cp "${MODULE_DIR}/src/$VMWARE_BUNDLE_FILE" "${MODULE_BUILD_DIR}/$VMWARE_BUNDLE_FILE" cp -r "${MODULE_DIR}/patches" "${MODULE_BUILD_DIR}" pinfo "Installing vmware per chroot..." chroot_run "${MODULE_BUILD_DIR}" <<-EOF + # PS1='\[\e[1;33m\](chroot) \u@\h:\w\$ \[\e[1;32m\]' /bin/bash -norc # un-comment for debugging within chroot yes | sh /"${VMWARE_BUNDLE_FILE}" --eulas-agreed --console --required vmware-modconfig --console --build-mod -k "${SYS_UTS_RELEASE}" vmnet $(which gcc) "${MODULES_DIR}"/kernel/ksrc/include/ vmplayer vmnet vmware-modconfig --console --build-mod -k "${SYS_UTS_RELEASE}" vmmon $(which gcc) "${MODULES_DIR}"/kernel/ksrc/include/ vmplayer vmmon + PS1='\[\e[1;33m\](chroot) \u@\h:\w\$ \[\e[1;32m\]' /bin/bash -norc # un-comment for debugging within chroot EOF # cleanup unneeded files -- cgit v1.2.3-55-g7522