--- functions.orig 2011-05-20 19:57:18.000000000 +0200 +++ functions 2011-07-15 17:15:49.989386001 +0200 @@ -236,9 +236,17 @@ local expchecksum="$2" local expsize="$3" if [ "$DEBOOTSTRAP_CHECKSUM_FIELD" = "MD5SUM" ]; then - relchecksum=`md5sum < "$1" | sed 's/ .*$//'` + if [ "`uname -s`" = "FreeBSD" ]; then + relchecksum=`md5 < "$1"` + else + relchecksum=`md5sum < "$1" | sed 's/ .*$//'` + fi else - relchecksum=`sha${SHA_SIZE}sum < "$1" | sed 's/ .*$//'` + if [ "`uname -s`" = "FreeBSD" ]; then + relchecksum=`sha${SHA_SIZE} < "$1"` + else + relchecksum=`sha${SHA_SIZE}sum < "$1" | sed 's/ .*$//'` + fi fi relsize=`wc -c < "$1"` if [ "$expsize" -ne "$relsize" ] || [ "$expchecksum" != "$relchecksum" ]; then @@ -524,9 +532,9 @@ local i= if [ "$normi" != "" ]; then i="$normi" - elif [ -x /bin/bunzip2 ] && [ "$bz2i" != "" ]; then + elif [ -x /bin/bunzip2 -o -x /usr/bin/bunzip2 ] && [ "$bz2i" != "" ]; then i="$bz2i" - elif [ -x /bin/gunzip ] && [ "$gzi" != "" ]; then + elif [ -x /bin/gunzip -o -x /usr/bin/gunzip ] && [ "$gzi" != "" ]; then i="$gzi" fi if [ "$i" != "" ]; then @@ -552,11 +560,11 @@ ext="$ext $normi ." i="$normi" fi - if [ -x /bin/bunzip2 ] && [ "$bz2i" != "" ]; then + if [ -x /bin/bunzip2 -o -x /usr/bin/bunzip2 ] && [ "$bz2i" != "" ]; then ext="$ext $bz2i bz2" i="${i:-$bz2i}" fi - if [ -x /bin/gunzip ] && [ "$gzi" != "" ]; then + if [ -x /bin/gunzip -o -x /usr/bin/gunzip ] && [ "$gzi" != "" ]; then ext="$ext $gzi gz" i="${i:-$gzi}" fi @@ -690,7 +698,7 @@ for c in $COMPONENTS; do local path="dists/$SUITE/$c/binary-$ARCH/Packages" local pkgdest="$TARGET/$($DLDEST pkg "$SUITE" "$c" "$ARCH" "$m" "$path")" - if [ -x /bin/gunzip ] && get "$m/${path}.gz" "${pkgdest}.gz"; then + if [ -x /bin/gunzip -o -x /usr/bin/gunzip ] && get "$m/${path}.gz" "${pkgdest}.gz"; then rm -f "$pkgdest" gunzip "$pkgdest.gz" elif get "$m/$path" "$pkgdest"; then @@ -948,12 +956,16 @@ hurd-*) ;; *) - umount_on_exit /dev/pts - umount_on_exit /dev/shm - umount_on_exit /proc/bus/usb - umount_on_exit /proc - umount "$TARGET/proc" 2>/dev/null || true - in_target mount -t proc proc /proc + if [ `uname -s` = "FreeBSD" ] ; then + mount -t linprocfs proc $TARGET/proc + else + umount_on_exit /dev/pts + umount_on_exit /dev/shm + umount_on_exit /proc/bus/usb + umount_on_exit /proc + umount "$TARGET/proc" 2>/dev/null || true + in_target mount -t proc proc /proc + fi if [ -d "$TARGET/sys" ] && \ grep -q '[[:space:]]sysfs' /proc/filesystems 2>/dev/null; then umount_on_exit /sys @@ -978,13 +990,17 @@ hurd-*) setup_devices_hurd ;; *) - if [ -e "$DEVICES_TARGZ" ]; then - zcat "$DEVICES_TARGZ" | (cd "$TARGET"; tar -xf -) + if [ "`uname -s`" = "FreeBSD" ]; then + mount -t devfs devfs $TARGET/dev else - if [ -e /dev/.devfsd ] ; then - in_target mount -t devfs devfs /dev + if [ -e "$DEVICES_TARGZ" ]; then + zcat "$DEVICES_TARGZ" | (cd "$TARGET"; tar -xf -) else - error 1 NODEVTGZ "no %s. cannot create devices" "$DEVICES_TARGZ" + if [ -e /dev/.devfsd ] ; then + in_target mount -t devfs devfs /dev + else + error 1 NODEVTGZ "no %s. cannot create devices" "$DEVICES_TARGZ" + fi fi fi ;; @@ -1197,12 +1213,14 @@ kfreebsd-*|hurd-*) ;; *) - mknod "$1/test-dev-null" c 1 3 || return 1 - if ! echo test > "$1/test-dev-null"; then + if [ "`uname -s`" != "FreeBSD" ]; then + mknod "$1/test-dev-null" c 1 3 || return 1 + if ! echo test > "$1/test-dev-null"; then + rm -f "$1/test-dev-null" + return 1 + fi rm -f "$1/test-dev-null" - return 1 fi - rm -f "$1/test-dev-null" ;; esac