summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'init.d/gpm-pre')
-rw-r--r--init.d/gpm-pre36
1 files changed, 36 insertions, 0 deletions
diff --git a/init.d/gpm-pre b/init.d/gpm-pre
new file mode 100644
index 0000000..af52b0e
--- /dev/null
+++ b/init.d/gpm-pre
@@ -0,0 +1,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: