summaryrefslogtreecommitdiffstats
path: root/debootstrap
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2011-08-15 19:43:18 (GMT)
committerJoey Hess <joey@kitenet.net>2011-08-15 19:43:18 (GMT)
commitcdee8b86523d0c381c9615761c0d54730a4a6448 (patch)
tree81dc4ca1e15e4d95b494f92650b195516c4042c3 /debootstrap
parent63c73e7f4444b3a56d517e7d9c68d0647e3ddb9a (diff)
downloaddebootstrap-cdee8b86523d0c381c9615761c0d54730a4a6448.zip
debootstrap-cdee8b86523d0c381c9615761c0d54730a4a6448.tar.gz
debootstrap-cdee8b86523d0c381c9615761c0d54730a4a6448.tar.bz2
Search PATH for programs, rather than checking hardcoded locations.
Generally a good idea, but specifically FreeBSD does not keep gunzip in /bin/
Diffstat (limited to 'debootstrap')
-rwxr-xr-xdebootstrap11
1 files changed, 5 insertions, 6 deletions
diff --git a/debootstrap b/debootstrap
index a0d54b8..278ed64 100755
--- a/debootstrap
+++ b/debootstrap
@@ -391,10 +391,10 @@ fi
###########################################################################
-if [ -x /usr/bin/dpkg ] && \
- /usr/bin/dpkg --print-architecture >/dev/null 2>&1; then
+if in_path dpkg && \
+ dpkg --print-architecture >/dev/null 2>&1; then
HOST_ARCH=`/usr/bin/dpkg --print-architecture`
-elif type udpkg >/dev/null 2>&1 && \
+elif in_path udpkg && \
udpkg --print-architecture >/dev/null 2>&1; then
HOST_ARCH=`/usr/bin/udpkg --print-architecture`
elif [ -e $DEBOOTSTRAP_DIR/arch ]; then
@@ -447,8 +447,7 @@ fi
if [ -z "$SHA_SIZE" ]; then
SHA_SIZE=256
fi
-if ! [ -x "/usr/bin/sha${SHA_SIZE}sum" ] && \
- ! [ -x "/bin/sha${SHA_SIZE}sum" ]; then
+if ! in_path "sha${SHA_SIZE}sum"; then
SHA_SIZE=1
fi
DEBOOTSTRAP_CHECKSUM_FIELD="SHA$SHA_SIZE"
@@ -456,7 +455,7 @@ DEBOOTSTRAP_CHECKSUM_FIELD="SHA$SHA_SIZE"
export ARCH SUITE TARGET CHROOT_CMD SHA_SIZE DEBOOTSTRAP_CHECKSUM_FIELD
if am_doing_phase first_stage second_stage; then
- if [ -x /usr/bin/id ] && [ `id -u` -ne 0 ]; then
+ if in_path id && [ `id -u` -ne 0 ]; then
error 1 NEEDROOT "debootstrap can only run as root"
fi
# Ensure that we can create working devices and executables on the target.