]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
Added console_init. A tool that will setup our console controled by udev.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 25 Jan 2009 13:04:27 +0000 (14:04 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 25 Jan 2009 13:04:27 +0000 (14:04 +0100)
config/udev/10-console.rules [new file with mode: 0644]
lfs/udev
src/initscripts/udev/console_init [new file with mode: 0644]
src/rootfiles/core/udev

diff --git a/config/udev/10-console.rules b/config/udev/10-console.rules
new file mode 100644 (file)
index 0000000..a3459ab
--- /dev/null
@@ -0,0 +1,2 @@
+# Console initialization - keyboard, font, etc.
+KERNEL=="tty0",         RUN+="/lib/udev/console_init %k"
index d6f5cc242434d7933d3e32b85b232517005f9d4b..25b7010011874cf8e25850f3ff3805bc580db1af 100644 (file)
--- a/lfs/udev
+++ b/lfs/udev
@@ -54,6 +54,7 @@ $(OBJECT) :
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
 
+       -rm -rf /lib/udev/devices
        install -dv /lib/{firmware,udev/devices/{pts,shm}}
        -mknod -m0666 /lib/udev/devices/null c 1 3
        -mknod -m0600 /lib/udev/devices/kmsg c 1 11
@@ -74,5 +75,9 @@ $(OBJECT) :
 
        install -m644 -v $(DIR_CONFIG)/$(PKG_NAME)/*.rules /lib/udev/rules.d/
 
+       for i in $(DIR_SOURCE)/initscripts/udev/*; do \
+               install -m 755 -v $$i /lib/udev/$$(basename $$i); \
+       done
+
        @rm -rf $(DIR_APP)
        @$(POSTBUILD)
diff --git a/src/initscripts/udev/console_init b/src/initscripts/udev/console_init
new file mode 100644 (file)
index 0000000..1aaaf4d
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/bash
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2008  Michael Tremer & Christian Schmidt                      #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+is_true() {
+       [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ]
+}
+
+# Native English speakers probably don't have /etc/sysconfig/console at all
+if [ -f /etc/sysconfig/console ]; then
+       . /etc/sysconfig/console
+fi
+
+# Setting default values
+[ -z "$UNICODE" ] && UNICODE=1
+[ -z "$FONT" ] && FONT="LatArCyrHeb-16"
+
+device="/dev/$1"
+
+# Figure out the mode to set the console into
+if is_true "${UNICODE}"; then
+       echo -en '\033%G' > $device
+else
+       echo -en '\033%@' > $device
+fi
+
+# Setting font
+setfont ${FONT} -C $device
+
+# Setting up keyboard
+if [ -n "$KEYMAP" ]; then
+       if is_true "${UNICODE}"; then
+               loadkeys -u $KEYMAP >/dev/null
+       else
+               loadkeys $KEYMAP >/dev/null
+       fi
+       [ -n "$KEYMAP_CORRECTIONS" ] && \
+               loadkeys $KEYMAP_CORRECTIONS >/dev/null
+fi
index a09f8f02aacbdfe21a717a2e613defa7de022715..aac72ca5bbb41d07574becc335a7cc0fa5b57ebd 100644 (file)
@@ -11,6 +11,7 @@ lib/udev
 lib/udev/ata_id
 lib/udev/cdrom_id
 lib/udev/collect
+lib/udev/console_init
 lib/udev/create_floppy_devices
 lib/udev/devices
 lib/udev/devices/core
@@ -28,6 +29,7 @@ lib/udev/fstab_import
 lib/udev/path_id
 lib/udev/rule_generator.functions
 lib/udev/rules.d
+lib/udev/rules.d/10-console.rules
 lib/udev/rules.d/23-usb.rules
 lib/udev/rules.d/50-firmware.rules
 lib/udev/rules.d/50-udev-default.rules