freebsd-ports/sysutils/debootstrap/files/patch-functions
Martin Matuska 6746702236 Add support for debootstrapping Debian Linux (i386)
Submitted by:	Romain Garbage <romain.garbage@gmail.com>
2011-03-14 20:07:14 +00:00

115 lines
3.5 KiB
Text

--- functions.orig 2011-02-22 01:25:08.000000000 +0100
+++ functions 2011-03-14 20:42:00.536562918 +0100
@@ -232,7 +232,11 @@
# args: dest checksum size
local expchecksum="$2"
local expsize="$3"
- 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
relsize=`wc -c < "$1"`
if [ "$expsize" -ne "$relsize" ] || [ "$expchecksum" != "$relchecksum" ]; then
return 1
@@ -510,9 +514,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
@@ -538,11 +542,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
@@ -676,7 +680,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
@@ -934,12 +938,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
@@ -964,13 +972,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
;;
@@ -1178,12 +1190,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