FBDEV_NUM=0
fi
-# See how we were called.
-case "$1" in
- start)
+start() {
# Check if service is already running?
if [ ! -f /var/lock/subsys/fbset ]; then
# 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'`"
+ FBTERMINALS=$(ls /dev/vc/)
fi
- FBDEV=`echo /dev/fb/${FBDEV_NUM}`
+ FBDEV=/dev/fb/${FBDEV_NUM}
+ devpath="/dev/vc/"
else
if [ -z "$FBTERMINALS" ]; then
- FBTERMINALS=\
- "`cat /etc/inittab | grep '^[0-9]*:' | cut -f1 -d:`"
+ FBTERMINALS=$(awk -F: '/^[0-9]*:/{print $1}' /etc/inittab)
fi
- FBDEV=`echo /dev/fb${FBDEV_NUM}`
+ FBDEV=/dev/fb${FBDEV_NUM}
+ devpath="/dev/tty"
fi
+ # save old tty number
+ tty=$(/usr/bin/tty)
+ tty=${tty#$devpath}
+
for cons in $FBTERMINALS; do
- /usr/bin/open -c $cons -w -- /usr/bin/fbset -fb \
- $FBDEV ${DEPTH_options} $FBMODE_default
+ /usr/bin/con2fb $FBDEV $cons
+ /usr/bin/switchto $cons
+ /usr/bin/fbset -fb \
+ $FBDEV ${DEPTH_options} $FBMODE_default \
+ 0<>/dev/tty$cons >&0 2>&0
done
+ [ $tty = "/dev/console" ] && tty=1
+ /usr/bin/switchto $tty
ok
fi
touch /var/lock/subsys/fbset
else
msg_already_running fbset
fi
- ;;
- stop)
+}
+
+stop() {
if [ -f /var/lock/subsys/fbset ]; then
rm -f /var/lock/subsys/fbset
else
msg_not_running fbset
fi
+}
+
+# See how we were called.
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
;;
status)
# 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 "." && nls "Frame buffer present." && exit 0
- nls "Frame buffer not present."
- exit 3
- else
- nls "Frame buffer not present."
- exit 3
fi
+
+ nls "Frame buffer not present."
+ exit 3
;;
restart|force-reload)
- $0 stop
- $0 start
-# exit $?
+ stop
+ start
;;
*)
msg_usage "$0 {start|stop|restart|force-reload|status}"