]> git.pld-linux.org Git - packages/fbset.git/blob - fbset.init
- use macros in %{pre,post}{,un}
[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 # See how we were called.
23 case "$1" in
24   start)
25         # Check if service is already running?
26         if [ ! -f /var/lock/subsys/fbset ]; then
27                 # Check if we have framebuffer in kernel.
28                 if [ -f /proc/fb ]; then
29                         # /proc files show as files with size=0, this is a workaround.
30                         cat /proc/fb | grep -q "." || exit 0
31                 else
32                         exit 0
33                 fi
34
35                 if [ -n "${FBMODE_default}" ]; then
36                         show "Setting default video mode"
37                         busy
38                         # check if devfs (workaround: -a option don't work at all)
39                         if [ -d /dev/vc ]; then
40                                 for a in `ls /dev/vc/*`; do
41                                         b=`ls $a | sed 's/\/dev\/vc\///g'`
42                                         /usr/bin/open -c $b -- /usr/sbin/fbset $FBMODE_default
43                                 done
44                         else
45                                 for a in `ls /dev/tty[0-9] && ls /dev/tty[0-9][0-9]`; do
46                                         b=`ls $a | sed 's/\/dev\/tty//g'`
47                                         /usr/bin/open -c $b -- /usr/sbin/fbset $FBMODE_default
48                                 done
49                         fi
50                         deltext
51                         ok
52                 fi
53                 touch /var/lock/subsys/fbset
54         else
55                 msg_Already_Running "fbset"
56                 exit 1
57         fi
58         ;;
59     stop)
60         rm -f /var/lock/subsys/fbset
61         ;;
62   status)
63         # Check if we have framebuffer in kernel.
64         if [ -f /proc/fb ]; then
65                 # /proc files show as files with size=0, this is a workaround.
66                 cat /proc/fb | grep -q "." || exit 0
67                 echo "Frame buffer present."
68         fi
69         ;;
70   restart|reload)
71         $0 stop
72         $0 start
73         ;;
74   *)
75         msg_Usage "$0 {start|stop|status|restart|reload}"
76         exit 1
77 esac
78
79 exit 0
This page took 0.074569 seconds and 3 git commands to generate.