6fcfe3b268
* the Makefile uses m4 to build the common lib into the scripts * it includes install, uninstall and clean targets * the dist target creates a source tar from a tag Signed-off-by: Pierre Schmitz <pierre@archlinux.de>
29 lines
407 B
Bash
29 lines
407 B
Bash
#!/bin/bash
|
|
|
|
shopt -s extglob
|
|
|
|
m4_include(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"
|