forked from vmware/photon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmk-run-chroot.sh
executable file
·37 lines (34 loc) · 1.21 KB
/
mk-run-chroot.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
#################################################
# Title: mk-run-chroot #
# Date: 2014-11-26 #
# Version: 1.0 #
# Author: [email protected] #
# Options: #
#################################################
# Overview
# Run the passed command into the chroot
# End
#
set -o errexit # exit if error...insurance ;
set -o nounset # exit if variable not initalized
set +h # disable hashall
source config.inc
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"
# Remove the name of this script from our argument list
#shift
#
# Goto chroot and run the command specified as parameter.
#
chroot "${BUILDROOT}" \
/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;$*"
exit 0