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