]> git.pld-linux.org Git - packages/fbset.git/blob - fbset.init
- fbset should start just after console - fixed
[packages/fbset.git] / fbset.init
1 #!/bin/sh
2 # $Id$
3 #
4 # fbset:        Sets up fbcon video modes.
5 #
6 #
7 # chkconfig:    2345 71 29
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
31 # See how we were called.
32 case "$1" in
33   start)
34         # Check if service is already running?
35         if [ ! -f /var/lock/subsys/fbset ]; then
36                 # Check if we have framebuffer in kernel.
37                 if [ -f /proc/fb ]; then
38                         # /proc files show as files with size=0, this is a workaround.
39                         cat /proc/fb | grep -q "." || try_load
40                 else
41                         # if not, then try to load specified kernel module
42                         try_load
43                 fi
44
45                 if [ -n "${FBMODE_default}" ]; then
46                         show "Setting default video mode"
47                         busy
48                         # check if devfs (workaround: -a option don't work at all)
49                         if [ -d /dev/vc ]; then
50                                 for a in `ls /dev/vc/*`; do
51                                         b=`ls $a | sed 's/\/dev\/vc\///g'`
52                                         /usr/bin/open -c $b -- /usr/sbin/fbset -fb /dev/fb/0 $FBMODE_default
53                                 done
54                         else
55                                 for a in `ls /dev/tty[0-9] && ls /dev/tty[0-9][0-9]`; do
56                                         b=`ls $a | sed 's/\/dev\/tty//g'`
57                                         /usr/bin/open -c $b -- /usr/sbin/fbset $FBMODE_default
58                                 done
59                         fi
60                         deltext
61                         ok
62                 fi
63                 touch /var/lock/subsys/fbset
64         else
65                 msg_Already_Running "fbset"
66                 exit 1
67         fi
68         ;;
69     stop)
70         rm -f /var/lock/subsys/fbset
71         ;;
72   status)
73         # Check if we have framebuffer in kernel.
74         if [ -f /proc/fb ]; then
75                 # /proc files show as files with size=0, this is a workaround.
76                 cat /proc/fb | grep -q "." || exit 0
77                 echo "Frame buffer present."
78         fi
79         ;;
80   restart|reload)
81         $0 stop
82         $0 start
83         ;;
84   *)
85         msg_Usage "$0 {start|stop|status|restart|reload}"
86         exit 1
87 esac
88
89 exit 0
This page took 0.039298 seconds and 4 git commands to generate.