Ubuntu Pastebin

Paste from alberto at Fri, 16 Jan 2015 18:39:28 +0000

Download as text
 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
commit 1c1cc25d3993e0068b265ea65215b1f74dd73976
Author: Alberto Milone <alberto.milone@canonical.com>
Date:   Fri Jan 16 17:07:26 2015 +0100

    Add support for systemd

diff --git a/debian/control b/debian/control
index e682213..fe9dccc 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: nvidia-prime
 Section: admin
 Priority: optional
 Maintainer: Alberto Milone <alberto.milone@canonical.com>
-Build-Depends: debhelper (>= 8.0.0)
+Build-Depends: debhelper (>= 8.0.0), dh-systemd
 Standards-Version: 3.9.2
 Vcs-Git: git://github.com/tseliot/nvidia-prime.git
 Vcs-Browser: http://github.com/tseliot/nvidia-prime
diff --git a/debian/dirs.in b/debian/dirs.in
index c152495..dd43bd5 100644
--- a/debian/dirs.in
+++ b/debian/dirs.in
@@ -3,3 +3,4 @@
 #MISC_DIR#
 #LIGHTDM_LEGACY_CONF_DIR#
 #LIGHTDM_CONF_DIR#
+/lib/systemd/system
diff --git a/debian/install.in b/debian/install.in
index ef60317..58088af 100644
--- a/debian/install.in
+++ b/debian/install.in
@@ -6,3 +6,4 @@ get-quirk-options /sbin
 prime-select /usr/bin
 prime-supported /usr/bin
 oem /usr/lib/ubiquity/dm-scripts
+debian/nvidia-prime.service /lib/systemd/system
diff --git a/debian/nvidia-prime.service b/debian/nvidia-prime.service
new file mode 100644
index 0000000..65ba708
--- /dev/null
+++ b/debian/nvidia-prime.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Enable NVIDIA GPU for PRIME on Shutdown
+DefaultDependencies=no
+
+[Service]
+Type=oneshot
+ExecStart=-/bin/sh -c 'echo ON > /proc/acpi/bbswitch'
+
+[Install]
+WantedBy=shutdown.target
+
diff --git a/debian/rules b/debian/rules
index c4cb45b..e876c47 100755
--- a/debian/rules
+++ b/debian/rules
@@ -55,6 +55,15 @@ regen-from-templates:
 		$$i.in > $$i; \
 	done
 
+override_dh_install:
+	dh_install --fail-missing -Xlib/systemd
+
+	# on architectures where we build gpu-manager, install the systemd unit
+	if [ -d debian/tmp/lib/systemd ]; then \
+		dh_systemd_enable; \
+		dh_install -p nvidia-prime lib/systemd; \
+	fi
+
 override_dh_auto_clean:
 	for i in $(CURDIR)/debian/install \
 	     $(CURDIR)/debian/dirs \
Download as text