#!/bin/sh # Startup script for hardware auto configuration # # chkconfig: 35 43 06 # description: Auto setup hardware WITHOUT_RC_COMPAT=1 # Source function library. . /etc/init.d/functions [ -f /usr/bin/x11createconfig ] || exit SETGL=/usr/bin/x11setupdrv LOCKFILE=/var/lock/subsys/x11createconfig RETVAL=0 start() { RETVAL=1 if [ ! -f /etc/X11/xorg.conf ];then local STRING="Setting up Xorg ..." echo -n "$STRING " /usr/bin/x11createconfig >/etc/X11/xorg.conf.auto local rc=$? [ $rc -eq 0 ] && success "$STRING" || failure "$STRING" grep -vq "vga=normal" /proc/cmdline || { # Now goes dirty bloody hack! subst '/Section.*"Device"/a\ Option "NoDDC"\ Option "NoDDC2" ' /etc/X11/xorg.conf.auto subst '/HoryzSync/d;/VertRefresh/d' /etc/X11/xorg.conf.auto subst '/Section "Monitor"/a\ HorizSync 30-50\ VertRefresh 60-70 ' /etc/X11/xorg.conf.auto } echo ln -s xorg.conf.auto /etc/X11/xorg.conf touch $LOCKFILE fi [ -x "$SETGL" ] && $SETGL ||: RETVAL=0 return $RETVAL } stop() { if [ -h /etc/X11/xorg.conf ] && [ "`readlink /etc/X11/xorg.conf`" == "xorg.conf.auto" ];then action "Remove Xorg configuration" rm -f /etc/X11/xorg.conf /etc/X11/xorg.conf.auto fi RETVAL=$? return $RETVAL } restart() { stop start } # See how we were called. case "$1" in start) start ;; stop) stop ;; reload|restart) restart ;; condstop) if [ -e "$LOCKFILE" ]; then stop fi ;; condrestart) if [ -e "$LOCKFILE" ]; then restart fi ;; status) status hardware RETVAL=$? ;; *) msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|status}" RETVAL=1 esac exit $RETVAL