future-install-scripts/arch-chroot
2012-06-17 17:52:39 -04:00

29 lines
399 B
Bash
Executable File

#!/bin/bash
shopt -s extglob
. ./common
usage() {
cat <<EOF
usage: ${0##*/} <chroot-dir>
EOF
}
if [[ -z $1 || $1 = @(-h|--help) ]]; then
usage
exit $(( $# ? 0 : 1 ))
fi
[[ -d $1 ]] || die "Can't create chroot on non-directory %s" "$1"
if ! api_fs_mount "$1"; then
api_fs_umount 2>/dev/null
die "failed to setup API filesystems in chroot %s" "$1"
fi
chroot "$@"
api_fs_umount "$1"