summaryrefslogtreecommitdiff
blob: ef97e38c9232772277e567aaffd39ea265024942 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

depend() {
	before gpm
	need hwsetup
}

start() {
	[ -f /etc/sysconfig/gentoo ] && source /etc/sysconfig/gentoo
	[ -f /etc/sysconfig/mouse ] && source /etc/sysconfig/mouse
	if [ -z "${MOUSE_DEVICE}" ]; then
		ewarn "No mouse detected. GPM will not be started."
		return 0
	fi
	einfo "Mouse is ${HILITE}${MOUSE_FULLNAME}${NORMAL} at ${HILITE}${MOUSE_DEVICE}${NORMAL} ..."

	if [ $(grep "#MOUSE=${MOUSETYPE}" /etc/conf.d/gpm) ]; then
		sed -i "\@MOUSE=${MOUSETYPE}@s@^#@@" /etc/conf.d/gpm
	else
		echo "MOUSE=${MOUSETYPE}" >>/etc/conf.d/gpm
	fi

	if [ $(grep "#MOUSEDEV=${DEVICE}" /etc/conf.d/gpm) ]; then
		sed -i "\@MOUSEDEV=${DEVICE}@s@^#@@" /etc/conf.d/gpm
	else
		echo "MOUSEDEV=${DEVICE}" >>/etc/conf.d/gpm
	fi
}

# vim: ft=gentoo-init-d: