1#!/bin/sh - 2# 3# Copyright (c) 2000 The FreeBSD Project 4# All rights reserved. 5# 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. 14# 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. 26# 27# $FreeBSD: src/etc/rc.d/syscons,v 1.9 2002/09/09 22:40:34 gordon Exp $ 28# 29 30# PROVIDE: syscons 31# REQUIRE: LOGIN 32 33. /etc/rc.subr 34 35name="syscons" 36start_cmd="syscons_start" 37 38# stdin must be redirected because it might be for a serial console 39kbddev=/dev/ttyv0 40viddev=/dev/ttyv0 41 42syscons_start() 43{ 44 echo -n 'Configuring syscons:' 45 46 # keymap 47 # 48 case ${keymap} in 49 [Nn][Oo] | '') 50 ;; 51 *) 52 echo -n ' keymap' 53 kbdcontrol < ${kbddev} -l ${keymap} 54 ;; 55 esac 56 57 # keyrate 58 # 59 case ${keyrate} in 60 [Nn][Oo] | '') 61 ;; 62 *) 63 echo -n ' keyrate' 64 kbdcontrol < ${kbddev} -r ${keyrate} 65 ;; 66 esac 67 68 # keybell 69 # 70 case ${keybell} in 71 [Nn][Oo] | '') 72 ;; 73 *) 74 echo -n ' keybell' 75 kbdcontrol < ${kbddev} -b ${keybell} 76 ;; 77 esac 78 79 # change function keys 80 # 81 case ${keychange} in 82 [Nn][Oo] | '') 83 ;; 84 *) 85 echo -n ' keychange' 86 set - ${keychange} 87 while [ $# -gt 0 ]; do 88 kbdcontrol <${kbddev} -f "$1" "$2" 89 shift; shift 90 done 91 ;; 92 esac 93 94 # cursor type 95 # 96 case ${cursor} in 97 [Nn][Oo] | '') 98 ;; 99 *) 100 echo -n ' cursor' 101 vidcontrol < ${viddev} -c ${cursor} 102 ;; 103 esac 104 105 # screen mapping 106 # 107 case ${scrnmap} in 108 [Nn][Oo] | '') 109 ;; 110 *) 111 echo -n ' scrnmap' 112 vidcontrol < ${viddev} -l ${scrnmap} 113 ;; 114 esac 115 116 # font 8x16 117 # 118 case ${font8x16} in 119 [Nn][Oo] | '') 120 ;; 121 *) 122 echo -n ' font8x16' 123 vidcontrol < ${viddev} -f 8x16 ${font8x16} 124 ;; 125 esac 126 127 # font 8x14 128 # 129 case ${font8x14} in 130 [Nn][Oo] | '') 131 ;; 132 *) 133 echo -n ' font8x14' 134 vidcontrol < ${viddev} -f 8x14 ${font8x14} 135 ;; 136 esac 137 138 # font 8x8 139 # 140 case ${font8x8} in 141 [Nn][Oo] | '') 142 ;; 143 *) 144 echo -n ' font8x8' 145 vidcontrol < ${viddev} -f 8x8 ${font8x8} 146 ;; 147 esac 148 149 # blank time 150 # 151 case ${blanktime} in 152 [Nn][Oo] | '') 153 ;; 154 *) 155 echo -n ' blanktime' 156 vidcontrol < ${viddev} -t ${blanktime} 157 ;; 158 esac 159 160 # screen saver 161 # 162 case ${saver} in 163 [Nn][Oo] | '') 164 ;; 165 *) 166 echo -n ' screensaver' 167 for i in `kldstat | awk '$5 ~ "^splash_.*$" { print $5 }'`; do 168 kldunload ${i} 169 done 170 kldstat -qm ${saver}_saver || kldload -n ${saver}_saver 171 ;; 172 esac 173 174 # video history buffer 175 # 176 case ${vidhistory} in 177 [Nn][Oo] | '') 178 ;; 179 *) 180 echo -n ' vidhistory' 181 vidcontrol < ${viddev} -h ${vidhistory} 182 ;; 183 esac 184 185 # set this mode for all virtual screens 186 # 187 if [ -n "${allscreens_flags}" ]; then 188 echo -n ' allscreens' 189 for ttyv in /dev/ttyv*; do 190 vidcontrol ${allscreens_flags} < ${ttyv} > ${ttyv} 2>&1 191 done 192 fi 193 194 # set this keyboard mode for all virtual terminals 195 # 196 if [ -n "${allscreens_kbdflags}" ]; then 197 echo -n ' allscreens_kbd' 198 for ttyv in /dev/ttyv*; do 199 kbdcontrol ${allscreens_kbdflags} < ${ttyv} > ${ttyv} 2>&1 200 done 201 fi 202 203 echo '.' 204} 205 206load_rc_config $name 207run_rc_command "$1" 208