[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: debootstrap (sort of) working



On Sat, Jun 08, 2002 at 02:58:06AM +0200, Marcus Brinkmann wrote:
> The diff is below.

Oh, how I hate it when this happens.

Marcus

diff -ruN debootstrap-0.1.15.2/debootstrap debootstrap-0.1.15.2.new/debootstrap
--- debootstrap-0.1.15.2/debootstrap	Tue Jun 26 17:14:39 2001
+++ debootstrap-0.1.15.2.new/debootstrap	Sun Sep  9 21:58:04 2001
@@ -20,7 +20,7 @@
 fi
 
 if [ "$1" = "--arch" ]; then
-  ARCH="$2"
+  DEB_HOST_ARCH="$2"
   shift; shift
 fi
 
@@ -53,18 +53,28 @@
 TARGET=${TARGET%/}
 MIRRORS=${MIRRORS%/}
 
-if [ "$ARCH" != "" ]; then
-	true
+if [ "$DEB_HOST_ARCH" != "" ]; then
+        if [ -x /usr/bin/dpkg-architecture ]; then
+            DEB_HOST_GNU_SYSTEM=`/usr/bin/dpkg-architecture -qDEB_HOST_GNU_SYSTEM`
+        else
+            DEB_HOST_GNU_SYSTEM="linux"
+        fi
+elif [ -x /usr/bin/dpkg-architecture ]
+then
+	DEB_HOST_ARCH=`/usr/bin/dpkg-architecture -qDEB_HOST_ARCH`
+	DEB_HOST_GNU_SYSTEM=`/usr/bin/dpkg-architecture -qDEB_HOST_GNU_SYSTEM`
 elif [ -x /usr/bin/dpkg ] && /usr/bin/dpkg --print-architecture >/dev/null 2>&1
 then
-	ARCH=`/usr/bin/dpkg --print-architecture`
+	DEB_HOST_ARCH=`/usr/bin/dpkg --print-architecture`
+        DEB_HOST_GNU_SYSTEM="linux"
 elif [ -e /usr/lib/debootstrap/arch ]; then
 	ARCH=`cat /usr/lib/debootstrap/arch`
+        DEB_HOST_GNU_SYSTEM="linux"
 else
-	error 1 "Couldn't work out current architecture"
+	error 1 "Couldn't work out target architecture"
 fi
 
-export MIRRORS ARCH SUITE TARGET
+export MIRRORS DEB_HOST_ARCH DEB_HOST_GNU_SYSTEM SUITE TARGET
 
 if [ "$JUST_PRINT_DEBS" = "" -a -x /usr/bin/id ] && [ `id -u` -ne 0 ]; then
   error 1 "debootstrap can only run as root"
diff -ruN debootstrap-0.1.15.2/functions debootstrap-0.1.15.2.new/functions
--- debootstrap-0.1.15.2/functions	Wed Aug  8 18:01:47 2001
+++ debootstrap-0.1.15.2.new/functions	Sun Sep  9 22:00:12 2001
@@ -248,7 +248,7 @@
 
   local totalpkgs=0
   for c in $COMPONENTS; do
-      local subpath="$c/binary-$ARCH/Packages"
+      local subpath="$c/binary-$DEB_HOST_ARCH/Packages"
       local normmd="`get_release_md5 $reldest ${subpath}`"
       totalpkgs=$(( $totalpkgs + ${normmd#* } ))
   done
@@ -256,7 +256,7 @@
   local donepkgs=0
   progress 0 $totalpkgs "Downloading packages"
   for c in $COMPONENTS; do
-    local subpath="$c/binary-$ARCH/Packages"
+    local subpath="$c/binary-$DEB_HOST_ARCH/Packages"
     local path="dists/$SUITE/$subpath"
     local bz2md="`get_release_md5 $reldest ${subpath}.bz2`"
     local gzmd="`get_release_md5 $reldest ${subpath}.gz`"
@@ -269,7 +269,7 @@
       ext="$ext $gzmd gz"
     fi
     for m in $MIRRORS; do
-      local pkgdest="$TARGET/$($DLDEST pkg $SUITE $c $ARCH $m $path)"
+      local pkgdest="$TARGET/$($DLDEST pkg $SUITE $c $DEB_HOST_ARCH $m $path)"
       if get "$m/$path" "$pkgdest" $ext; then break; fi
     done
     donepkgs=$(($donepkgs + ${normmd#* }))
@@ -285,8 +285,8 @@
   local totaldebs=0
   for p in "$@"; do
     for c in $COMPONENTS; do
-      local path="dists/$SUITE/$c/binary-$ARCH/Packages"
-      local pkgdest="$TARGET/$($DLDEST pkg $SUITE $c $ARCH $m1 $path)"
+      local path="dists/$SUITE/$c/binary-$DEB_HOST_ARCH/Packages"
+      local pkgdest="$TARGET/$($DLDEST pkg $SUITE $c $DEB_HOST_ARCH $m1 $path)"
       if [ ! -e $pkgdest ]; then continue; fi
       details=$($PKGDETAILS $p $m1 $pkgdest)
       if [ -z "$details" ]; then continue; fi
@@ -302,8 +302,8 @@
     for c in $COMPONENTS; do
       local details=""
       for m in $MIRRORS; do
-        local path="dists/$SUITE/$c/binary-$ARCH/Packages"
-        local pkgdest="$TARGET/$($DLDEST pkg $SUITE $c $ARCH $m $path)"
+        local path="dists/$SUITE/$c/binary-$DEB_HOST_ARCH/Packages"
+        local pkgdest="$TARGET/$($DLDEST pkg $SUITE $c $DEB_HOST_ARCH $m $path)"
         if [ ! -e $pkgdest ]; then continue; fi
         details=$($PKGDETAILS $p $m $pkgdest)
         if [ -z "$details" ]; then continue; fi
@@ -332,8 +332,8 @@
   export COMPONENTS=main
   for m in $MIRRORS; do
     for c in $COMPONENTS; do
-      local path="dists/$SUITE/$c/binary-$ARCH/Packages"
-      local pkgdest="$TARGET/$($DLDEST pkg $SUITE $c $ARCH $m $path)"
+      local path="dists/$SUITE/$c/binary-$DEB_HOST_ARCH/Packages"
+      local pkgdest="$TARGET/$($DLDEST pkg $SUITE $c $DEB_HOST_ARCH $m $path)"
       if [ -x /bin/gunzip ] && get "$m/${path}.gz" "${pkgdest}.gz"; then
         rm -f ${pkgdest}
         gunzip ${pkgdest}.gz
@@ -347,8 +347,8 @@
     for c in $COMPONENTS; do
       local details=""
       for m in $MIRRORS; do
-        local path="dists/$SUITE/$c/binary-$ARCH/Packages"
-        local pkgdest="$TARGET/$($DLDEST pkg $SUITE $c $ARCH $m $path)"
+        local path="dists/$SUITE/$c/binary-$DEB_HOST_ARCH/Packages"
+        local pkgdest="$TARGET/$($DLDEST pkg $SUITE $c $DEB_HOST_ARCH $m $path)"
         if [ ! -e $pkgdest ]; then continue; fi
         details=$($PKGDETAILS $p $m $pkgdest)
         if [ -z "$details" ]; then continue; fi
@@ -413,8 +413,8 @@
     for m in $MIRRORS; do
       local cs=""
       for c in $COMPONENTS; do
-        local path="dists/$SUITE/$c/binary-$ARCH/Packages"
-        local pkgdest="$TARGET/$($DLDEST pkg $SUITE $c $ARCH $m $path)"
+        local path="dists/$SUITE/$c/binary-$DEB_HOST_ARCH/Packages"
+        local pkgdest="$TARGET/$($DLDEST pkg $SUITE $c $DEB_HOST_ARCH $m $path)"
         if [ -e $pkgdest ]; then cs="$cs $c"; fi
       done
       #if [ "$cs" != "" ]; then echo "deb $m $SUITE$cs"; fi
diff -ruN debootstrap-0.1.15.2/woody debootstrap-0.1.15.2.new/woody
--- debootstrap-0.1.15.2/woody	Wed Aug  8 17:54:04 2001
+++ debootstrap-0.1.15.2.new/woody	Sun Sep  9 21:54:01 2001
@@ -3,21 +3,34 @@
 
 work_out_debs () {
 
-    required="base-files base-passwd bash bsdutils debconf debianutils diff dpkg e2fsprogs fileutils findutils grep gzip hostname libcap1 libc6 libdb2 libdb3 libgdbmg1 libncurses5 libnewt0 libpam-modules libpam-runtime libpam0g libperl5.6 libpopt0 libreadline4 libstdc++2.10-glibc2.2 login makedev mawk modutils mount ncurses-base ncurses-bin passwd perl-base procps sed shellutils slang1 sysvinit tar textutils util-linux whiptail"
+    required="base-files base-passwd bash bsdutils debconf debianutils diff dpkg e2fsprogs fileutils findutils grep gzip hostname libdb2 libdb3 libgdbmg1 libncurses5 libnewt0 libpam-modules libpam-runtime libpam0g libperl5.6 libpopt0 libreadline4 mawk mount ncurses-base ncurses-bin passwd perl-base sed shellutils slang1 tar textutils util-linux whiptail"
 
-    base="adduser apt apt-utils at base-config bsdmainutils console-common console-tools console-tools-libs console-data cpio cron dhcp-client ed exim fdutils gettext-base groff-base ifupdown info ipchains klogd libident libldap2 liblockfile1 libpcre3 libsasl7 libwrap0 logrotate mailx man-db manpages modconf nano net-tools netbase netkit-inetd netkit-ping nvi ppp pppoe sysklogd tasksel tcpd telnet"
+    base="adduser apt apt-utils at base-config bsdmainutils cpio cron ed exim gettext-base groff-base info libident libldap2 liblockfile1 libpcre3 libsasl7 libwrap0 logrotate mailx man-db manpages nano nvi tasksel tcpd"
 
     without_package () {
         echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' '
     }
 
-    LIBC6=libc6
+    case $DEB_HOST_GNU_SYSTEM in
+        "linux")
+            required="$required libc6 libcap1 libstdc++2.10-glibc2.2 login makedev modutils procps sysvinit"
+            base="$base console-common console-tools console-tools-libs console-data dhcp-client fdutils ifupdown ipchains klogd modconf net-tools netbase netkit-inetd netkit-ping ppp pppoe sysklogd telnet"
+            LIBC="libc6"
+            ;;
+        "gnu")
+            required="$required gnumach hurd libc0.2 libstdc++2.10"
+            base="$base inetutils syslogd telnet-hurd"
+            LIBC="libc0.2"
+            ;;
+        *)
+            # who knows?
+    esac
 
-    case $ARCH in
+    case $DEB_HOST_ARCH in
         "alpha")
             required="$(without_package "libc6" "$required") libc6.1"
             base="$base setserial aboot pciutils"
-            LIBC6="libc6.1"
+            LIBC="libc6.1"
             ;;
         "arm")
             base="$base setserial libgpmg1"
@@ -29,7 +42,7 @@
         "ia64")
             required="$(without_package "libc6" "$required") libc6.1"
             base="$base elilo efibootmgr dosfstools"
-            LIBC6="libc6.1"
+            LIBC="libc6.1"
             ;;
         "m68k")
             base="$base atari-bootstrap atari-fdisk amiga-fdisk eject mac-fdisk pmac-fdisk-cross setserial vmelilo"
@@ -58,6 +71,9 @@
             required="$(without_package "console-tools-libs" "$required")"
             required="$(without_package "console-data" "$required")"
             ;;
+        "hurd=i386")
+            base="$base grub"
+            ;;
         *)
             # who knows?
             ;;
