]> git.pld-linux.org Git - packages/fbset.git/blob - fbset.init
- run just before console (running after console caused resetting font)
[packages/fbset.git] / fbset.init
1 #!/bin/sh
2 # $Id$
3 #
4 # fbset:        Sets up fbcon video modes.
5 #
6 #
7 # chkconfig:    2345 69 31
8 # description:  fbset is a utility with which fbcons video modes can be read
9 #               and changed
10 #
11 # config:       /etc/sysconfig/fbset
12
13
14 # Source function library
15 . /etc/rc.d/init.d/functions
16
17 # Get service config
18 if [ -f /etc/sysconfig/fbset ]; then
19         . /etc/sysconfig/fbset
20 fi
21
22 function try_load
23 {
24         if [ -n "${FBMODULE}" ]; then
25                 _modprobe single $FBMODULE
26         else
27                 exit 0
28         fi
29 }
30 # Setting default depth
31 if [ -n "${DEPTH}" ]; then
32         DEPTH_options="-depth ${DEPTH}"
33 fi
34
35 # See how we were called.
36 case "$1" in
37   start)
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.
43                         cat /proc/fb | grep -q "." || try_load
44                 else
45                         # if not, then try to load specified kernel module
46                         try_load
47                 fi
48
49                 if [ -n "${FBMODE_default}" ]; then
50                         show "Setting default video mode"
51                         busy
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'`
56                                         /usr/bin/open -c $b -- /usr/sbin/fbset -fb /dev/fb/0 ${DEPTH_options} $FBMODE_default
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'`
61                                         /usr/bin/open -c $b -- /usr/sbin/fbset ${DEPTH_options} $FBMODE_default
62                                 done
63                         fi
64                         deltext
65                         ok
66                 fi
67                 touch /var/lock/subsys/fbset
68         else
69                 msg_already_running "fbset"
70                 exit 1
71         fi
72         ;;
73     stop)
74         if [ -f /var/lock/subsys/fbset ]; then
75                 rm -f /var/lock/subsys/fbset
76         else
77                 msg_not_running fbset
78         fi
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         ;;
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         ;;
107   *)
108         msg_usage "$0 {start|stop|status|restart|restart-all|reload}"
109         exit 1
110 esac
111
112 exit 0
This page took 0.053427 seconds and 3 git commands to generate.