summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancisco Soto2018-07-02 22:30:11 -0700
committerFrancisco Soto2018-07-03 12:03:24 -0700
commitcceb5b182a7b8483a417c17af56ffbacfccdd2c4 (patch)
treea23588a4a4a404589e4e43da3e466c392b55c99d
downloadaur-cceb5b182a7b8483a417c17af56ffbacfccdd2c4.tar.gz
System76 power control v72-1.
-rw-r--r--.SRCINFO21
-rw-r--r--.gitignore5
-rw-r--r--PKGBUILD56
-rw-r--r--graphics.patch11
-rw-r--r--nvidia-fallback.service10
-rw-r--r--system76-power.install56
6 files changed, 159 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..9b4f264a6e11
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,21 @@
+pkgbase = system76-power
+ pkgdesc = System76 Power Management
+ pkgver = 72
+ pkgrel = 1
+ url = https://github.com/pop-os/system76-power
+ install = system76-power.install
+ arch = any
+ license = GPL
+ makedepends = rust
+ depends = dbus
+ depends = systemd
+ depends = system76-dkms-git
+ source = system76::git+https://github.com/pop-os/system76-power.git#commit=038f0991aa4f351dcab55e06fc979fd929a833cc
+ source = graphics.patch
+ source = nvidia-fallback.service
+ sha1sums = SKIP
+ sha1sums = f87a11659913711009dad5fed9aacc3ed5548853
+ sha1sums = 5a81fb98c76cab0cd6e958d6776fca852c5ee4e2
+
+pkgname = system76-power
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..d01048399647
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*.tar.xz
+*.tar.gz
+/system76
+/pkg
+/src
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..bde07bfbe62b
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,56 @@
+# Maintainer: Francisco Soto <ebobby(at)ebobby(dot)org>
+
+_pkgname=system76
+_pkgbase=system76-power
+pkgname=system76-power
+pkgver=72
+pkgrel=1
+pkgdesc="System76 Power Management"
+arch=('any')
+url="https://github.com/pop-os/system76-power"
+license=('GPL')
+install="${pkgname}.install"
+depends=(
+ 'dbus'
+ 'systemd'
+ 'system76-dkms-git'
+)
+makedepends=('rust')
+source=(
+ 'system76::git+https://github.com/pop-os/system76-power.git#commit=038f0991aa4f351dcab55e06fc979fd929a833cc'
+ 'graphics.patch'
+ 'nvidia-fallback.service'
+ )
+sha1sums=(
+ 'SKIP'
+ 'f87a11659913711009dad5fed9aacc3ed5548853'
+ '5a81fb98c76cab0cd6e958d6776fca852c5ee4e2'
+)
+
+pkgver() {
+ cd ${srcdir}/${_pkgname}
+ git rev-list --count HEAD
+}
+
+build() {
+ cd ${startdir}
+ patch -p0 < ${startdir}/graphics.patch
+
+ cd ${srcdir}/${_pkgname}
+
+ # Build and install base package
+ cargo build --release
+}
+
+package() {
+ install -Dm644 ${srcdir}/nvidia-fallback.service ${pkgdir}/usr/lib/systemd/system/nvidia-fallback.service
+
+ # Install daemons
+ install -Dm755 ${srcdir}/${_pkgname}/target/release/system76-power ${pkgdir}/usr/bin/system76-power
+
+ # Install systemd unit files
+ install -Dm644 ${srcdir}/${_pkgname}/debian/system76-power.service ${pkgdir}/usr/lib/systemd/system/system76-power.service
+
+ # Install scripts and configuration
+ install -Dm755 ${srcdir}/${_pkgname}/data/system76-power.conf ${pkgdir}/usr/share/dbus-1/system.d/system76-power.conf
+}
diff --git a/graphics.patch b/graphics.patch
new file mode 100644
index 000000000000..7a608e1fcce8
--- /dev/null
+++ b/graphics.patch
@@ -0,0 +1,11 @@
+--- src/system76/src/graphics.rs 2018-07-02 00:24:56.431499529 -0700
++++ src/system76/src/graphics.rs.new 2018-07-02 00:25:55.448165538 -0700
+@@ -136,7 +136,7 @@
+ }
+
+ eprintln!("Updating initramfs");
+- let status = process::Command::new("update-initramfs").arg("-u").status()?;
++ let status = process::Command::new("mkinitcpio").arg("-p").arg("linux").status()?;
+ if ! status.success() {
+ return Err(io::Error::new(
+ io::ErrorKind::Other,
diff --git a/nvidia-fallback.service b/nvidia-fallback.service
new file mode 100644
index 000000000000..14cf6e884bd6
--- /dev/null
+++ b/nvidia-fallback.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Dummy service required by system76-power
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/bin/sh -c "echo 'Luke, I am your father' > /dev/null"
+
+[Install]
+WantedBy=multi-user.target
diff --git a/system76-power.install b/system76-power.install
new file mode 100644
index 000000000000..a9f9da66f5aa
--- /dev/null
+++ b/system76-power.install
@@ -0,0 +1,56 @@
+_services="system76-power.service nvidia-fallback.service"
+
+_stop_services() {
+ /usr/bin/systemctl stop $_services >/dev/null 2>&1
+}
+
+_disable_services() {
+ /usr/bin/systemctl disable $_services >/dev/null 2>&1
+ /usr/bin/systemctl reset-failed $_services >/dev/null 2>&1
+}
+
+_restore_services() {
+ for service in $_services; do
+ if /usr/bin/systemctl -q is-enabled $service >/dev/null 2>&1; then
+ /usr/bin/systemctl start $service > /dev/null 2>&1
+ fi
+ done
+}
+
+post_install() {
+cat << EOF
+
+ The System76 Power package provides the following system services:
+
+ system76-power.service System76 power support
+
+ And the following application
+
+ system76-power System76 power CLI interface
+
+EOF
+}
+
+pre_upgrade() {
+ _stop_services
+}
+
+post_upgrade() {
+ /usr/bin/systemctl daemon-reload >/dev/null 2>&1
+ _restore_services
+ post_install
+}
+
+pre_remove() {
+ _stop_services
+ _disable_services
+}
+
+post_remove() {
+ /usr/bin/systemctl daemon-reload >/dev/null 2>&1
+ cat << EOF
+
+ Be sure to stop and disable all running System76 user services.
+
+EOF
+}