From 2c4ec47143e81e3986561b4e158c10ef2262e4ec Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 1 Sep 2016 13:50:23 +0200 Subject: cfg-add-keyboard: detect keyboard and update config.rc accordingly This is what used to be done in startup.rc, a bit cleaned up. It avoids touching config.rc for no reason. Unlike its predecessor, it removes a previous version of the section before creating a new one. It relies on updated init-scripts to support section removal. --- cfg-add-keyboard | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 cfg-add-keyboard diff --git a/cfg-add-keyboard b/cfg-add-keyboard new file mode 100755 index 0000000..7b2173f --- /dev/null +++ b/cfg-add-keyboard @@ -0,0 +1,26 @@ +#!/bin/bash + +[ -x /sbin/init.d/keyboard ] || exit 0 + +# is there a keyboard controller ? +grep -qs ' 1:' /proc/interrupts || exit 0 + +if grep -qsi qwerty /proc/cmdline ; then + printf "Content-length: 0\n\n" | /sbin/init.d/keyboard setsec 2>/dev/null + cat >> /etc/config.rc << EOF +service keyboard + keymap us + keyrate 30 + +EOF +else + printf "Content-length: 0\n\n" | /sbin/init.d/keyboard setsec 2>/dev/null + cat >> /etc/config.rc << EOF +service keyboard + keymap fr-pc + keyrate 30 + +EOF +fi + +exit 0 -- 1.7.12.1