summaryrefslogtreecommitdiffstats
path: root/debootstrap
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2011-08-15 18:25:03 (GMT)
committerJoey Hess <joey@kitenet.net>2011-08-15 18:25:03 (GMT)
commit82ab93491c86fa45abc7f4a4b0d18827807244be (patch)
tree48bcb0f14095967d093d1156670a16108d03e553 /debootstrap
parent03a8b28cc539bd4cec79cea594e36f6149f2f350 (diff)
downloaddebootstrap-82ab93491c86fa45abc7f4a4b0d18827807244be.zip
debootstrap-82ab93491c86fa45abc7f4a4b0d18827807244be.tar.gz
debootstrap-82ab93491c86fa45abc7f4a4b0d18827807244be.tar.bz2
Guess host OS based on uname for non-Debian systems. Closes: #637363
Deboostrap only cares if the host OS is Linux, Hurd, or kFreeBSD. The actual architecture used on the host doesn't matter, as long as the target arch can run in the chroot. This does not address running debootstrap on a FreeBSD system in order to build a kFreeBSD chroot. That seems to have already been not working, since debootstrap checked for kfreebsd, and not freebsd.
Diffstat (limited to 'debootstrap')
-rwxr-xr-xdebootstrap23
1 files changed, 21 insertions, 2 deletions
diff --git a/debootstrap b/debootstrap
index b8da4ee..809c1c0 100755
--- a/debootstrap
+++ b/debootstrap
@@ -29,6 +29,7 @@ DISABLE_KEYRING=""
VARIANT=""
ARCH=""
HOST_ARCH=""
+HOST_OS=""
KEEP_DEBOOTSTRAP_DIR=""
USE_DEBIANINSTALLER_INTERACTION=""
SECOND_STAGE_ONLY=""
@@ -398,14 +399,32 @@ elif type udpkg >/dev/null 2>&1 && \
HOST_ARCH=`/usr/bin/udpkg --print-architecture`
elif [ -e $DEBOOTSTRAP_DIR/arch ]; then
HOST_ARCH=`cat $DEBOOTSTRAP_DIR/arch`
-else
- error 1 WHATARCH "Couldn't work out current architecture"
+fi
+HOST_OS="$HOST_ARCH"
+# basic host OS guessing for non-Debian systems
+if [ -z "$HOST_OS" ]; then
+ case `uname` of
+ Linux)
+ HOST_OS=linux
+ ;;
+ GNU/kFreeBSD)
+ HOST_OS=kfreebsd
+ ;;
+ GNU)
+ HOST_OS=hurd
+ ;;
+ esac
fi
if [ -z "$ARCH" ]; then
ARCH=$HOST_ARCH
fi
+if [ -z "$ARCH" ] || [ -z "$HOST_OS" ]; then
+ error 1 WHATARCH "Couldn't work out current architecture"
+
+fi
+
if [ "$TARGET" = "/" ]; then
CHROOT_CMD=""
elif doing_variant scratchbox; then