From 82ab93491c86fa45abc7f4a4b0d18827807244be Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 15 Aug 2011 14:25:03 -0400 Subject: 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. --- debian/changelog | 6 ++++++ debootstrap | 23 +++++++++++++++++++++-- functions | 16 ++++++++-------- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/debian/changelog b/debian/changelog index 3c5d856..22b1927 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +debootstrap (1.0.36) UNRELEASED; urgency=low + + * Guess host OS based on uname for non-Debian systems. Closes: #637363 + + -- Joey Hess Mon, 15 Aug 2011 14:14:29 -0400 + debootstrap (1.0.35) unstable; urgency=low [ Robert Millan ] 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 diff --git a/functions b/functions index 98c7652..67f0c65 100644 --- a/functions +++ b/functions @@ -938,14 +938,14 @@ clear_mtab () { } setup_proc () { - case "$HOST_ARCH" in - kfreebsd-*) + case "$HOST_OS" in + kfreebsd*) umount_on_exit /dev umount_on_exit /proc umount "$TARGET/proc" 2>/dev/null || true in_target mount -t linprocfs proc /proc ;; - hurd-*) + hurd*) ;; *) umount_on_exit /dev/pts @@ -977,10 +977,10 @@ setup_devices () { return 0 fi - case "$HOST_ARCH" in - kfreebsd-*) + case "$HOST_OS" in + kfreebsd*) in_target mount -t devfs devfs /dev ;; - hurd-*) + hurd*) setup_devices_hurd ;; *) if [ -e "$DEVICES_TARGZ" ]; then @@ -1198,8 +1198,8 @@ get_next_predep () { check_sane_mount () { mkdir -p "$1" - case "$HOST_ARCH" in - kfreebsd-*|hurd-*) + case "$HOST_OS" in + kfreebsd*|hurd*) ;; *) mknod "$1/test-dev-null" c 1 3 || return 1 -- cgit v0.12