summaryrefslogtreecommitdiff
blob: 02e798937cc938ff996540a47a29c3c3d3866097 (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
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit rpm systemd xdg-utils

MY_PN="${PN/-bin/}"

DESCRIPTION="Tool to control performance, energy, fan and comfort settings on TUXEDO laptops"
HOMEPAGE="https://github.com/tuxedocomputers/tuxedo-control-center"
SRC_URI="https://rpm.tuxedocomputers.com/opensuse/15.1/x86_64/${MY_PN}_${PV}.rpm"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="-* ~amd64"
IUSE=""

RESTRICT="strip splitdebug"

DEPEND="sys-power/tuxedo-cc-wmi"
RDEPEND="${DEPEND}"
BDEPEND=""

S="${WORKDIR}"

src_prepare() {
	default
	rm -rf usr/lib
	mkdir files
}

src_install() {
	insinto /
	doins -r usr opt
	find . -type f -perm -a=x | while read f; do
		chmod 0755 "${D}/${f}"
	done

	dosym ../../opt/tuxedo-control-center/tuxedo-control-center /usr/bin/tuxedo-control-center

	insinto /usr/share/dbus-1/system.d/
	doins opt/tuxedo-control-center/resources/dist/tuxedo-control-center/data/dist-data/com.tuxedocomputers.tccd.conf

	insinto /usr/share/polkit-1/actions
	doins opt/tuxedo-control-center/resources/dist/tuxedo-control-center/data/dist-data/de.tuxedocomputers.tcc.policy

	systemd_dounit opt/tuxedo-control-center/resources/dist/tuxedo-control-center/data/dist-data/tccd.service
	systemd_dounit opt/tuxedo-control-center/resources/dist/tuxedo-control-center/data/dist-data/tccd-sleep.service
}

pkg_config() {
	ebegin "Reloading systemd"
	systemctl daemon-reload
	eend $?
	ebegin "Enabling and starting tccd.service"
	systemctl enable --now tccd
	eend $?
	ebegin "Enabling and starting tccd-sleep.service"
	systemctl enable --now tccd-sleep
	eend $?
}

pkg_postinst() {
	xdg_desktop_database_update
	xdg_icon_cache_update
	elog
	elog "You need to enable tccd and tccd-sleep service before running tuxedo-control-center"
	elog
	elog "For your convenience you may just call:"
	elog "  emerge --config =${P}"
	elog
}

pkg_postrm() {
	xdg_desktop_database_update
	xdg_icon_cache_update
}