blob: ee0ec029a7ed22227d15a79ce33f8325de5703e4 (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI=4
inherit linux-mod eutils
DESCRIPTION="Modules to turn off nVidia card for ASUS laptops"
HOMEPAGE="https://github.com/awilliam/asus-switcheroo"
KEYWORDS="~amd64"
DEPEND="sys-power/pm-utils"
RDEPEND="${DEPEND}"
SLOT="0"
LICENSE="GPL-2"
IUSE="video_cards_intel video_cards_nouveau video_cards_nvidia"
REQUIRED_USE="video_cards_nouveau? ( !video_cards_nvidia )"
GITHUB_COMMIT="178d072"
SRC_URI="http://www.github.com/awilliam/${PN}/tarball/${GITHUB_COMMIT} -> ${P}.tar.gz"
S="${WORKDIR}/awilliam-${PN}-${GITHUB_COMMIT}"
BUILD_TARGETS="default"
pkg_setup() {
MODULE_NAMES="${PN}(extra/${PN}:${S})"
use video_cards_intel && MODULE_NAMES="${MODULE_NAMES} i915-jprobe(extra/${PN}:${S})"
use video_cards_nouveau && MODULE_NAMES="${MODULE_NAMES} nouveau-jprobe(extra/${PN}:${S})"
linux-mod_pkg_setup
}
src_install(){
linux-mod_src_install
exeinto /etc/pm/sleep.d
doexe ${PN}-pm
if use video_cards_nvidia ; then
insinto /etc/modprobe.d
newins "${FILESDIR}"/${PN}.conf-nvidia ${PN}.conf
newinitd "${FILESDIR}"/switcheroo.rc switcheroo
exeinto /usr/sbin
newexe "${FILESDIR}"/switcheroo-to-nvidia.sh switcheroo-to-nvidia
insinto /etc/X11
doins "${FILESDIR}"/xorg.conf-nvidia
elif use video_cards_nouveau ; then
insinto /etc/modprobe.d
newins ${PN}.conf-modprobe.d ${PN}.conf
fi
}
pkg_postinst() {
elog "If debugfs isn't automatically mounted for you,"
elog " add this to your /etc/fstab:"
elog ""
elog " debugfs /sys/kernel/debug debugfs defaults 0 0"
elog ""
elog "Remember to add asus_switcheroo to /etc/conf.d/modules"
elog ""
elog "To turn off the discrete card on boot, put"
elog ""
elog 'if [ -f "/sys/kernel/debug/vgaswitcheroo/switch" ] ; then '
elog " /bin/echo OFF > /sys/kernel/debug/vgaswitcheroo/switch"
elog "fi"
elog ""
elog "in /etc/conf.d/local.start"
if use video_cards_nvidia ; then
elog ""
elog "This ebuild has installed a system for switching"
elog "to the nVidia card and driver. This system requires"
elog "that you use the supplied xorg.conf for nVidia"
elog "and no xorg.conf for the intel card. The switching"
elog "is handled by the command switcheroo-to-nvidia"
elog "and the switcheroo init.d script."
fi
linux-mod_pkg_postinst
}
|