f4d17450 |
#!/bin/bash
#################################################
# Title: mk-run-chroot #
# Date: 2014-11-26 #
# Version: 1.0 #
# Author: mbassiouny@vmware.com #
# Options: #
################################################# |
cad80a3b |
# Overview
# Run the passed command into the chroot
# End |
f4d17450 |
# |
cad80a3b |
set -o errexit # exit if error...insurance ;
set -o nounset # exit if variable not initalized
set +h # disable hashall |
f4d17450 |
source config.inc |
cad80a3b |
PRGNAME=${0##*/} # script name minus the path
LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}" # set log file name
#LOGFILE=/dev/null # uncomment to disable log file
[ ${EUID} -eq 0 ] || fail "${PRGNAME}: Need to be root user: FAILURE"
[ -z ${BUILDROOT} ] && fail "${PRGNAME}: Build root not set: FAILURE" |
f4d17450 |
# Remove the name of this script from our argument list
#shift
# |
cad80a3b |
# Goto chroot and run the command specified as parameter. |
f4d17450 |
#
chroot "${BUILDROOT}" \ |
cad80a3b |
/usr/bin/env -i \
HOME=/root \
TERM="$TERM" \
PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
/usr/bin/bash --login +h -c "cd installer;$*" |
f4d17450 |
exit 0 |