etc/services - sync with NetBSD-8
[minix.git] / etc / rc.d / wscons
blob33612e8173a8ccdb48337eda4fb0b1e5a81b6711
1 #!/bin/sh
3 # $NetBSD: wscons,v 1.13 2011/08/09 08:08:10 mbalmer Exp $
6 # PROVIDE: wscons
7 # REQUIRE: mountcritremote
8 # BEFORE: LOGIN
10 $_rc_subr_loaded . /etc/rc.subr
12 name="wscons"
13 rcvar=$name
14 start_cmd="wscons_start"
15 stop_cmd=":"
17 wscons_start()
19 wscfg=/usr/sbin/wsconscfg
20 wsfld=/usr/sbin/wsfontload
21 wsctl=/sbin/wsconsctl
22 config=/etc/wscons.conf
23 usage="Usage: wsconfig [-n] [-f configfile] [-font fontpgm] [-screen screenpgm]"
24 DOIT=
26 while [ $# -gt 0 ]; do
27 case $1 in
28 -n)
29 DOIT=echo
31 -f)
32 config=$2
33 shift
35 -font)
36 wsfld=$2
37 shift
39 -screen)
40 wscfg=$2
41 shift
44 echo $usage
45 exit 1
47 esac
48 shift
49 done
52 # args mean:
53 # screen idx scr emul
54 # font name width height enc file
55 ( while read type arg1 arg2 arg3 arg4 arg5; do
56 case "$type" in
57 \#*|"")
58 continue
61 font)
62 name=$arg1
63 width=$arg2
64 height=$arg3
65 enc=$arg4
66 file=$arg5
67 cmd=$wsfld
69 case $width in
73 cmd="$cmd -w $width"
75 esac
76 case $height in
80 cmd="$cmd -h $height"
82 esac
83 case $enc in
87 cmd="$cmd -e $enc"
89 esac
90 cmd="$cmd -N $name $file"
91 eval $DOIT $cmd
94 screen)
95 idx=$arg1
96 scr=$arg2
97 emul=$arg3
98 cmd=$wscfg
100 case $scr in
104 cmd="$cmd -t $scr"
106 esac
107 case $emul in
111 cmd="$cmd -e $emul"
113 esac
114 cmd="$cmd $idx"
115 eval $DOIT $cmd
118 keyboard)
119 kbd=$arg1
120 cmd=$wscfg
121 case $kbd in
122 -|auto)
123 cmd="$cmd -k"
126 cmd="$cmd -k $kbd"
128 esac
129 eval $DOIT $cmd
132 encoding)
133 map=$arg1
134 cmd="$wsctl -w \"encoding=$map\""
135 echo -n 'Keyboard '
136 eval $DOIT $cmd
139 mapfile)
140 mapfile=$arg1
141 ( while read entry; do
142 case "$entry" in
143 \#*|"")
144 continue
147 cmd="$wsctl -w \"map+=$entry\""
148 cmd="$cmd >/dev/null"
149 eval $DOIT $cmd
151 esac
152 done ) < $mapfile
155 mux)
156 cmd="$wscfg -m $arg1"
157 eval $DOIT $cmd
160 setvar)
161 dev=$arg1
162 var=$arg2
163 val=$arg3
165 case $dev in
166 ttyE*)
167 cmdmod="-d"
169 wskbd*)
170 cmdmod="-k"
172 wsmouse*)
173 cmdmod="-m"
175 esac
176 echo -n "$dev: "
177 cmd="$wsctl -f /dev/$dev $cmdmod -w $var=$val"
178 eval $DOIT $cmd
181 esac
182 done ) < $config
185 load_rc_config $name
186 run_rc_command "$1"