2000-03-10 14:53:23 +03:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-04-26 04:06:53 +04:00
|
|
|
# $NetBSD: wscons,v 1.9 2002/04/26 00:06:54 lukem Exp $
|
2000-03-10 14:53:23 +03:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: wscons
|
2000-07-26 04:11:48 +04:00
|
|
|
# REQUIRE: mountcritremote
|
2002-03-22 07:33:57 +03:00
|
|
|
# BEFORE: LOGIN
|
2000-03-10 14:53:23 +03:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="wscons"
|
2000-09-19 17:04:38 +04:00
|
|
|
rcvar=$name
|
2000-08-22 03:01:36 +04:00
|
|
|
start_cmd="wscons_start"
|
2000-03-11 23:11:16 +03:00
|
|
|
stop_cmd=":"
|
2000-03-10 14:53:23 +03:00
|
|
|
|
2000-08-22 03:01:36 +04:00
|
|
|
wscons_start()
|
2000-03-10 14:53:23 +03:00
|
|
|
{
|
2000-08-22 03:01:36 +04:00
|
|
|
wscfg=/usr/sbin/wsconscfg
|
|
|
|
wsfld=/usr/sbin/wsfontload
|
2001-05-02 19:14:02 +04:00
|
|
|
wsctl=/sbin/wsconsctl
|
2000-08-22 03:01:36 +04:00
|
|
|
config=/etc/wscons.conf
|
|
|
|
usage="Usage: wsconfig [-n] [-f configfile] [-font fontpgm] [-screen screenpgm]"
|
|
|
|
DOIT=
|
|
|
|
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case $1 in
|
|
|
|
-n)
|
|
|
|
DOIT=echo
|
|
|
|
;;
|
|
|
|
-f)
|
|
|
|
config=$2
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-font)
|
|
|
|
wsfld=$2
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-screen)
|
|
|
|
wscfg=$2
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo $usage
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
# args mean:
|
|
|
|
# screen idx scr emul
|
|
|
|
# font name width height enc file
|
|
|
|
( while read type arg1 arg2 arg3 arg4 arg5; do
|
|
|
|
case "$type" in
|
|
|
|
\#*|"")
|
|
|
|
continue
|
|
|
|
;;
|
2002-04-26 04:06:53 +04:00
|
|
|
|
2000-08-22 03:01:36 +04:00
|
|
|
font)
|
|
|
|
name=$arg1
|
|
|
|
width=$arg2
|
|
|
|
height=$arg3
|
|
|
|
enc=$arg4
|
|
|
|
file=$arg5
|
|
|
|
cmd=$wsfld
|
|
|
|
|
|
|
|
case $width in
|
|
|
|
-)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cmd="$cmd -w $width"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
case $height in
|
|
|
|
-)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cmd="$cmd -h $height"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
case $enc in
|
|
|
|
-)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cmd="$cmd -e $enc"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
cmd="$cmd -N $name $file"
|
|
|
|
eval $DOIT $cmd
|
|
|
|
;;
|
2002-04-26 04:06:53 +04:00
|
|
|
|
2000-08-22 03:01:36 +04:00
|
|
|
screen)
|
|
|
|
idx=$arg1
|
|
|
|
scr=$arg2
|
|
|
|
emul=$arg3
|
|
|
|
cmd=$wscfg
|
|
|
|
|
|
|
|
case $scr in
|
|
|
|
-)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cmd="$cmd -t $scr"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
case $emul in
|
|
|
|
-)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cmd="$cmd -e $emul"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
cmd="$cmd $idx"
|
|
|
|
eval $DOIT $cmd
|
|
|
|
;;
|
2002-04-26 04:06:53 +04:00
|
|
|
|
2000-08-22 03:01:36 +04:00
|
|
|
keyboard)
|
|
|
|
kbd=$arg1
|
|
|
|
cmd=$wscfg
|
|
|
|
case $kbd in
|
|
|
|
-|auto)
|
|
|
|
cmd="$cmd -k"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
cmd="$cmd -k $kbd"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
eval $DOIT $cmd
|
|
|
|
;;
|
2002-04-26 04:06:53 +04:00
|
|
|
|
2001-05-02 19:14:02 +04:00
|
|
|
encoding)
|
|
|
|
map=$arg1
|
2002-04-26 04:06:53 +04:00
|
|
|
cmd="$wsctl -w \"encoding=$map\""
|
2001-05-02 19:14:02 +04:00
|
|
|
eval $DOIT $cmd
|
|
|
|
;;
|
2002-04-26 04:06:53 +04:00
|
|
|
|
2001-05-02 19:14:02 +04:00
|
|
|
mapfile)
|
|
|
|
mapfile=$arg1
|
|
|
|
( while read entry; do
|
|
|
|
case "$entry" in
|
|
|
|
\#*|"")
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
*)
|
2002-04-26 04:06:53 +04:00
|
|
|
cmd="$wsctl -w \"map+=$entry\""
|
2001-05-02 19:14:02 +04:00
|
|
|
cmd="$cmd >/dev/null"
|
|
|
|
eval $DOIT $cmd
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done ) < $mapfile
|
|
|
|
;;
|
2002-04-26 04:06:53 +04:00
|
|
|
|
2000-08-22 03:01:36 +04:00
|
|
|
mux)
|
|
|
|
cmd="$wscfg -m $arg1"
|
|
|
|
eval $DOIT $cmd
|
|
|
|
;;
|
2002-04-26 04:06:53 +04:00
|
|
|
|
|
|
|
setvar)
|
|
|
|
cmd="$wsctl -w $arg1"
|
|
|
|
eval $DOIT $cmd
|
|
|
|
;;
|
|
|
|
|
2000-08-22 03:01:36 +04:00
|
|
|
esac
|
|
|
|
done ) < $config
|
2000-03-10 14:53:23 +03:00
|
|
|
}
|
|
|
|
|
2000-05-13 12:45:06 +04:00
|
|
|
load_rc_config $name
|
2000-03-10 14:53:23 +03:00
|
|
|
run_rc_command "$1"
|