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