summaryrefslogtreecommitdiff
blob: af52b0e2785a9006a270c0037f5c01f114a6b8b6 (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
34
35
36
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

# Do one of the following:
# Add to /etc/rc.conf: rc_gpm_need="autoconfig-gpm-pre"
# XOR
# Add to /etc/conf.d/gpm: rc_need="autoconfig-gpm-pre"

depend() {
	before gpm
	need hwsetup
}

start() {
	# FIXME: If MOUSE_DEVICE is empty, we actually do not want to do anything, not even start gpm.
	# created by hwsetup
	source /etc/sysconfig/gentoo
	source /etc/sysconfig/mouse
	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: