1 1.1 lukem #!/bin/sh 2 1.1 lukem # 3 1.6 lukem # $NetBSD: wscons,v 1.6 2000/09/19 13:04:39 lukem Exp $ 4 1.1 lukem # 5 1.1 lukem 6 1.1 lukem # PROVIDE: wscons 7 1.4 lukem # REQUIRE: mountcritremote 8 1.1 lukem 9 1.1 lukem . /etc/rc.subr 10 1.1 lukem 11 1.1 lukem name="wscons" 12 1.6 lukem rcvar=$name 13 1.5 lukem start_cmd="wscons_start" 14 1.2 veego stop_cmd=":" 15 1.1 lukem 16 1.5 lukem wscons_start() 17 1.1 lukem { 18 1.5 lukem wscfg=/usr/sbin/wsconscfg 19 1.5 lukem wsfld=/usr/sbin/wsfontload 20 1.5 lukem config=/etc/wscons.conf 21 1.5 lukem usage="Usage: wsconfig [-n] [-f configfile] [-font fontpgm] [-screen screenpgm]" 22 1.5 lukem DOIT= 23 1.5 lukem 24 1.5 lukem while [ $# -gt 0 ]; do 25 1.5 lukem case $1 in 26 1.5 lukem -n) 27 1.5 lukem DOIT=echo 28 1.5 lukem ;; 29 1.5 lukem -f) 30 1.5 lukem config=$2 31 1.5 lukem shift 32 1.5 lukem ;; 33 1.5 lukem -font) 34 1.5 lukem wsfld=$2 35 1.5 lukem shift 36 1.5 lukem ;; 37 1.5 lukem -screen) 38 1.5 lukem wscfg=$2 39 1.5 lukem shift 40 1.5 lukem ;; 41 1.5 lukem *) 42 1.5 lukem echo $usage 43 1.5 lukem exit 1 44 1.5 lukem ;; 45 1.5 lukem esac 46 1.5 lukem shift 47 1.5 lukem done 48 1.5 lukem 49 1.5 lukem 50 1.5 lukem # args mean: 51 1.5 lukem # screen idx scr emul 52 1.5 lukem # font name width height enc file 53 1.5 lukem ( while read type arg1 arg2 arg3 arg4 arg5; do 54 1.5 lukem case "$type" in 55 1.5 lukem \#*|"") 56 1.5 lukem continue 57 1.5 lukem ;; 58 1.5 lukem font) 59 1.5 lukem name=$arg1 60 1.5 lukem width=$arg2 61 1.5 lukem height=$arg3 62 1.5 lukem enc=$arg4 63 1.5 lukem file=$arg5 64 1.5 lukem cmd=$wsfld 65 1.5 lukem 66 1.5 lukem case $width in 67 1.5 lukem -) 68 1.5 lukem ;; 69 1.5 lukem *) 70 1.5 lukem cmd="$cmd -w $width" 71 1.5 lukem ;; 72 1.5 lukem esac 73 1.5 lukem case $height in 74 1.5 lukem -) 75 1.5 lukem ;; 76 1.5 lukem *) 77 1.5 lukem cmd="$cmd -h $height" 78 1.5 lukem ;; 79 1.5 lukem esac 80 1.5 lukem case $enc in 81 1.5 lukem -) 82 1.5 lukem ;; 83 1.5 lukem *) 84 1.5 lukem cmd="$cmd -e $enc" 85 1.5 lukem ;; 86 1.5 lukem esac 87 1.5 lukem cmd="$cmd -N $name $file" 88 1.5 lukem eval $DOIT $cmd 89 1.5 lukem ;; 90 1.5 lukem screen) 91 1.5 lukem idx=$arg1 92 1.5 lukem scr=$arg2 93 1.5 lukem emul=$arg3 94 1.5 lukem cmd=$wscfg 95 1.5 lukem 96 1.5 lukem case $scr in 97 1.5 lukem -) 98 1.5 lukem ;; 99 1.5 lukem *) 100 1.5 lukem cmd="$cmd -t $scr" 101 1.5 lukem ;; 102 1.5 lukem esac 103 1.5 lukem case $emul in 104 1.5 lukem -) 105 1.5 lukem ;; 106 1.5 lukem *) 107 1.5 lukem cmd="$cmd -e $emul" 108 1.5 lukem ;; 109 1.5 lukem esac 110 1.5 lukem cmd="$cmd $idx" 111 1.5 lukem eval $DOIT $cmd 112 1.5 lukem ;; 113 1.5 lukem keyboard) 114 1.5 lukem kbd=$arg1 115 1.5 lukem cmd=$wscfg 116 1.5 lukem case $kbd in 117 1.5 lukem -|auto) 118 1.5 lukem cmd="$cmd -k" 119 1.5 lukem ;; 120 1.5 lukem *) 121 1.5 lukem cmd="$cmd -k $kbd" 122 1.5 lukem ;; 123 1.5 lukem esac 124 1.5 lukem eval $DOIT $cmd 125 1.5 lukem ;; 126 1.5 lukem mux) 127 1.5 lukem cmd="$wscfg -m $arg1" 128 1.5 lukem eval $DOIT $cmd 129 1.5 lukem ;; 130 1.5 lukem esac 131 1.5 lukem done ) < $config 132 1.1 lukem } 133 1.1 lukem 134 1.3 lukem load_rc_config $name 135 1.1 lukem run_rc_command "$1" 136