mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Improve error reporting in mkimage/debootstrap
Signed-off-by: Mathieu Parent <math.parent@gmail.com>
This commit is contained in:
parent
5afdacb20e
commit
ee75c3fca2
1 changed files with 26 additions and 1 deletions
|
@ -1,7 +1,21 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e
|
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"
|
rootfsDir="$1"
|
||||||
|
if [ -z "$rootfsDir" ]; then
|
||||||
|
echo >&2 "error: rootfsDir is missing"
|
||||||
|
echo >&2
|
||||||
|
usage
|
||||||
|
fi
|
||||||
shift
|
shift
|
||||||
|
|
||||||
# we have to do a little fancy footwork to make sure "rootfsDir" becomes the second non-option argument to debootstrap
|
# 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
|
done
|
||||||
|
|
||||||
suite="$1"
|
suite="$1"
|
||||||
|
if [ -z "$suite" ]; then
|
||||||
|
echo >&2 "error: suite is missing"
|
||||||
|
echo >&2
|
||||||
|
usage
|
||||||
|
fi
|
||||||
shift
|
shift
|
||||||
|
|
||||||
# get path to "chroot" in our current PATH
|
# 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() {
|
rootfs_chroot() {
|
||||||
# "chroot" doesn't set PATH, so we need to set it explicitly to something our new debootstrap chroot can use appropriately!
|
# "chroot" doesn't set PATH, so we need to set it explicitly to something our new debootstrap chroot can use appropriately!
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue