]>
git.proxmox.com Git - ceph.git/blob - ceph/qa/setup-chroot.sh
11 $0: sets up a chroot environment for building the ceph server
15 -r [install_dir] location of the root filesystem to install to
16 example: -r /images/sepia/
18 -s [src_dir] location of the directory with the source code
19 example: -s ./src/ceph
24 umount
-l "${INSTALL_DIR}/mnt/tmp"
25 umount
-l "${INSTALL_DIR}/proc"
26 umount
-l "${INSTALL_DIR}/sys"
31 while getopts “hr
:s
:” OPTION
; do
34 r
) INSTALL_DIR
=$OPTARG ;;
41 [ $EUID -eq 0 ] || die
"This script uses chroot, which requires root permissions."
43 [ -d "${INSTALL_DIR}" ] || die
"No such directory as '${INSTALL_DIR}'. \
44 You must specify an install directory with -r"
46 [ -d "${SRC_DIR}" ] || die
"no such directory as '${SRC_DIR}'. \
47 You must specify a source directory with -s"
49 readlink
-f ${SRC_DIR} || die
"readlink failed on ${SRC_DIR}"
50 ABS_SRC_DIR
=`readlink -f ${SRC_DIR}`
52 trap cleanup INT TERM EXIT
54 mount
--bind "${ABS_SRC_DIR}" "${INSTALL_DIR}/mnt/tmp" || die
"bind mount failed"
55 mount
-t proc none
"${INSTALL_DIR}/proc" || die
"mounting proc failed"
56 mount
-t sysfs none
"${INSTALL_DIR}/sys" || die
"mounting sys failed"
58 echo "$0: starting chroot."
59 echo "cd /mnt/tmp before building"
61 chroot
${INSTALL_DIR} env HOME
=/mnt
/tmp
/bin
/bash
63 echo "$0: exiting chroot."