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