summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancisco Soto2018-09-11 20:32:28 -0700
committerFrancisco Soto2018-09-11 20:32:28 -0700
commit8bb0834b3f036ca8621788c98145b155cc997a0b (patch)
tree0023ca70b7e8daf3bd62ad9b09c471c3c450a637
downloadaur-8bb0834b3f036ca8621788c98145b155cc997a0b.tar.gz
First version of system76-power-git. 100-1.
-rw-r--r--.SRCINFO20
-rw-r--r--PKGBUILD53
-rw-r--r--graphics.patch33
-rw-r--r--system76-power-git.install64
4 files changed, 170 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..3caed4c72d15
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,20 @@
+pkgbase = system76-power-git
+ pkgdesc = System76 Power Management
+ pkgver = 100
+ pkgrel = 1
+ url = https://github.com/pop-os/system76-power
+ install = system76-power-git.install
+ arch = any
+ license = GPL
+ makedepends = rust
+ depends = dbus
+ depends = systemd
+ depends = system76-dkms
+ conflicts = system76-power
+ source = system76::git+https://github.com/pop-os/system76-power.git#branch=master
+ source = graphics.patch
+ sha1sums = SKIP
+ sha1sums = e486644709099b6348dc96d5f468ae289840dade
+
+pkgname = system76-power-git
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..806d307fba1d
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,53 @@
+# Maintainer: Francisco Soto <ebobby(at)ebobby(dot)org>
+
+_pkgname=system76
+_pkgbase=system76-power
+pkgname=system76-power-git
+pkgver=100
+pkgrel=1
+pkgdesc="System76 Power Management"
+arch=('any')
+url="https://github.com/pop-os/system76-power"
+license=('GPL')
+install="${pkgname}.install"
+conflicts=("system76-power")
+depends=(
+ 'dbus'
+ 'systemd'
+ 'system76-dkms'
+)
+makedepends=('rust')
+source=(
+ 'system76::git+https://github.com/pop-os/system76-power.git#branch=master'
+ 'graphics.patch'
+ )
+sha1sums=(
+ 'SKIP'
+ 'e486644709099b6348dc96d5f468ae289840dade'
+)
+
+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 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..8937050a20de
--- /dev/null
+++ b/graphics.patch
@@ -0,0 +1,33 @@
+--- src/system76/src/graphics.rs 2018-09-11 20:08:40.269995504 -0700
++++ src/system76/src/graphics.rs.new 2018-09-11 20:10:14.403327798 -0700
+@@ -12,10 +12,10 @@
+ blacklist nvidia
+ blacklist nvidia-drm
+ blacklist nvidia-modeset
+-alias nouveau off
+-alias nvidia off
+-alias nvidia-drm off
+-alias nvidia-modeset off
++#alias nouveau off
++#alias nvidia off
++#alias nvidia-drm off
++#alias nvidia-modeset off
+ "#;
+
+ pub struct Graphics {
+@@ -135,12 +135,12 @@
+ }
+ }
+
+- info!("Updating initramfs");
+- let status = process::Command::new("update-initramfs").arg("-u").status()?;
++ info!("Updating mkinitcpio");
++ let status = process::Command::new("mkinitcpio").arg("-P").status()?;
+ if ! status.success() {
+ return Err(io::Error::new(
+ io::ErrorKind::Other,
+- format!("update-initramfs: failed with {}", status)
++ format!("mkinitcpio: failed with {}", status)
+ ));
+ }
+
diff --git a/system76-power-git.install b/system76-power-git.install
new file mode 100644
index 000000000000..20d9b7467ca9
--- /dev/null
+++ b/system76-power-git.install
@@ -0,0 +1,64 @@
+_services="system76-power.service"
+
+_stop_services() {
+ for service in $_services; do
+ if /usr/bin/systemctl -q is-active $service >/dev/null 2>&1; then
+ /usr/bin/systemctl stop $service >/dev/null 2>&1
+ fi
+ done
+}
+
+_disable_services() {
+ for service in $_services; do
+ if /usr/bin/systemctl -q is-enabled $service >/dev/null 2>&1; then
+ /usr/bin/systemctl disable $service >/dev/null 2>&1
+ /usr/bin/systemctl reset-failed $service >/dev/null 2>&1
+ fi
+ done
+}
+
+_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
+}