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