openrc/init.d/wscons.in

100 lines
1.6 KiB
Plaintext
Raw Normal View History

#!@PREFIX@/sbin/runscript
2009-05-01 19:41:40 +05:30
# Copyright (c) 2008-2009 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.
depend()
{
need localmount
}
start()
{
wscfg=/usr/sbin/wsconscfg
wsfld=/usr/sbin/wsfontload
wsctl=/sbin/wsconsctl
config=/etc/wscons.conf
# args mean:
# screen idx scr emul
# font name width height enc file
while read type arg1 arg2 arg3 arg4 arg5; do
2009-04-27 13:21:18 +05:30
case "$type" in
\#*|"")
continue
;;
font)
2009-04-27 13:21:18 +05:30
cmd=$wsfld
[ "$arg2" != "-" ] && cmd="$cmd -w $arg2"
[ "$arg3" != "-" ] && cmd="$cmd -h $arg3"
2009-04-27 13:21:18 +05:30
[ "$arg4" != "-" ] && cmd="$cmd -e $arg4"
cmd="$cmd -N $arg1 $arg5"
eval "$cmd"
;;
screen)
2009-04-27 13:21:18 +05:30
cmd=$wscfg
[ "$arg2" != "-" ] && cmd="$cmd -t $arg2"
[ "$arg3" != "-" ] && cmd="$cmd -e $arg3"
cmd="$cmd $arg1"
eval "$cmd"
;;
keyboard)
2009-04-27 13:21:18 +05:30
cmd=$wscfg
case "$arg1" in
-|auto)
2009-04-27 13:21:18 +05:30
cmd="$cmd -k"
;;
*)
2009-04-27 13:21:18 +05:30
cmd="$cmd -k $arg1"
;;
esac
2009-04-27 13:21:18 +05:30
$cmd
;;
encoding)
2009-04-27 13:21:18 +05:30
eval $wsctl -w "\"encoding=$arg1\""
;;
mapfile)
local entry=
while read entry; do
2009-04-27 13:21:18 +05:30
case "$entry" in
\#*|"")
continue
;;
*)
2009-04-27 13:21:18 +05:30
cmd="$wsctl -w \"map+=$entry\""
eval "$cmd >/dev/null"
;;
esac
2009-04-27 13:21:18 +05:30
done < "$arg1"
;;
mux)
2009-04-27 13:21:18 +05:30
eval "$wscfg -m $arg1"
;;
setvar)
2009-04-27 13:21:18 +05:30
case "$arg1" in
keyboard)
2009-04-27 13:21:18 +05:30
cmd="$wsctl -kw $arg2"
;;
display)
2009-04-27 13:21:18 +05:30
cmd="$wsctl -dw $arg2"
;;
mouse)
2009-04-27 13:21:18 +05:30
cmd="$wsctl -mw $arg2"
;;
*)
2009-04-27 13:21:18 +05:30
cmd="$wsctl -w $arg1"
;;
esac
2009-04-27 13:21:18 +05:30
eval "$cmd"
;;
esac
2009-04-27 13:21:18 +05:30
done < "$config"
}