]> git.pld-linux.org Git - packages/kbd.git/blobdiff - kbd.init
- updated to 2.6.4
[packages/kbd.git] / kbd.init
index 905fb617a832cf2111fc73c7de9fb449cfd3ed0b..00c15f8c20d83ed589c95a74556bafb426b150ce 100644 (file)
--- a/kbd.init
+++ b/kbd.init
@@ -2,7 +2,7 @@
 
 # console      Loads console font and keyboard table
 #
-# chkconfig:   345 70 30
+# chkconfig:   2345 70 30
 #
 # description: Loads the console font, the application-charset map \
 #              and the keyboard table.
@@ -16,8 +16,6 @@
 [ -f /bin/loadkeys -o -f /usr/bin/loadkeys ] || exit 0
 [ -f /bin/setfont -o -f /usr/bin/setfont ] || exit 0
 
-[ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
-
 # Source function library
 . /etc/rc.d/init.d/functions
 
@@ -25,6 +23,7 @@ if is_yes "$VSERVER"; then
        exit 0
 fi
 
+[ -f /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
 . /etc/sysconfig/console
 
 start() {
@@ -39,6 +38,7 @@ start() {
        fi
 
        # Check for devfs (workaround: -a option doesn't work at all)
+       local devpath tty cons
        if [ -d /dev/vc ]; then
                devpath="/dev/vc/"
        else
@@ -46,9 +46,10 @@ start() {
        fi
        # save old tty number
        tty=$(/usr/bin/tty)
-       tty=${tty#$devpath}
-       if [ "$tty" = "/dev/console" ]; then
+       if [ "$?" -ne 0 -o "$tty" = "/dev/console" ]; then
                tty=1
+       else
+               tty=${tty#$devpath}
        fi
 
        if [ -n "$CONSOLEFONT" -a -x /sbin/setsysfont ]; then
@@ -90,24 +91,24 @@ start() {
        fi
 
        if [ -n "$KEYTABLE" ]; then
-               case "$LANG" in
-               *.utf8|*.UTF-8)
+               if [ "$(LANG="$LANG" locale charmap)" = "UTF-8" ]; then
                        run_cmd "Loading keyboard table" loadkeys -u $KEYTABLE < /dev/tty0 > /dev/tty0
-                       ;;
-               *)
+               else
                        run_cmd "Loading keyboard table" loadkeys $KEYTABLE < /dev/tty0 > /dev/tty0
-               esac
+               fi
        fi
        run_cmd "Enabling SAK sequence" /bin/sh -c "echo Control Alt keycode 101 = SAK | loadkeys"
 
        power_option=""
-       if [ "$POWER_SAVE" ]; then
+       if ! is_no "$POWER_SAVE"; then
                if [ "$BLANK_TIME" ]; then
                        power_option="-blank $BLANK_TIME";
                fi
                if [ "$POWERDOWN_TIME" ]; then
                        power_option="-powerdown $POWERDOWN_TIME $power_option";
                fi
+       else
+               power_option="-blank 0 -powerdown 0 -powersave off";
        fi
        setterm_option="$power_option"
        if [ "$FOREGROUND_COLOUR" ]; then
@@ -119,6 +120,9 @@ start() {
        if [ "$BEEP_LENGTH" ]; then
                setterm_option="$setterm_option -blength $BEEP_LENGTH"
        fi
+       if [ "$BEEP_FREQ" ]; then
+               setterm_option="$setterm_option -bfreq $BEEP_FREQ"
+       fi
        setterm_option="$setterm_option -store"
 
        for cons in $SET_FONT_TERMINALS; do
@@ -131,14 +135,27 @@ start() {
        touch /var/lock/subsys/console
 }
 
+RETVAL=0
 case "$1" in
   start)
        if [ ! -f /var/lock/subsys/console ]; then
                start
        fi
        ;;
-  restart|reload|force-reload)
-       start
+  restart)
+       start
+       ;;
+  try-restart)
+       if [ -f /var/lock/subsys/console ]; then
+               start
+       fi
+       ;;
+  reload|force-reload)
+       if [ -f /var/lock/subsys/console ]; then
+               start
+       else
+               RETVAL=7
+       fi
        ;;
   stop)
        if [ -f /var/lock/subsys/console ]; then
@@ -150,8 +167,8 @@ case "$1" in
        /usr/bin/setleds
        ;;
   *)
-       msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
+       msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
        exit 3
 esac
 
-exit 0
+exit $RETVAL
This page took 0.06358 seconds and 4 git commands to generate.