add workaround for problems with the missing /dev/console
authorFelix Fietkau <nbd@openwrt.org>
Sat, 3 Feb 2007 12:09:17 +0000 (12:09 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sat, 3 Feb 2007 12:09:17 +0000 (12:09 +0000)
SVN-Revision: 6255

openwrt/package/base-files/default/etc/preinit

index 3f94442c672e4cdcbd3f16d2886e42fbefa58760..4e21d6605b2f6b3184f4f8ed85a7cf399434d023 100755 (executable)
@@ -4,6 +4,12 @@
 . /etc/functions.sh
 export PATH=/bin:/sbin:/usr/bin:/usr/sbin
 
+# the shell really doesn't like having stdin/out closed
+# that's why we use /dev/pty/m0 and m1 as replacement
+# for /dev/console if there's no serial console available
+dd if=/dev/console of=/dev/null bs=1 count=0 >/dev/null 2>/dev/null || \
+       exec </dev/pty/m0 >/dev/pty/m1 2>&0
+
 failsafe() {
        lock /tmp/.failsafe