Index: scripts/buildscript
===================================================================
--- scripts/buildscript	(revision 36992)
+++ scripts/buildscript	(working copy)
@@ -159,8 +159,10 @@
 supply_udeb packages/cdebconf
 
 # build kernel-wedge
-build packages/kernel/kernel-wedge
-install_deb packages/kernel kernel-wedge
+if [ "$ARCH_OS" != hurd ]; then
+	build packages/kernel/kernel-wedge
+	install_deb packages/kernel kernel-wedge
+fi
 
 # Build all other udebs.
 if [ "$ARCH_OS" = linux ]; then
@@ -289,6 +291,9 @@
     sparc)
 	do_subdir packages/arch/sparc/silo-installer
 	;;
+    hurd-i386)
+	do_subdir packages/arch/i386/grub-installer
+	;;
 esac
 
 # Build the installer boot image.
Index: installer/build/boot/hurd/menu.lst
===================================================================
--- installer/build/boot/hurd/menu.lst	(revision 0)
+++ installer/build/boot/hurd/menu.lst	(revision 0)
@@ -0,0 +1,7 @@
+default 0
+
+title	Normal installation (IDE primary slave CD-ROM)
+root	(cd)
+kernel	/boot/gnumach.gz root=device:hd2
+module	/hurd/iso9660fs.static --multiboot-command-line=${kernel-command-line} --host-priv-port=${host-port} --device-master-port=${device-port} --exec-server-task=${exec-task} -T typed ${root} $(task-create) $(task-resume) --boot-command /hurd/ext2fs.static --multiboot-command-line=${kernel-command-line} -Tgunzip:file /install/initrd.gz
+module	/lib/ld.so.1 /hurd/exec $(exec-task=task-create)
Index: installer/build/config/hurd-i386.cfg
===================================================================
--- installer/build/config/hurd-i386.cfg	(revision 0)
+++ installer/build/config/hurd-i386.cfg	(revision 0)
@@ -0,0 +1,5 @@
+MEDIUM_SUPPORTED = monolithic
+
+GRUB_ARCH = i386-pc
+
+include config/hurd.cfg
Index: installer/build/config/hurd.cfg
===================================================================
--- installer/build/config/hurd.cfg	(revision 0)
+++ installer/build/config/hurd.cfg	(revision 0)
@@ -0,0 +1,79 @@
+# Common configuration and targets for the Hurd.
+
+KERNELMAJOR = hurd
+KERNEL_FLAVOUR = di
+KERNELNAME = gnumach.gz
+KERNELVERSION = hurd
+
+# Awful hack. mklibs doesn't seem to work yet due (initially) to external
+# references in libdiskfs that the library user has to define.
+MKLIBS = :
+
+# Set up Hurdish translators.
+.PHONY: hurd_translators
+hurd_translators:
+	settrans -pc $(TREE)/dev/console /hurd/term /dev/console device console
+	settrans -pc $(TREE)/dev/vcs /hurd/console --lines=125 --encoding=UTF-8
+
+	mkdir -p $(TREE)/servers
+	settrans -pc $(TREE)/servers/exec /hurd/exec
+	settrans -pc $(TREE)/servers/crash-suspend /hurd/crash --suspend
+	settrans -pc $(TREE)/servers/crash-kill /hurd/crash --kill
+	settrans -pc $(TREE)/servers/password /hurd/password
+	settrans -pc $(TREE)/servers/crash-dump-core /hurd/crash --dump-core
+	ln -s crash-suspend $(TREE)/servers/crash
+	mkdir -p $(TREE)/servers/socket
+	ln -s 1 $(TREE)/servers/socket/local
+	ln -s 2 $(TREE)/servers/socket/inet
+
+	(set -e; \
+	 cd $(TREE)/dev; \
+	 MAKEDEV fd; \
+	 MAKEDEV tty null zero full fd time mem klog; \
+	 MAKEDEV ptyp; \
+	 settrans -pc xconsole /hurd/fifo; \
+	 MAKEDEV tty1 tty2 tty3 tty4)
+
+.PHONY: arch_boot_screens
+arch_boot_screens:
+
+# Miniature CD image using grub, with only an initrd, no udebs or debs.
+.PHONY: arch_miniiso
+arch_miniiso:
+	-rm -f $(TEMP_CD_TREE)/*
+	mkdir -p $(TEMP_CD_TREE)/boot/grub $(TEMP_CD_TREE)/install \
+		$(TEMP_CD_TREE)/bin $(TEMP_CD_TREE)/dev $(TEMP_CD_TREE)/etc \
+		$(TEMP_CD_TREE)/hurd $(TEMP_CD_TREE)/lib \
+		$(TEMP_CD_TREE)/libexec $(TEMP_CD_TREE)/sbin \
+		$(TEMP_CD_TREE)/servers/socket $(TEMP_CD_TREE)/tmp \
+		$(TEMP_CD_TREE)/usr $(TEMP_CD_TREE)/var
+	cp /lib/grub/$(GRUB_ARCH)/stage2_eltorito $(TEMP_CD_TREE)/boot/grub/
+	cp boot/hurd/menu.lst $(TEMP_CD_TREE)/boot/grub/
+	ln -f $(TEMP_KERNEL) $(TEMP_CD_TREE)/boot/gnumach.gz
+	ln -f $(TEMP_INITRD) $(TEMP_CD_TREE)/install/initrd.gz
+	touch $(TEMP_CD_TREE)/install/tmpfs
+
+	cp -a $(TREE)/bin/busybox $(TEMP_CD_TREE)/bin/
+	cp -a $(TREE)/bin/echo $(TEMP_CD_TREE)/bin/
+	cp -a $(TREE)/bin/sh $(TEMP_CD_TREE)/bin/
+	cp -a $(TREE)/bin/settrans $(TEMP_CD_TREE)/bin/
+	touch $(TEMP_CD_TREE)/dev/ramdisk
+	touch $(TEMP_CD_TREE)/dev/time
+	cp -a $(TREE)/hurd/* $(TEMP_CD_TREE)/hurd/
+	# ld.so.1 cannot be a symlink on ISO9660
+	cp -Lp $(TREE)/lib/ld* $(TEMP_CD_TREE)/lib/
+	cp -a $(TREE)/lib/lib* $(TEMP_CD_TREE)/lib/
+	cp -a $(TREE)/libexec/console-run $(TEMP_CD_TREE)/libexec/
+	cp -a $(TREE)/libexec/runsystem $(TEMP_CD_TREE)/libexec/
+	touch $(TEMP_CD_TREE)/servers/socket/1 \
+		$(TEMP_CD_TREE)/servers/socket/2 \
+		$(TEMP_CD_TREE)/servers/socket/local \
+		$(TEMP_CD_TREE)/servers/socket/inet
+	touch $(TEMP_CD_TREE)/tmp/console
+
+	mkisofs -r -b boot/grub/stage2_eltorito -c boot.cat \
+		-no-emul-boot -boot-load-size 4 -boot-info-table \
+		-o $(TEMP_MINIISO) $(TEMP_CD_TREE)
+
+.PHONY: arch_tree
+arch_tree: hurd_translators
Index: installer/build/config/hurd-i386/monolithic.cfg
===================================================================
--- installer/build/config/hurd-i386/monolithic.cfg	(revision 0)
+++ installer/build/config/hurd-i386/monolithic.cfg	(revision 0)
@@ -0,0 +1,8 @@
+MEDIA_TYPE = boot image
+
+TARGET = pkg-lists/standard-udebs pkg-lists/kernel-module-udebs $(INITRD) $(KERNEL) $(MINIISO)
+EXTRANAME = $(MEDIUM)/
+
+MANIFEST-INITRD = "initrd"
+MANIFEST-KERNEL = "kernel image"
+MANIFEST-MINIISO = "small bootable CD image for network install"
Index: installer/build/pkg-lists/kernel
===================================================================
--- installer/build/pkg-lists/kernel	(revision 36992)
+++ installer/build/pkg-lists/kernel	(working copy)
@@ -1,3 +1,5 @@
 # Just the kernel of right version. Included on all images that are
 # bootable.
-kernel-image-${kernel:Version}
+kernel-image-${kernel:Version} [linux]
+gnumach-udeb [hurd]
+hurd-udeb [hurd]
Index: installer/build/pkg-lists/cdrom/common
===================================================================
--- installer/build/pkg-lists/cdrom/common	(revision 36992)
+++ installer/build/pkg-lists/cdrom/common	(working copy)
@@ -9,7 +9,7 @@
 cdrom-retriever
 load-cdrom
 cdrom-checker
-bogl-bterm-udeb
+bogl-bterm-udeb [linux]
 di-utils-terminfo
 cdebconf-newt-udeb
 usb-discover
Index: installer/build/pkg-lists/monolithic/hurd-i386.cfg
===================================================================
--- installer/build/pkg-lists/monolithic/hurd-i386.cfg	(revision 0)
+++ installer/build/pkg-lists/monolithic/hurd-i386.cfg	(revision 0)
@@ -0,0 +1,38 @@
+# Exclude a huge pile of stuff that just isn't going to work yet.
+
+dmsetup-udeb -
+libdevmapper1.02-udeb -
+lvm2-udeb -
+lvmcfg-utils -
+partman-auto-lvm -
+partman-lvm -
+rescue-mode -
+
+libiw27-udeb -
+wireless-tools-udeb -
+
+# temporary
+apt-cdrom-setup -
+apt-mirror-setup -
+apt-setup -
+base-installer -
+choose-mirror -
+grub-installer -
+mdcfg-utils -
+netcfg -
+netcfg-static -
+network-preseed -
+nobootloader -
+os-prober -
+parted-udeb -
+partman-auto -
+partman-base -
+partman-basicfilesystems -
+partman-basicmethods -
+partman-ext3 -
+partman-jfs -
+partman-md -
+partman-reiserfs -
+partman-target -
+partman-xfs -
+prebaseconfig -
Index: installer/build/util/hurd-genext2fs
===================================================================
--- installer/build/util/hurd-genext2fs	(revision 0)
+++ installer/build/util/hurd-genext2fs	(revision 0)
@@ -0,0 +1,26 @@
+#! /bin/sh -e
+# A genext2fs-like tool for the Hurd, without the horribleness of genext2fs
+# itself. Doesn't require root privileges.
+
+TREE="$1"
+TEMP="$2"
+OUT="$3"
+BLOCKSIZE=4096
+# du crashes if we try to get it to calculate the size of /dev. Instead, add
+# on 128 blocks to account for /dev (at the time of writing, it seems to be
+# 76, so this should be sufficient for a while).
+BLOCKS="$(expr $(du -B "$BLOCKSIZE" -s "$TREE" --exclude=dev | cut -f1) + 128 + $(expr $(find "$TREE" | wc -l) \* 2))"
+
+cleanup () {
+	settrans -fg "$TEMP/fs-copy" || true
+	rm -f "$TEMP/fs-copy"
+}
+
+dd if=/dev/zero of="$OUT" bs="$BLOCKSIZE" count="$BLOCKS"
+mke2fs -qF -b "$BLOCKSIZE" -m 0 "$OUT" "$BLOCKS"
+settrans -ac "$TEMP/fs-copy" /hurd/ext2fs "$OUT"
+if ! cp -a "$TREE"/* "$TEMP/fs-copy/"; then
+	cleanup
+	exit 1
+fi
+cleanup

Property changes on: installer/build/util/hurd-genext2fs
___________________________________________________________________
Name: svn:executable
   + *

Index: installer/build/util/get-packages
===================================================================
--- installer/build/util/get-packages	(revision 36992)
+++ installer/build/util/get-packages	(working copy)
@@ -55,7 +55,12 @@
 fi
 
 # localudebs support
-apt-ftparchive packages $LOCALUDEBDIR > $LOCALUDEBDIR/Packages
+if [ "$DEB_HOST_ARCH_OS" = hurd ]; then
+	# apt-ftparchive seems to be broken on the Hurd.
+	dpkg-scanpackages -u $LOCALUDEBDIR /dev/null > $LOCALUDEBDIR/Packages
+else
+	apt-ftparchive packages $LOCALUDEBDIR > $LOCALUDEBDIR/Packages
+fi
 cat $LOCALUDEBDIR/Packages | gzip > $LOCALUDEBDIR/Packages.gz
 if [ -s $LOCALUDEBDIR/Packages ]; then
 	echo "*" >&2
Index: installer/build/Makefile
===================================================================
--- installer/build/Makefile	(revision 36992)
+++ installer/build/Makefile	(working copy)
@@ -58,10 +58,16 @@
 
 # We don't want this to be run each time we re-enter.
 ifndef DEB_HOST_ARCH
-DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH)
-DEB_HOST_GNU_CPU = $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
-DEB_HOST_GNU_SYSTEM = $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
-export DEB_HOST_ARCH DEB_HOST_GNU_CPU DEB_HOST_GNU_SYSTEM
+  DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
+  DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
+  # Take account of old dpkg-architecture output.
+  ifeq ($(DEB_HOST_ARCH_OS),)
+    DEB_HOST_ARCH_OS := $(subst -gnu,,$(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM))
+    ifeq ($(DEB_HOST_ARCH_OS),gnu)
+      DEB_HOST_ARCH_OS := hurd
+    endif
+  endif
+  export DEB_HOST_ARCH DEB_HOST_ARCH_OS
 endif
 
 # We loop over all needed combinations of ARCH, SUBARCH, MEDIUM, FLAVOUR
@@ -111,9 +117,15 @@
   $(if $($(1)_SUPPORTED),$(call recurse_many,$(1),$(2),$(3)),$(call recurse_once,$(2),$(3)))
 endef
 
-define genext2fs
-  genext2fs -d $(TREE) -b `expr $$(du -s $(TREE) | cut -f 1) + $$(expr $$(find $(TREE) | wc -l) \* 2)` -r 0
-endef
+ifeq ($(DEB_HOST_ARCH_OS),hurd)
+  define genext2fs
+    hurd-genext2fs $(TREE) $(TEMP)
+  endef
+else
+  define genext2fs
+    genext2fs -d $(TREE) -b `expr $$(du -s $(TREE) | cut -f 1) + $$(expr $$(find $(TREE) | wc -l) \* 2)` -r 0
+  endef
+endif
 
 define mkinitramfs
   (cd $(TREE) && find . | cpio --quiet -o -H newc) > 
@@ -273,7 +285,7 @@
 # The general tree target.
 $(STAMPS)tree-unpack-$(targetstring)-stamp: $(STAMPS)get_udebs-$(targetstring)-stamp
 	dh_testroot
-	cd .. && dpkg-checkbuilddeps
+	#cd .. && dpkg-checkbuilddeps
 	@rm -f $@
 
 	# This build cannot be restarted, because dpkg gets confused.
@@ -561,7 +573,7 @@
 # Create a compressed image of the root filesystem.
 $(TEMP_INITRD): $(STAMPS)tree-$(targetstring)-stamp arch_tree
 	# Only build the font if we have installation-locale
-	if [ -d "$(LOCALE_PATH)/C.UTF-8" ] && [ -e /usr/src/unifont.bdf ]; then \
+	if [ -d "$(LOCALE_PATH)/C.UTF-8" ] && [ -e /usr/src/unifont.bdf ] && type bdftobogl >/dev/null 2>&1; then \
 		$(submake) $(TREE)/lib/unifont.bgf; \
 	fi
 	install -d $(TEMP)
@@ -720,10 +732,12 @@
 pkg-lists/kernel-module-udebs:
 	get-packages udeb update
 	> $@
+ifneq ($(DEB_HOST_ARCH_OS),hurd)
 	$(foreach VERSION,$(KERNELVERSION), \
 		grep-dctrl -P -e '.*-modules-$(VERSION)-$(KERNEL_FLAVOUR)' \
 			-sPackage apt.udeb/state/lists/*_Packages* | \
 			cut -d " " -f 2 >> $@;)
+endif
 
 # The kernel version changes from build to build, so always regen the file.
 .PHONY: pkg-lists/kernel-module-udebs
Index: installer/debian/control
===================================================================
--- installer/debian/control	(revision 36992)
+++ installer/debian/control	(working copy)
@@ -6,7 +6,7 @@
 Standards-Version: 3.6.2
 Build-Conflicts: libnewt-pic [mipsel]
 # NOTE: Do not edit the next line by hand. See comment below.
-Build-Depends: debhelper (>= 4), apt, apt-utils, gnupg, debian-archive-keyring, dpkg (>= 1.13.9), grep-dctrl, bc, debiandoc-sgml, libbogl-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], glibc-pic, libparted1.6-13, libslang2-pic, libnewt-pic [!mipsel], libnewt-dev [mipsel], libtextwrap1, cramfsprogs [powerpc ia64 mips mipsel arm armeb], genext2fs (>= 1.3-7.1), e2fsprogs, mklibs (>= 0.1.15), mkisofs, genromfs [sparc], hfsutils [powerpc], dosfstools [i386 ia64 m68k amd64], cpio, devio [arm armeb], syslinux (>= 2.11-0.1) [i386 amd64], palo [hppa], elilo [ia64], yaboot [powerpc], aboot (>= 0.9b-2) [alpha], silo [sparc], sparc-utils [sparc], genisovh [mips], delo [mipsel], tip22 [mips], colo (>= 1.21-1) [mipsel], sibyl [mips mipsel], atari-bootstrap [m68k], vmelilo [m68k], m68k-vme-tftplilo [m68k], amiboot [m68k], tofrodos [i386 amd64 kfreebsd-i386 kfreebsd-amd64], mtools (>= 3.9.9-1) [i386 ia64 m68k amd64 kfreebsd-i386 kfreebsd-amd64], modutils [arm i386 mips mipsel powerpc s390 sparc], module-init-tools [i386 powerpc amd64 alpha hppa ia64 sparc mips mipsel arm armeb], bf-utf-source [!s390 !s390x], upx-ucl-beta (>= 1:1.91+0.20030910cvs-2) [i386], mkvmlinuz [powerpc]
+Build-Depends: debhelper (>= 4), apt, apt-utils, gnupg [!hurd-i386], debian-archive-keyring [!hurd-i386], dpkg (>= 1.13.9), grep-dctrl, bc, debiandoc-sgml, libbogl-dev [!kfreebsd-i386 !kfreebsd-amd64 !hurd-i386], glibc-pic, libparted1.6-13, libslang2-pic, libnewt-pic [!mipsel], libnewt-dev [mipsel], libtextwrap1, cramfsprogs [powerpc ia64 mips mipsel arm armeb], genext2fs (>= 1.3-7.1) [!hurd-i386], e2fsprogs, mklibs (>= 0.1.15), mkisofs, genromfs [sparc], hfsutils [powerpc], dosfstools [i386 ia64 m68k amd64], cpio, devio [arm armeb], syslinux (>= 2.11-0.1) [i386 amd64], palo [hppa], elilo [ia64], yaboot [powerpc], aboot (>= 0.9b-2) [alpha], silo [sparc], sparc-utils [sparc], genisovh [mips], delo [mipsel], tip22 [mips], colo (>= 1.21-1) [mipsel], sibyl [mips mipsel], atari-bootstrap [m68k], vmelilo [m68k], m68k-vme-tftplilo [m68k], amiboot [m68k], grub [hurd-i386], tofrodos [i386 amd64 kfreebsd-i386 kfreebsd-amd64], mtools (>= 3.9.9-1) [i386 ia64 m68k amd64 kfreebsd-i386 kfreebsd-amd64], modutils [arm i386 mips mipsel powerpc s390 sparc], module-init-tools [i386 powerpc amd64 alpha hppa ia64 sparc mips mipsel arm armeb], bf-utf-source [!s390 !s390x], upx-ucl-beta (>= 1:1.91+0.20030910cvs-2) [i386], mkvmlinuz [powerpc]
 # This package has the worst Build-Depends in Debian, so it deserves some
 # explanation. Note that this comment can also be used to generate a
 # Build-Depends line, by running the debian/genbuilddeps program.
@@ -21,10 +21,12 @@
 # 		Used for downloading udebs.
 # 	- apt-utils
 # 		apt-ftparchive is used for including localudebs.
-#	- gnupg
+#	- gnupg [!hurd-i386]
 #		New versions of apt need gnupg for security checks.
-#	- debian-archive-keyring
+#		Unfortunately, it's broken on the Hurd.
+#	- debian-archive-keyring [!hurd-i386]
 #		To provide the archive key for security checks.
+#		Since gpg is broken on the Hurd, this won't install there.
 #	- dpkg (>= 1.13.9)
 #		We tweak dpkg logging options only understood by this
 #		version.
@@ -59,7 +61,7 @@
 # Filesystem tools:
 #	- cramfsprogs [powerpc ia64 mips mipsel arm armeb]
 #		For arches that use cramfs initrds.
-#	- genext2fs (>= 1.3-7.1)
+#	- genext2fs (>= 1.3-7.1) [!hurd-i386]
 #		For creating ext2 filesystems without being root.
 #		1.3-7.1 fixes issues on several arches.
 #	- e2fsprogs
@@ -124,6 +126,8 @@
 #		to a warning when it fails.
 #	- amiboot [m68k]
 #		Bootloader for m68k/amiga machines.
+#	- grub [hurd-i386]
+#		For booting the Hurd.
 #
 # Architecture specific build dependencies:
 #	- tofrodos [i386 amd64 kfreebsd-i386 kfreebsd-amd64]
Index: installer/doc/TODO
===================================================================
--- installer/doc/TODO	(revision 36992)
+++ installer/doc/TODO	(working copy)
@@ -10,7 +10,6 @@
 [0%] Not begun
 ---------------------------------------------------------------------
 	- some architectures
-		hurd-i386 (we will ship w/o this)
 		sh (we will ship w/o this)
 	- support for non-free udebs
 		Driver disks are already supported, but that is not really
@@ -29,6 +28,24 @@
 	- ppp support
 		Not as important for analog dialup, as for ISDN, pppoe.
 		Broken following base-config removal.
+	- hurd-i386 support
+		Port enough of busybox (cjwatson has patches).
+		debian-cd integration (build tarball with all the stuff we
+		need in the ISO9660 root filesystem).
+		autopartkit assumes Linux; fix or exclude? Probably exclude.
+		Do something about bterm mess.
+		doxygen removal from libdebian-installer is a hack, but hey.
+		Exclude partman modules that won't work?
+		Do something with usb-discover.
+		kbd-chooser? (perhaps console-driver-xkb + X keymaps)
+		Probably can't do LVM/RAID? Exclude.
+		Check up on current state of pfinet DHCP support for netcfg
+		(pfinet -d, ftp.gnuab.org has a patched dhcp-client-udeb).
+		user-params won't work; /proc/cmdline equivalent (maybe
+		handle this from /libexec/runsystem)?
+		Lots of devfs path assumptions, although we can probably
+		hack around these if necessary.
+		mapdevfs assumes Linux.
 
 [60%] Needs some work, but does its grunt work
 ---------------------------------------------------------------------
Index: packages/rootskel/src/etc/ttys
===================================================================
--- packages/rootskel/src/etc/ttys	(revision 0)
+++ packages/rootskel/src/etc/ttys	(revision 0)
@@ -0,0 +1,12 @@
+# name	program			type		status	comments
+console	"/libexec/getty 9600"			mach-color	on	secure trusted console
+
+# main setup program
+tty1	"/sbin/debian-installer"		hurd		on	secure trusted console
+
+# convenience shell
+tty2	"/bin/sh"				hurd		on	secure trusted console
+
+# logging
+tty3	"/bin/tail -f /var/log/messages"	hurd		on	secure trusted console
+tty4	"/bin/tail -f /var/log/syslog"		hurd		on	secure trusted console
Index: packages/rootskel/src/etc/Makefile
===================================================================
--- packages/rootskel/src/etc/Makefile	(revision 36992)
+++ packages/rootskel/src/etc/Makefile	(working copy)
@@ -1,5 +1,14 @@
 dir = etc
 
+DEB_HOST_ARCH_OS    := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
+# Take account of old dpkg-architecture output.
+ifeq ($(DEB_HOST_ARCH_OS),)
+  DEB_HOST_ARCH_OS    := $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
+  ifeq ($(DEB_HOST_ARCH_OS),gnu)
+    DEB_HOST_ARCH_OS    := hurd
+  endif
+endif
+
 # backward compatibility
 subdirs_empty = rcS.d
 
@@ -11,6 +20,11 @@
 	nsswitch.conf \
 	passwd
 
+ifeq ($(DEB_HOST_ARCH_OS),hurd)
+  files += \
+	ttys
+endif
+
 install-local:: $(outdir)
 	ln -fs /proc/mounts $(outdir)/mtab
 
Index: packages/rootskel/src/sbin/Makefile
===================================================================
--- packages/rootskel/src/sbin/Makefile	(revision 36992)
+++ packages/rootskel/src/sbin/Makefile	(working copy)
@@ -1,9 +1,22 @@
 dir = sbin
 
+DEB_HOST_ARCH_OS    := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
+# Take account of old dpkg-architecture output.
+ifeq ($(DEB_HOST_ARCH_OS),)
+  DEB_HOST_ARCH_OS    := $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
+  ifeq ($(DEB_HOST_ARCH_OS),gnu)
+    DEB_HOST_ARCH_OS    := hurd
+  endif
+endif
+
 files_exec = \
 	debian-installer \
 	debian-installer-startup \
-	shutdown \
+	shutdown
+
+ifeq ($(DEB_HOST_ARCH_OS),linux)
+  files_exec += \
 	init
+endif
 
 include ../../Makefile.inc
Index: packages/rootskel/src/libexec/runsystem
===================================================================
--- packages/rootskel/src/libexec/runsystem	(revision 0)
+++ packages/rootskel/src/libexec/runsystem	(revision 0)
@@ -0,0 +1,61 @@
+#! /bin/sh
+# Set up the root filesystem so that d-i can use it, which essentially means
+# making it writable. Chrooting and moving all the servers across to the new
+# rootfs is too hard, so instead we just make all the relevant parts of the
+# filesystem writable using a firmlink farm.
+#
+# Heavily "inspired" by http://www.superunprivileged.org/hurd/live-cd/runsystem
+
+echo "Setting up filesystem, please wait ..."
+
+PATH=/bin:/sbin
+export PATH
+
+# If we get a SIGLOST, attempt to reopen the console in case
+# our console ports were revoked.  This lets us print messages.
+reopen_console () {
+	exec >/dev/console 2>&1 || exit 3
+}
+trap reopen_console SIGLOST
+
+if [ "${FALLBACK_CONSOLE+set}" = set ]; then
+	/hurd/mach-defpager
+
+	# libdiskfs needs /dev/time
+	settrans -a /dev/time /hurd/storeio --no-cache time
+
+	# pipes
+	settrans -a /servers/socket/1 /hurd/pflocal
+
+	# mount RAM disk
+	settrans -a /dev/ramdisk /hurd/storeio -Tgunzip /install/initrd.gz
+	settrans -a /install/tmpfs /hurd/ext2fs.static /dev/ramdisk
+
+	# firmlink a bunch of directories into the RAM disk
+	for dir in /bin /dev /etc /lib /libexec /sbin /tmp /usr /var /hurd /servers; do
+		settrans -a "$dir" /hurd/firmlink "/install/tmpfs$dir"
+	done
+
+	# set up shared memory
+	settrans -ac /dev/shm /hurd/tmpfs --mode=1777 50%
+
+	# start up a new console
+	settrans -pck /dev/console /hurd/term /dev/console device console
+
+	export TERM=mach-color
+fi
+
+/sbin/debian-installer-startup
+
+runttys_pid=0
+for sig in TERM INT HUP TSTP; do
+	trap "kill -$sig \$runttys_pid" $sig
+done
+
+touch /dev/tty1
+/libexec/runttys &
+runttys_pid=$!
+
+wait
+
+exit
Index: packages/rootskel/src/libexec/Makefile
===================================================================
--- packages/rootskel/src/libexec/Makefile	(revision 0)
+++ packages/rootskel/src/libexec/Makefile	(revision 0)
@@ -0,0 +1,6 @@
+dir = libexec
+
+files_exec = \
+	runsystem
+
+include ../../Makefile.inc
Index: packages/rootskel/src/Makefile
===================================================================
--- packages/rootskel/src/Makefile	(revision 36992)
+++ packages/rootskel/src/Makefile	(working copy)
@@ -1,21 +1,39 @@
 dir =
 
+DEB_HOST_ARCH_OS    := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
+# Take account of old dpkg-architecture output.
+ifeq ($(DEB_HOST_ARCH_OS),)
+  DEB_HOST_ARCH_OS    := $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
+  ifeq ($(DEB_HOST_ARCH_OS),gnu)
+    DEB_HOST_ARCH_OS    := hurd
+  endif
+endif
+
 subdirs = \
 	etc \
 	lib \
 	sbin \
 	var
 
+ifeq ($(DEB_HOST_ARCH_OS),hurd)
+  subdirs += \
+	libexec
+endif
+
 subdirs_empty = \
 	dev \
 	floppy \
-	initrd \
 	mnt \
-	proc \
-	sys \
 	usr/lib/prebaseconfig.d
 
-files_exec = \
+ifeq ($(DEB_HOST_ARCH_OS),linux)
+  subdirs_empty += \
+	initrd \
+	proc \
+	sys
+
+  files_exec = \
 	init
+endif
      
 include ../Makefile.inc
Index: packages/base-installer/debian/postinst
===================================================================
--- packages/base-installer/debian/postinst	(revision 36992)
+++ packages/base-installer/debian/postinst	(working copy)
@@ -766,6 +766,18 @@
 	fi
 }
 
+install_hurd () {
+	for package in gnumach hurd; do
+		info "Installing $package."
+		db_subst base-installer/section/install_kernel_package SUBST0 "$package"
+		db_progress INFO base-installer/section/install_kernel_package
+		if ! apt-install "$package" 2>> $LOGFILE; then
+			db_subst base-installer/kernel/failed-install KERNEL "$package"
+			exit_error base-installer/kernel/failed-install
+		fi
+	done
+}
+
 install_pcmcia_modules () {
 	if [ "$KERNEL" = none ]; then
 		info "Not installing any pcmcia modules"
@@ -868,8 +880,16 @@
 waypoint 2	create_devices
 waypoint 5	post_install_hooks
 waypoint 1	pick_kernel
-waypoint 20	install_linux
 case "$ARCH" in
+	hurd-*)
+		waypoint 20	install_hurd
+		;;
+	*)
+		waypoint 1	pick_kernel
+		waypoint 20	install_linux
+		;;
+esac
+case "$ARCH" in
 	i386*)
 		if [ -e /proc/bus/pccard/drivers ]; then
 			waypoint 1	install_pcmcia_modules
Index: packages/netcfg/debian/control
===================================================================
--- packages/netcfg/debian/control	(revision 36992)
+++ packages/netcfg/debian/control	(working copy)
@@ -3,12 +3,12 @@
 Priority: optional
 Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
 Uploaders: David Kimdon <dwhedon@debian.org>, Tollef Fog Heen <tfheen@debian.org>, Matt Kraai <kraai@debian.org>, Joey Hess <joeyh@debian.org>, Joshua Kwan <joshk@triplehelix.org>, Thomas Hood <jdthood@yahoo.co.uk>, Frans Pop <fjp@debian.org>, Colin Watson <cjwatson@debian.org>
-Build-Depends: debhelper (>= 5.0.22), dpkg-dev (>= 1.9.0), libdebconfclient0-dev (>= 0.46), libdebian-installer4-dev (>= 0.41), po-debconf (>= 0.5.0), libiw-dev (>= 27+28pre9-1)
+Build-Depends: debhelper (>= 5.0.22), dpkg-dev (>= 1.9.0), libdebconfclient0-dev (>= 0.46), libdebian-installer4-dev (>= 0.41), po-debconf (>= 0.5.0), libiw-dev (>= 27+28pre9-1) [!hurd-i386]
 Standards-Version: 3.6.1.0
 
 Package: netcfg
 XC-Package-Type: udeb
-Architecture: i386 sparc alpha m68k arm armeb powerpc mips mipsel hppa ia64 amd64 ppc64
+Architecture: i386 sparc alpha m68k arm armeb powerpc mips mipsel hppa ia64 amd64 ppc64 hurd-i386
 Depends: ${shlibs:Depends}, ${misc:Depends}, dhcp-client-udeb | dhcp3-client-udeb | pump-udeb, ethernet-card-detection
 Provides: configured-network
 XB-Installer-Menu-Item: 18
Index: packages/netcfg/dhcp.c
===================================================================
--- packages/netcfg/dhcp.c	(revision 36992)
+++ packages/netcfg/dhcp.c	(working copy)
@@ -365,6 +365,7 @@
            * Set defaults for domain name and hostname
            */
 
+          /* TODO: no MAXHOSTNAMELEN on the Hurd */
           char buf[MAXHOSTNAMELEN + 1] = { 0 };
           char *ptr = NULL;
           FILE *d = NULL;
Index: packages/netcfg/Makefile
===================================================================
--- packages/netcfg/Makefile	(revision 36992)
+++ packages/netcfg/Makefile	(working copy)
@@ -1,3 +1,16 @@
+DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null)
+# Take account of old dpkg-architecture output.
+ifeq ($(DEB_HOST_ARCH_OS),)
+  DEB_HOST_ARCH_OS := $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM)
+  ifeq ($(DEB_HOST_ARCH_OS),gnu)
+    DEB_HOST_ARCH_OS := hurd
+  endif
+endif
+
+ifeq ($(DEB_HOST_ARCH_OS),hurd)
+NO_WIRELESS	= 1
+endif
+
 CC		= gcc
 TARGETS		?= netcfg-static netcfg
 
