summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartłomiej Piotrowski2018-01-05 21:15:38 +0100
committerBartłomiej Piotrowski2018-01-05 21:15:38 +0100
commit2da3eedd47f774cb48f634e5d7384a84d70a357b (patch)
treeeb25d5bf3860713cc9ec78259915a8250f77cf62
downloadaur-2da3eedd47f774cb48f634e5d7384a84d70a357b.tar.gz
Import from official repositories
-rw-r--r--.SRCINFO23
-rw-r--r--03acpi-check.dpatch28
-rw-r--r--PKGBUILD46
-rw-r--r--ibam-0.5.2-debian-sysfs-lenovo.patch76
-rw-r--r--ibam-0.5.2-sysfs.patch17
-rw-r--r--ibam.install8
6 files changed, 198 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..fcf0955927e6
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,23 @@
+pkgbase = ibam
+ pkgdesc = An intelligent battery monitor
+ pkgver = 0.5.2
+ pkgrel = 9
+ url = http://ibam.sourceforge.net/
+ install = ibam.install
+ arch = x86_64
+ license = GPL
+ makedepends = sed
+ makedepends = make
+ depends = gcc-libs
+ optdepends = gnuplot: graphs support
+ source = http://downloads.sourceforge.net/sourceforge/ibam/ibam-0.5.2.tar.gz
+ source = 03acpi-check.dpatch
+ source = ibam-0.5.2-sysfs.patch
+ source = ibam-0.5.2-debian-sysfs-lenovo.patch
+ md5sums = 2d5222ff504dd19e7c1ea8acc2f13cf5
+ md5sums = 2f27fc97932bd59cabacbad063a13f0e
+ md5sums = 2a50027f73276d91555105b713687a4d
+ md5sums = 49f0667537a221f9f1ab5b8a1f513adb
+
+pkgname = ibam
+
diff --git a/03acpi-check.dpatch b/03acpi-check.dpatch
new file mode 100644
index 000000000000..7a688fe20158
--- /dev/null
+++ b/03acpi-check.dpatch
@@ -0,0 +1,28 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 03acpi-check.dpatch by Martin Wuertele <maxx@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: change detection for sysfs and sysfs variable names for 2.6.30+ kernels
+
+@DPATCH@
+--- ibam-0.5.2/ibam.inl.orig 2010-01-03 12:17:10.000000000 +0100
++++ ibam-0.5.2/ibam.inl 2010-01-03 12:17:19.000000000 +0100
+@@ -945,7 +945,7 @@
+ string sysfs_path = "/sys/class/power_supply"; // ...
+ ifstream pmu,acpi,sysfs;
+ pmu.open((pmu_path+"/info").c_str());
+- acpi.open((acpi_path+"/info").c_str());
++ acpi.open((acpi_path+"/event").c_str());
+ if (pmu.is_open()) {
+ #ifdef IBAM_DEBUG
+ cout << "using pmu" << endl;
+@@ -959,7 +959,7 @@
+ acpi.close();
+ apm = new acpi_status();
+ } else {
+- sysfs.open((sysfs_path+"/BAT1/charge_full").c_str());
++ sysfs.open((sysfs_path+"/BAT0/present").c_str());
+ if(sysfs.is_open()) {
+ #ifdef IBAM_DEBUG
+ cout << "using sysfs" << endl;
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..55f731aeddce
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,46 @@
+# $Id: PKGBUILD 266875 2017-11-15 14:29:11Z foutrelis $
+# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
+# Contributor: Kessia 'even' Pinheiro <kessiapinheiro at gmail.com>
+# Contributor: Penguin <TGates81.at.gmail.dot.com>
+
+pkgname=ibam
+pkgver=0.5.2
+pkgrel=9
+pkgdesc="An intelligent battery monitor"
+arch=('x86_64')
+url="http://ibam.sourceforge.net/"
+license=('GPL')
+depends=('gcc-libs')
+makedepends=('sed' 'make')
+optdepends=('gnuplot: graphs support')
+install="ibam.install"
+source=("http://downloads.sourceforge.net/sourceforge/$pkgname/$pkgname-$pkgver.tar.gz"
+ 03acpi-check.dpatch
+ ibam-0.5.2-sysfs.patch
+ ibam-0.5.2-debian-sysfs-lenovo.patch)
+md5sums=('2d5222ff504dd19e7c1ea8acc2f13cf5'
+ '2f27fc97932bd59cabacbad063a13f0e'
+ '2a50027f73276d91555105b713687a4d'
+ '49f0667537a221f9f1ab5b8a1f513adb')
+
+prepare() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ sed -i \
+ -e "s|/local/bin|/bin|g" \
+ -e "s|^CFLAGS=-O3|CFLAGS=${CFLAGS}|g" \
+ Makefile
+ patch -p1 <"$srcdir"/03acpi-check.dpatch
+ patch -p1 <"$srcdir"/ibam-0.5.2-sysfs.patch
+ patch -p1 <"$srcdir"/ibam-0.5.2-debian-sysfs-lenovo.patch
+}
+
+build() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ install -m0755 -d "$pkgdir"/usr/bin
+ install -m0755 -D "$srcdir"/${pkgname}-${pkgver}/ibam "$pkgdir"/usr/bin/ibam
+}
diff --git a/ibam-0.5.2-debian-sysfs-lenovo.patch b/ibam-0.5.2-debian-sysfs-lenovo.patch
new file mode 100644
index 000000000000..1da897f8897f
--- /dev/null
+++ b/ibam-0.5.2-debian-sysfs-lenovo.patch
@@ -0,0 +1,76 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 05_sysfs_lenovo.dpatch by Martin Wuertele <maxx@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: add lenovo sysfs detection
+
+@DPATCH@
+
+--- ibam-0.5.2/ibam.inl.orig 2011-02-15 21:42:39.000000000 +0100
++++ ibam-0.5.2/ibam.inl 2011-02-15 21:41:08.000000000 +0100
+@@ -540,6 +540,7 @@
+
+ if(present)
+ {
++ // try charge_full
+ in.open((((Path)+battery_entry->d_name)+"/charge_full").c_str());
+ if(!in.fail())
+ {
+@@ -547,10 +548,19 @@
+ total_capacity+=capacity;
+ }
+ in.close();
++ // try energy_full
++ in.open((((Path)+battery_entry->d_name)+"/energy_full").c_str());
++ if(!in.fail())
++ {
++ in>>capacity;
++ total_capacity+=capacity;
++ }
++ in.close();
+ }
+
+ if(present && capacity)
+ {
++ // try charge_now
+ in.open((((Path)+battery_entry->d_name)+"/charge_now").c_str());
+ if(!in.fail())
+ {
+@@ -558,10 +568,19 @@
+ total_remain+=remain;
+ }
+ in.close();
+- }
++ // try energy_now
++ in.open((((Path)+battery_entry->d_name)+"/energy_now").c_str());
++ if(!in.fail())
++ {
++ in>>remain;
++ total_remain+=remain;
++ }
++ in.close();
++ }
+
+ if(present && capacity)
+ {
++ // try current_now
+ in.open((((Path)+battery_entry->d_name)+"/current_now").c_str());
+ if(!in.fail())
+ {
+@@ -569,7 +588,15 @@
+ total_rate+=rate;
+ }
+ in.close();
+- }
++ // try energy_now
++ in.open((((Path)+battery_entry->d_name)+"/energy_now").c_str());
++ if(!in.fail())
++ {
++ in>>rate;
++ total_rate+=rate;
++ }
++ in.close();
++ }
+
+ if(present && capacity)
+ {
diff --git a/ibam-0.5.2-sysfs.patch b/ibam-0.5.2-sysfs.patch
new file mode 100644
index 000000000000..a20b83db2e94
--- /dev/null
+++ b/ibam-0.5.2-sysfs.patch
@@ -0,0 +1,17 @@
+diff -wbBur ibam-0.5.2/ibam.inl ibam-0.5.2.q/ibam.inl
+--- ibam-0.5.2/ibam.inl 2009-03-09 19:53:20.000000000 +0300
++++ ibam-0.5.2.q/ibam.inl 2013-11-11 23:45:39.197066574 +0400
+@@ -959,7 +959,13 @@
+ acpi.close();
+ apm = new acpi_status();
+ } else {
+ sysfs.open((sysfs_path+"/BAT0/present").c_str());
++ if(!sysfs.is_open()) {
++ sysfs.open((sysfs_path+"/BAT1/present").c_str());
++ }
++ if(!sysfs.is_open()) {
++ sysfs.open((sysfs_path+"/BAT2/present").c_str());
++ }
+ if(sysfs.is_open()) {
+ #ifdef IBAM_DEBUG
+ cout << "using sysfs" << endl;
diff --git a/ibam.install b/ibam.install
new file mode 100644
index 000000000000..507c1581d9ea
--- /dev/null
+++ b/ibam.install
@@ -0,0 +1,8 @@
+post_install() {
+ echo -e "-> install gnuplot to use the \`--plot' switch."
+ /bin/true
+}
+
+post_upgrade() {
+ post_install $1
+}