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