summaryrefslogtreecommitdiff
path: root/debian/local/runsystem
diff options
context:
space:
mode:
Diffstat (limited to 'debian/local/runsystem')
-rwxr-xr-xdebian/local/runsystem49
1 files changed, 49 insertions, 0 deletions
diff --git a/debian/local/runsystem b/debian/local/runsystem
new file mode 100755
index 00000000..150d4c9c
--- /dev/null
+++ b/debian/local/runsystem
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+export PATH
+
+# Create a minimal subset of device and server nodes
+/usr/lib/hurd/setup-translators -m -k -p
+
+/hurd/mach-defpager
+
+# Touch the first tty so that the Hurd console is certain to pick it
+# and not some random other tty.
+sleep 1
+touch /dev/tty1
+
+echo -n "Starting the Hurd console..."
+console -d vga -g -d pc_kbd -c /dev/vcs &
+sleep 1
+
+# Switch over
+exec < /dev/tty1 > /dev/tty1 2>&1
+echo "Console started."
+
+# Set the console device used by /sbin/reopen-console
+echo /dev/tty1 >/var/run/console-device
+
+# Get all kernel parameters that can be exported as environment variables
+envvars="$(echo $* | tr ' ' '\012' | egrep '^[-_/[:alnum:]]+=.*$')"
+
+# Invoke init as linuxrc to work around pid != 1
+init='/bin/busybox linuxrc'
+
+# Parse kernel parameters
+for i in $envvars ; do
+ case "$i" in
+ init="/sbin/init"|init="init")
+ # Avoid endless loop
+ : ;;
+ init=*)
+ init=${i#init=}
+ ;;
+ noshell=*)
+ sed -i '/^tty[12]/s/^/#/' /etc/inittab
+ ;;
+ esac
+done
+
+# Preset the terminal type for /lib/debian-installer/detect-console
+eval exec env - $envvars TERM=hurd TERM_TYPE=virtual $init