mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #28738 from sathieu/debootstrap_errors
Improve error reporting in mkimage/debootstrap
This commit is contained in:
commit
1c69680641
1 changed files with 26 additions and 1 deletions
|
@ -1,7 +1,21 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
mkimgdeb="$(basename "$0")"
|
||||
mkimg="$(dirname "$0").sh"
|
||||
|
||||
usage() {
|
||||
echo >&2 "usage: $mkimgdeb rootfsDir suite [debootstrap-args]"
|
||||
echo >&2 " note: $mkimgdeb meant to be used from $mkimg"
|
||||
exit 1
|
||||
}
|
||||
|
||||
rootfsDir="$1"
|
||||
if [ -z "$rootfsDir" ]; then
|
||||
echo >&2 "error: rootfsDir is missing"
|
||||
echo >&2
|
||||
usage
|
||||
fi
|
||||
shift
|
||||
|
||||
# we have to do a little fancy footwork to make sure "rootfsDir" becomes the second non-option argument to debootstrap
|
||||
|
@ -13,10 +27,21 @@ while [ $# -gt 0 ] && [[ "$1" == -* ]]; do
|
|||
done
|
||||
|
||||
suite="$1"
|
||||
if [ -z "$suite" ]; then
|
||||
echo >&2 "error: suite is missing"
|
||||
echo >&2
|
||||
usage
|
||||
fi
|
||||
shift
|
||||
|
||||
# get path to "chroot" in our current PATH
|
||||
chrootPath="$(type -P chroot)"
|
||||
chrootPath="$(type -P chroot || :)"
|
||||
if [ -z "$chrootPath" ]; then
|
||||
echo >&2 "error: chroot not found. Are you root?"
|
||||
echo >&2
|
||||
usage
|
||||
fi
|
||||
|
||||
rootfs_chroot() {
|
||||
# "chroot" doesn't set PATH, so we need to set it explicitly to something our new debootstrap chroot can use appropriately!
|
||||
|
||||
|
|
Loading…
Reference in a new issue