#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/855resolution/files/0.4/init,v 1.1 2005/06/19 22:07:03 fafhrd Exp $

depend() {
	before xdm
}

checkconfig() {
	if [ -z "${replace[0]}" ] || [ -z "${with[0]}" ]
	then
		eerror "You need to set at least one replace/with pair in /etc/conf.d/855resolution"
		return 1
	fi
}

start() {
	checkconfig || return 1

	ebegin "Running 855resolution to replace ${#replace[@]} mode(s)"
	i=0; return=0; retval=0
	for target in "${replace[@]}"
	do
		/usr/sbin/855resolution $target ${with[$i]} > /dev/null
		retval=$?
		if [ "$retval"!=0 ]; then return=$retval; fi
		i=$(($i+1))
	done
	eend $return
}

