#!/bin/sh
+# $Id$
#
-# hdpram Sets up fbcon video modes.
+# fbset: Sets up fbcon video modes.
#
#
-# chkconfig: 2345 5 95
-# description: fbset is a utility with which fbcons video modes can be read\
+# chkconfig: 2345 69 31
+# description: fbset is a utility with which fbcons video modes can be read
# and changed
-
+#
+# config: /etc/sysconfig/fbset
# Source function library
. /etc/rc.d/init.d/functions
# Get service config
-[ -f /etc/sysconfig/fbset ] && . /etc/sysconfig/fbset
+if [ -f /etc/sysconfig/fbset ]; then
+ . /etc/sysconfig/fbset
+fi
-# See how we were called.
-case "$1" in
- start)
- # Check if we have framebuffer in kernel.
- if [ -f /proc/fb ]; then
- # /proc files show as files with size=0, this is a workaround.
- cat /proc/fb | grep -q "." || exit 0
+function try_load
+{
+ if [ -n "${FBMODULE}" ]; then
+ _modprobe single $FBMODULE
else
exit 0
fi
+}
- if [ -n "${FBMODE_default}" ]; then
- show "Setting default video mode"
- busy
- /usr/sbin/fbset -a ${FBMODE_default}
- deltext
- ok
- fi
- for tty in /dev/tty[0-9]*; do
- eval FBMODE=\${FBMODE_${tty#/dev/}}
- if [ -n "${FBMODE}" ]; then
- # XXX fuser $tty <- sprawdziƦ, czy tty jest wolna.
- show "Setting $tty video mode"
+# Setting default depth
+if [ -n "${DEPTH}" ]; then
+ DEPTH_options="-depth ${DEPTH}"
+fi
+
+if [ -z "${FBDEV_NUM}" ]; then
+ FBDEV_NUM=0
+fi
+
+# See how we were called.
+case "$1" in
+ start)
+ # Check if service is already running?
+ if [ ! -f /var/lock/subsys/fbset ]; then
+
+ # Check if we have framebuffer in kernel.
+ if [ -f /proc/fb ]; then
+ # /proc files show as files with size=0, this is a workaround.
+ cat /proc/fb | grep -q "." || try_load
+ else
+ # if not, then try to load specified kernel module
+ try_load
+ fi
+
+ if [ -n "${FBMODE_default}" ]; then
+ show "Setting default video mode"
busy
- /usr/bin/open -c ${tty#/dev/tty} -- /usr/sbin/fbset ${FBMODE}
+
+ # check if devfs (workaround: -a option don't work at all)
+ if [ -d /dev/vc ]; then
+ if [ -z "$FBTERMINALS" ]; then
+ FBTERMINALS="`ls /dev/vc/* | sed 's|/dev/vc/||g'`"
+ fi
+ FBDEV=`echo /dev/fb/${FBDEV_NUM}`
+ else
+ if [ -z "$FBTERMINALS" ]; then
+ FBTERMINALS="`cat /etc/inittab | grep '^[0-9]*:' | cut -f1 -d:`"
+ fi
+ FBDEV=`echo /dev/fb${FBDEV_NUM}`
+ fi
+
+ for cons in $FBTERMINALS; do
+ /usr/bin/open -c $cons -- /usr/bin/fbset -fb $FBDEV ${DEPTH_options} $FBMODE_default
+ done
+
deltext
ok
fi
- done
- touch /var/lock/subsys/fbset
+ touch /var/lock/subsys/fbset
+ else
+ msg_already_running "fbset"
+ exit 1
+ fi
;;
- stop)
- rm -f /var/lock/subsys/fbset
+ stop)
+ if [ -f /var/lock/subsys/fbset ]; then
+ rm -f /var/lock/subsys/fbset
+ else
+ msg_not_running fbset
+ fi
;;
status)
# Check if we have framebuffer in kernel.
$0 start
;;
*)
- msg_Usage "$0 {start|stop|status|restart|reload}"
+ msg_usage "$0 {start|stop|status|restart|reload}"
exit 1
esac