Fix an invalidation case that tends to occur under load on NFS servers or
[dragonfly.git] / etc / rc.d / syscons
blobe879a4f8496fe1c80a6b0a8f5a092dc9a82ad8e7
1 #!/bin/sh -
3 # Copyright (c) 2000 The FreeBSD Project
4 # All rights reserved.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
15 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 # SUCH DAMAGE.
27 # $FreeBSD: src/etc/rc.d/syscons,v 1.9 2002/09/09 22:40:34 gordon Exp $
28 # $DragonFly: src/etc/rc.d/syscons,v 1.5 2005/11/19 21:47:32 swildner Exp $
31 # PROVIDE: syscons
32 # REQUIRE: LOGIN usbd
34 . /etc/rc.subr
36 name="syscons"
37 start_cmd="syscons_start"
39 # stdin must be redirected because it might be for a serial console
41 kbddev=/dev/ttyv0
42 viddev=/dev/ttyv0
44 syscons_start()
46 echo -n 'Configuring syscons:'
48 # keymap
50 case ${keymap} in
51 [Nn][Oo] | '')
54 echo -n ' keymap'; kbdcontrol < ${kbddev} -l ${keymap}
56 esac
58 # keyrate
60 case ${keyrate} in
61 [Nn][Oo] | '')
64 echo -n ' keyrate'; kbdcontrol < ${kbddev} -r ${keyrate}
66 esac
68 # keybell
70 case ${keybell} in
71 [Nn][Oo] | '')
74 echo -n ' keybell'; kbdcontrol < ${kbddev} -b ${keybell}
76 esac
78 # change function keys
80 case ${keychange} in
81 [Nn][Oo] | '')
84 echo -n ' keychange'
85 set - ${keychange}
86 while [ $# -gt 0 ]; do
87 kbdcontrol <${kbddev} -f "$1" "$2"
88 shift; shift
89 done
91 esac
93 # cursor type
95 case ${cursor} in
96 [Nn][Oo] | '')
99 echo -n ' cursor'; vidcontrol < ${viddev} -c ${cursor}
101 esac
103 # screen mapping
105 case ${scrnmap} in
106 [Nn][Oo] | '')
109 echo -n ' scrnmap'; vidcontrol < ${viddev} -l ${scrnmap}
111 esac
113 # font 8x16
115 case ${font8x16} in
116 [Nn][Oo] | '')
119 echo -n ' font8x16'; vidcontrol < ${viddev} -f 8x16 ${font8x16}
121 esac
123 # font 8x14
125 case ${font8x14} in
126 [Nn][Oo] | '')
129 echo -n ' font8x14'; vidcontrol < ${viddev} -f 8x14 ${font8x14}
131 esac
133 # font 8x8
135 case ${font8x8} in
136 [Nn][Oo] | '')
139 echo -n ' font8x8'; vidcontrol < ${viddev} -f 8x8 ${font8x8}
141 esac
143 # blank time
145 case ${blanktime} in
146 [Nn][Oo] | '')
149 echo -n ' blanktime'; vidcontrol < ${viddev} -t ${blanktime}
151 esac
153 # screen saver
155 case ${saver} in
156 [Nn][Oo] | '')
159 echo -n ' screensaver'
160 for i in `kldstat | awk '$5 ~ "^splash_.*$" { print $5 }'`; do
161 kldunload ${i}
162 done
163 kldstat -v | grep -q _saver || kldload ${saver}_saver
165 esac
167 # video history buffer
169 case ${vidhistory} in
170 [Nn][Oo] | '')
173 echo -n ' vidhistory'; vidcontrol < ${viddev} -h ${vidhistory}
175 esac
177 # set this mode for all virtual screens
179 if [ -n "${allscreens_flags}" ]; then
180 echo -n ' allscreens'
181 for ttyv in /dev/ttyv*; do
182 vidcontrol ${allscreens_flags} < ${ttyv} > ${ttyv} 2>&1
183 done
186 # set this keyboard mode for all virtual terminals
188 if [ -n "${allscreens_kbdflags}" ]; then
189 echo -n ' allscreens_kbd'
190 for ttyv in /dev/ttyv*; do
191 kbdcontrol ${allscreens_kbdflags} < ${ttyv} > ${ttyv} 2>&1
192 done
195 echo '.'
198 load_rc_config $name
199 run_rc_command "$1"