]> git.pld-linux.org Git - packages/fbset.git/blame - fbset.init
- typo
[packages/fbset.git] / fbset.init
CommitLineData
aff35f5c 1#!/bin/sh
3864f278 2# $Id$
aff35f5c 3#
3864f278 4# fbset: Sets up fbcon video modes.
aff35f5c 5#
6#
efa5a496 7# chkconfig: 2345 69 31
aa141c72 8# description: fbset is a utility with which fbcons video modes can be read \
aff35f5c 9# and changed
3864f278 10#
11# config: /etc/sysconfig/fbset
aff35f5c 12
aff35f5c 13# Get service config
3864f278 14if [ -f /etc/sysconfig/fbset ]; then
15 . /etc/sysconfig/fbset
16fi
aff35f5c 17
014fd80c 18if [ -z "${FBMODULE}" ]; then
9bc1b40a
ER
19 case "$1" in
20 start|stop|restart|force-reload)
21 exit 0
22 ;;
23 esac
014fd80c
ER
24fi
25
26# Source function library
27. /etc/rc.d/init.d/functions
109b85b6 28
4a590e27
PG
29# Setting default depth
30if [ -n "${DEPTH}" ]; then
31 DEPTH_options="-depth ${DEPTH}"
32fi
b3c5d50d 33
109b85b6 34if [ -z "${FBDEV_NUM}" ]; then
35 FBDEV_NUM=0
36fi
37
4d31033b 38start() {
3864f278 39 # Check if service is already running?
40 if [ ! -f /var/lock/subsys/fbset ]; then
6292f718 41
3864f278 42 # Check if we have framebuffer in kernel.
43 if [ -f /proc/fb ]; then
44 # /proc files show as files with size=0, this is a workaround.
f47868b7 45 cat /proc/fb | grep -q "." || _modprobe single $FBMODULE
3864f278 46 else
8e90effd 47 # if not, then try to load specified kernel module
f47868b7 48 _modprobe single $FBMODULE
3864f278 49 fi
aff35f5c 50
3864f278 51 if [ -n "${FBMODE_default}" ]; then
52 show "Setting default video mode"
aff35f5c 53 busy
6292f718 54
3864f278 55 # check if devfs (workaround: -a option don't work at all)
56 if [ -d /dev/vc ]; then
61e2d117 57 if [ -z "$FBTERMINALS" ]; then
0d5ebf02 58 FBTERMINALS=$(ls /dev/vc/)
61e2d117 59 fi
0d5ebf02
ER
60 FBDEV=/dev/fb/${FBDEV_NUM}
61 devpath="/dev/vc/"
3864f278 62 else
61e2d117 63 if [ -z "$FBTERMINALS" ]; then
0d5ebf02 64 FBTERMINALS=$(awk -F: '/^[0-9]*:/{print $1}' /etc/inittab)
61e2d117 65 fi
0d5ebf02
ER
66 FBDEV=/dev/fb${FBDEV_NUM}
67 devpath="/dev/tty"
3864f278 68 fi
109b85b6 69
e0c2904e 70 # save old tty number
0d5ebf02
ER
71 tty=$(/usr/bin/tty)
72 tty=${tty#$devpath}
e0c2904e 73
61e2d117 74 for cons in $FBTERMINALS; do
a85ed31e 75 /usr/bin/con2fb $FBDEV $cons
64d64bd0
JK
76 /usr/bin/switchto $cons
77 /usr/bin/fbset -fb \
78 $FBDEV ${DEPTH_options} $FBMODE_default \
79 0<>/dev/tty$cons >&0 2>&0
109b85b6 80 done
e0c2904e
JB
81 [ $tty = "/dev/console" ] && tty=1
82 /usr/bin/switchto $tty
aff35f5c 83 ok
84 fi
3864f278 85 touch /var/lock/subsys/fbset
86 else
6292f718 87 msg_already_running fbset
3864f278 88 fi
4d31033b
ER
89}
90
91stop() {
6292f718 92 if [ -f /var/lock/subsys/fbset ]; then
4a590e27
PG
93 rm -f /var/lock/subsys/fbset
94 else
95 msg_not_running fbset
96 fi
4d31033b
ER
97}
98
99# See how we were called.
100case "$1" in
101 start)
102 start
103 ;;
104 stop)
105 stop
aff35f5c 106 ;;
107 status)
108 # Check if we have framebuffer in kernel.
109 if [ -f /proc/fb ]; then
110 # /proc files show as files with size=0, this is a workaround.
f1e8c394 111 cat /proc/fb | grep -q "." && nls "Frame buffer present." && exit 0
aff35f5c 112 fi
187f4d9d
ER
113
114 nls "Frame buffer not present."
115 exit 3
aff35f5c 116 ;;
f1e8c394 117 restart|force-reload)
4d31033b
ER
118 stop
119 start
aff35f5c 120 ;;
121 *)
f1e8c394 122 msg_usage "$0 {start|stop|restart|force-reload|status}"
123 exit 3
aff35f5c 124esac
125
126exit 0
This page took 0.12019 seconds and 4 git commands to generate.