xref: /dragonfly/etc/rc.d/syscons (revision 19fe1c42)
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# $DragonFly: src/etc/rc.d/syscons,v 1.5 2005/11/19 21:47:32 swildner Exp $
29#
30
31# PROVIDE: syscons
32# REQUIRE: LOGIN usbd
33
34. /etc/rc.subr
35
36name="syscons"
37start_cmd="syscons_start"
38
39# stdin must be redirected because it might be for a serial console
40#
41kbddev=/dev/ttyv0
42viddev=/dev/ttyv0
43
44syscons_start()
45{
46	echo -n 'Configuring syscons:'
47
48	# keymap
49	#
50	case ${keymap} in
51	[Nn][Oo] | '')
52		;;
53	*)
54		echo -n ' keymap';	kbdcontrol < ${kbddev} -l ${keymap}
55		;;
56	esac
57
58	# keyrate
59	#
60	case ${keyrate} in
61	[Nn][Oo] | '')
62		;;
63	*)
64		echo -n ' keyrate';	kbdcontrol < ${kbddev} -r ${keyrate}
65		;;
66	esac
67
68	# keybell
69	#
70	case ${keybell} in
71	[Nn][Oo] | '')
72		;;
73	*)
74		echo -n ' keybell';	kbdcontrol < ${kbddev} -b ${keybell}
75		;;
76	esac
77
78	# change function keys
79	#
80	case ${keychange} in
81	[Nn][Oo] | '')
82		;;
83	*)
84		echo -n ' keychange'
85		set - ${keychange}
86		while [ $# -gt 0 ]; do
87			kbdcontrol <${kbddev} -f "$1" "$2"
88			shift; shift
89		done
90		;;
91	esac
92
93	# cursor type
94	#
95	case ${cursor} in
96	[Nn][Oo] | '')
97		;;
98	*)
99		echo -n ' cursor';	vidcontrol < ${viddev} -c ${cursor}
100		;;
101	esac
102
103	# screen mapping
104	#
105	case ${scrnmap} in
106	[Nn][Oo] | '')
107		;;
108	*)
109		echo -n ' scrnmap';	vidcontrol < ${viddev} -l ${scrnmap}
110		;;
111	esac
112
113	# font 8x16
114	#
115	case ${font8x16} in
116	[Nn][Oo] | '')
117		;;
118	*)
119		echo -n ' font8x16';	vidcontrol < ${viddev} -f 8x16 ${font8x16}
120		;;
121	esac
122
123	# font 8x14
124	#
125	case ${font8x14} in
126	[Nn][Oo] | '')
127		;;
128	*)
129		echo -n ' font8x14';	vidcontrol < ${viddev} -f 8x14 ${font8x14}
130		;;
131	esac
132
133	# font 8x8
134	#
135	case ${font8x8} in
136	[Nn][Oo] | '')
137		;;
138	*)
139		echo -n ' font8x8';	vidcontrol < ${viddev} -f 8x8 ${font8x8}
140		;;
141	esac
142
143	# blank time
144	#
145	case ${blanktime} in
146	[Nn][Oo] | '')
147		;;
148	*)
149		echo -n ' blanktime';	vidcontrol < ${viddev} -t ${blanktime}
150		;;
151	esac
152
153	# screen saver
154	#
155	case ${saver} in
156	[Nn][Oo] | '')
157		;;
158	*)
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
164		;;
165	esac
166
167	# video history buffer
168	#
169	case ${vidhistory} in
170	[Nn][Oo] | '')
171		;;
172	*)
173		echo -n ' vidhistory';	vidcontrol < ${viddev} -h ${vidhistory}
174		;;
175	esac
176
177	# set this mode for all virtual screens
178	#
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
184	fi
185
186	# set this keyboard mode for all virtual terminals
187	#
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
193	fi
194
195	echo '.'
196}
197
198load_rc_config $name
199run_rc_command "$1"
200