@@ -79,16 +95,20 @@
         chown 0.0 $TARGET/etc/fstab; chmod 644 $TARGET/etc/fstab
     fi
 
-    setup_proc
+    if [ "x$DEB_HOST_GNU_SYSTEM" = "xlinux" ]; then
+        setup_proc
+    fi
     setup_devices
 
-    if [ ! -e $TARGET/etc/ld.so.conf ]; then
-        #warning "Creating empty ld.so.conf"
-        info "(WARNING) Creating empty ld.so.conf"
-        touch $TARGET/etc/ld.so.conf
-        chown 0.0 $TARGET/etc/ld.so.conf
-    fi
+    if [ "x$DEB_HOST_GNU_SYSTEM" = "xlinux" ]; then
+        if [ -e $TARGET/etc/ld.so.conf ]; then
+            #warning "Creating empty ld.so.conf"
+            info "(WARNING) Creating empty ld.so.conf"
+            touch $TARGET/etc/ld.so.conf
+            chown 0.0 $TARGET/etc/ld.so.conf
+        fi
     in_target /sbin/ldconfig
+    fi
 
     x_feign_install () {
         local pkg=$1
@@ -127,7 +147,7 @@
         ln -s /usr/share/zoneinfo/UTC $TARGET/etc/localtime
     fi
 
-    x_core_install $LIBC6
+    x_core_install $LIBC
 
     x_core_install perl-base
     x_core_install mawk
@@ -142,7 +162,9 @@
     cp $TARGET/bin/true $TARGET/sbin/start-stop-daemon
 
     setup_dselect_method apt
-    on_exit "in_target_nofail umount /dev/pts"
+    if [ "x$DEB_HOST_GNU_SYSTEM" = "xlinux" ]; then
+        on_exit "in_target_nofail umount /dev/pts"
+    fi
 
     in_target dpkg --configure --pending --force-configure-any --force-depends
 

-- 
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann              GNU    http://www.gnu.org    marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de


-- 
To UNSUBSCRIBE, email to debian-hurd-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: