Commit 82ab9349 authored by Joey Hess's avatar Joey Hess

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.
parent 03a8b28c
debootstrap (1.0.36) UNRELEASED; urgency=low
* Guess host OS based on uname for non-Debian systems. Closes: #637363
-- Joey Hess <joeyh@debian.org> Mon, 15 Aug 2011 14:14:29 -0400
debootstrap (1.0.35) unstable; urgency=low
[ Robert Millan ]
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment