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