summaryrefslogtreecommitdiff
path: root/debian/local
diff options
context:
space:
mode:
authorSamuel Thibault <sthibault@debian.org>2010-06-18 08:15:14 +0000
committerSamuel Thibault <sthibault@debian.org>2010-06-18 08:15:14 +0000
commit91beae771a8a09b59376f2f52212771c390ab14a (patch)
treee98bf8eb9c3ad64df17fec936ce22b900cf883db /debian/local
parent2434e419fca878f658a4ebdd928fba2bcfd32019 (diff)
* debian/local/runsystem.gnu: Integrate jkoenig d-i changes, rename to
debian/local/runsystem.
Diffstat (limited to 'debian/local')
-rwxr-xr-xdebian/local/runsystem79
-rwxr-xr-xdebian/local/runsystem.gnu86
2 files changed, 79 insertions, 86 deletions
diff --git a/debian/local/runsystem b/debian/local/runsystem
new file mode 100755
index 00000000..54354dc7
--- /dev/null
+++ b/debian/local/runsystem
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+export PATH
+
+# Usage: foldsubst <pat> xxxx yyyy zzzz ...
+# <pat> is substituted for every character of xxxx with sed, the character in
+# question being accessible as a '\0' in <pat>, and the result is used as the
+# new pattern to handle the remaining arguments.
+foldsubst () {
+ [ "$2" ] || { echo $1; return; }
+ expanded=$(echo "$2" | sed "s/./ $1/g"); shift 2
+ foldsubst "$expanded" $@;
+}
+
+# Verbosely attach a translator.
+st () {
+ echo -n " $1"
+ settrans -ck /servers/$1 /hurd/$2
+}
+
+# Verbosely create device nodes,
+# after the aguments are filtered through foldsubst.
+md () {
+ pattern=$1; shift
+ sedrepl=$(echo $pattern | sed -e 's/X/\\0/' -e 's/Y/\\\\0/')
+ devs=$(foldsubst "$sedrepl" $@)
+ (cd /dev; ./MAKEDEV $devs)
+ echo -n " $pattern"
+}
+
+
+echo -n "Setting up translators:"
+mkdir -p /servers/socket
+ln -s 1 /servers/socket/local
+ln -s 2 /servers/socket/inet
+st socket/1 pflocal
+st socket/2 pfinet
+st exec exec
+st default-pager proxy-defpager
+echo .
+
+echo -n "Creating device nodes:"
+md 'fd std vcs'
+md ttyX 1234
+md ptypX 0123
+md loopX 0123
+md hdX 0123
+md hdXsY 0123 12345678
+echo .
+
+echo -n "Starting procfs"
+settrans -g /proc /hurd/procfs
+echo .
+
+echo -n "Starting the Hurd console..."
+# 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
+console -d vga -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
+
+TERM=hurd
+export TERM
+
+# Preset the terminal type for /lib/debian-installer/detect-console
+TERM_TYPE=virtual
+export TERM_TYPE
+
+# Invoke init as linuxrc to work around pid != 1
+exec /bin/busybox linuxrc
+
diff --git a/debian/local/runsystem.gnu b/debian/local/runsystem.gnu
deleted file mode 100755
index ccf56bf6..00000000
--- a/debian/local/runsystem.gnu
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/bin/sh
-
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-export PATH
-
-SHELL=/bin/sh
-RUNCOM=/libexec/rc
-
-mkdir /servers/
-mkdir /servers/socket
-settrans -c /servers/socket/1 /hurd/pflocal
-settrans -c /servers/socket/2 /hurd/pfinet
-settrans -ck /servers/exec /hurd/exec
-settrans -c /servers/crash-suspend /hurd/crash --suspend
-settrans -c /servers/crash-kill /hurd/crash --kill
-settrans -c /servers/password /hurd/password
-settrans -c /servers/crash-suspend /hurd/crash --suspend
-settrans -c /servers/crash-dump-core /hurd/crash --dump-core
-settrans -c /servers/default-pager /hurd/proxy-defpager
-settrans /proc /hurd/procfs
-ln -s crash-kill /servers/crash
-ln -s 1 /servers/socket/local
-ln -s 2 /servers/socket/inet
-
-# would be better than the -N parameter given to genext2fs
-#settrans /dev /hurd/tmpfs 1M
-#ln -s /sbin/MAKEDEV /dev
-
-echo "setting up /dev"
-cd /dev
-rm -f null
-rm -f console
-./MAKEDEV fd
-./MAKEDEV std com0 vcs tty1 tty2 tty3 tty4 tty5 tty6 hd0 hd1 hd2 hd3 loop0 loop1
-echo "setting up /dev/pty*"
-for i in 0 1 2 3 4
-do
- ./MAKEDEV ptyp$i ptyq$i
-done
-echo "setting up /dev/hd*"
-for i in 0 1
-do
- for j in 1 2 3 4 5 6 7 8
- do
- ./MAKEDEV hd${i}s${j}
- done
-done
-cd /
-
-echo "running rc"
-# Run the rc script. As long as it exits nonzero, punt to single-user.
-# After the single-user shell exits, we will start over attempting to
-# run rc; but later invocations strip the `autoboot' argument.
-until $rc; do
- rc=${RUNCOM}
-
- # Run single-user shell and repeat as long as it dies with a signal.
- until ${SHELL} || test $? -lt 128; do
- :
- done
-done
-
-# Touch the first tty so that the Hurd console is certain to pick it
-# and not some random other tty.
-touch /dev/tty1
-
-# Startup the Hurd console.
-console -d vga -d pc_kbd -c /dev/vcs &
-
-sleep 1
-
-exec < /dev/tty1 > /dev/tty1 2>&1
-
-echo here is the console
-echo "Starting d-i's init in 2s, hoping for the best"
-sleep 2
-
-/bin/busybox init
-
-echo "d-i init died, please press ctrl-alt-backspace to get back to the Mach console"
-
-# Kill our own console so it doesn't interfere with the emergency shell
-kill 7
-
-# Shouldn't even be reached
-exit 1