summaryrefslogtreecommitdiff
path: root/sysutils/torsmo
diff options
context:
space:
mode:
authorghen <ghen>2006-03-29 21:42:55 +0000
committerghen <ghen>2006-03-29 21:42:55 +0000
commit6a72873631518d830d9314a2948baced7d329887 (patch)
tree040182b4d6fa5a96d7214692b9db95f6a8726372 /sysutils/torsmo
parent045b219821bc2a9f9df31304540db12d2d49b7d6 (diff)
downloadpkgsrc-6a72873631518d830d9314a2948baced7d329887.tar.gz
Torsmo is a system monitor that sits in the corner of your desktop. It's
very simple, customizable and it renders only text on the desktop (and percentagebars if you want it to ;) and the only lib it uses is Xlib. Torsmo can show various information about your system and it's peripherals, including: * Kernel version * Uptime * System time * Network interface information * Memory and swap usage * Hostname * Machine, i686 for example * System name, Linux for example * Temperatures from i2c-sensors * Temperature from ACPI * Battery capacity from ACPI/APM * Number of processes running or sleeping * Local mails (unread and all) * Filesystem stats
Diffstat (limited to 'sysutils/torsmo')
-rw-r--r--sysutils/torsmo/DESCR20
-rw-r--r--sysutils/torsmo/Makefile33
-rw-r--r--sysutils/torsmo/PLIST8
-rw-r--r--sysutils/torsmo/distinfo8
-rw-r--r--sysutils/torsmo/patches/patch-aa43
-rw-r--r--sysutils/torsmo/patches/patch-ab155
-rw-r--r--sysutils/torsmo/patches/patch-ac19
7 files changed, 286 insertions, 0 deletions
diff --git a/sysutils/torsmo/DESCR b/sysutils/torsmo/DESCR
new file mode 100644
index 00000000000..74ff8794347
--- /dev/null
+++ b/sysutils/torsmo/DESCR
@@ -0,0 +1,20 @@
+Torsmo is a system monitor that sits in the corner of your desktop. It's
+very simple, customizable and it renders only text on the desktop (and
+percentagebars if you want it to ;) and the only lib it uses is Xlib.
+Torsmo can show various information about your system and it's peripherals,
+including:
+
+* Kernel version
+* Uptime
+* System time
+* Network interface information
+* Memory and swap usage
+* Hostname
+* Machine, i686 for example
+* System name, Linux for example
+* Temperatures from i2c-sensors
+* Temperature from ACPI
+* Battery capacity from ACPI/APM
+* Number of processes running or sleeping
+* Local mails (unread and all)
+* Filesystem stats
diff --git a/sysutils/torsmo/Makefile b/sysutils/torsmo/Makefile
new file mode 100644
index 00000000000..fc9a0e71935
--- /dev/null
+++ b/sysutils/torsmo/Makefile
@@ -0,0 +1,33 @@
+# $NetBSD: Makefile,v 1.1.1.1 2006/03/29 21:42:55 ghen Exp $
+
+DISTNAME= torsmo-0.18
+CATEGORIES= sysutils
+MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=torsmo/}
+
+MAINTAINER= ghen@NetBSD.org
+HOMEPAGE= http://torsmo.sourceforge.net/
+COMMENT= Tyopoytaorvelo System Monitor
+
+GNU_CONFIGURE= yes
+
+EGDIR= ${PREFIX}/share/examples/torsmo
+DOCDIR= ${PREFIX}/share/doc/torsmo
+
+.include "../../mk/bsd.prefs.mk"
+
+.if (${OPSYS} == "NetBSD" || ${OPSYS} == "DragonFly" || ${OPSYS} == "FreeBSD" \
+ || ${OPSYS} == "OpenBSD" || ${OPSYS} == "Linux")
+SPECIAL_PERMS+= bin/torsmo ${ROOT_USER} kmem 2555
+.endif
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC:Q}/torsmo ${PREFIX:Q}/bin/
+ ${INSTALL_MAN} ${WRKSRC:Q}/torsmo.1 ${PREFIX:Q}/${PKGMANDIR:Q}/man1/
+ ${INSTALL_DATA_DIR} ${EGDIR:Q}
+ ${INSTALL_DATA} ${WRKSRC:Q}/torsmorc.sample ${EGDIR:Q}/
+ ${INSTALL_DATA_DIR} ${DOCDIR:Q}
+ ${INSTALL_DATA} ${WRKSRC:Q}/README ${DOCDIR:Q}/
+ ${INSTALL_DATA} ${WRKSRC:Q}/readme.html ${DOCDIR:Q}/
+
+.include "../../mk/x11.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/sysutils/torsmo/PLIST b/sysutils/torsmo/PLIST
new file mode 100644
index 00000000000..0e92286267f
--- /dev/null
+++ b/sysutils/torsmo/PLIST
@@ -0,0 +1,8 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2006/03/29 21:42:55 ghen Exp $
+bin/torsmo
+man/man1/torsmo.1
+share/doc/torsmo/README
+share/doc/torsmo/readme.html
+share/examples/torsmo/torsmorc.sample
+@dirrm share/examples/torsmo
+@dirrm share/doc/torsmo
diff --git a/sysutils/torsmo/distinfo b/sysutils/torsmo/distinfo
new file mode 100644
index 00000000000..c6e6de3777d
--- /dev/null
+++ b/sysutils/torsmo/distinfo
@@ -0,0 +1,8 @@
+$NetBSD: distinfo,v 1.1.1.1 2006/03/29 21:42:55 ghen Exp $
+
+SHA1 (torsmo-0.18.tar.gz) = 01e6737b3971daa3a7c9cb6dd1961f61bc39bdae
+RMD160 (torsmo-0.18.tar.gz) = f1d8b3c4679155596569f9116970e7ba8a01eb6e
+Size (torsmo-0.18.tar.gz) = 84020 bytes
+SHA1 (patch-aa) = b1d9e3eb7638e24c3cc595e9cd1e1c6054adf5cf
+SHA1 (patch-ab) = 3bf66bd2b7645c204099a8c7b806098d028cc8bf
+SHA1 (patch-ac) = 5b342d09ff0fcc3982aa855e2cc660823ed53e11
diff --git a/sysutils/torsmo/patches/patch-aa b/sysutils/torsmo/patches/patch-aa
new file mode 100644
index 00000000000..06a9431dc23
--- /dev/null
+++ b/sysutils/torsmo/patches/patch-aa
@@ -0,0 +1,43 @@
+$NetBSD: patch-aa,v 1.1.1.1 2006/03/29 21:42:55 ghen Exp $
+
+--- fs.c.orig 2004-08-25 18:24:24.000000000 +0200
++++ fs.c
+@@ -19,6 +19,11 @@
+ #include <sys/mount.h>
+ #endif
+
++#if defined (__NetBSD__)
++#include <sys/statvfs.h>
++#define STATVFS 1
++#endif
++
+ /* TODO: benchmark which is faster, fstatvfs() or pre-opened fd and
+ * statvfs() (fstatvfs() would handle mounts I think...) */
+
+@@ -27,16 +32,25 @@ struct fs_stat *fs_stats = fs_stats_;
+
+ void update_fs_stats() {
+ unsigned int i;
++#ifndef STATVFS
+ struct statfs s;
++#else
++ struct statvfs s;
++#endif
+ for (i=0; i<16; i++) {
+ if (fs_stats[i].fd <= 0)
+ break;
+
++#ifndef STATVFS
+ fstatfs(fs_stats[i].fd, &s);
+-
+ fs_stats[i].size = (long long) s.f_blocks * s.f_bsize;
+ /* bfree (root) or bavail (non-roots) ? */
+ fs_stats[i].avail = (long long) s.f_bavail * s.f_bsize;
++#else
++ fstatvfs(fs_stats[i].fd, &s);
++ fs_stats[i].size = (int64_t) s.f_blocks * 1024;
++ fs_stats[i].avail = (int64_t) s.f_bavail * 1024;
++#endif
+ }
+ }
+
diff --git a/sysutils/torsmo/patches/patch-ab b/sysutils/torsmo/patches/patch-ab
new file mode 100644
index 00000000000..11243ed45b4
--- /dev/null
+++ b/sysutils/torsmo/patches/patch-ab
@@ -0,0 +1,155 @@
+$NetBSD: patch-ab,v 1.1.1.1 2006/03/29 21:42:55 ghen Exp $
+
+--- netbsd.c.orig 2004-08-25 19:55:57.000000000 +0200
++++ netbsd.c
+@@ -9,6 +9,7 @@
+ #include <err.h>
+ #include <limits.h>
+ #include <paths.h>
++#include <ctype.h>
+
+ #include <kvm.h>
+ #include <nlist.h>
+@@ -221,6 +222,33 @@ void update_net_stats()
+ }
+ }
+
++static char *freq = NULL;
++char * get_freq()
++{
++ size_t val_len;
++ u_int32_t val;
++
++ if (freq == NULL) {
++ freq = malloc(10);
++ if (freq == NULL) {
++ return NULL;
++ } else {
++ freq[0] = '\0';
++ }
++ }
++
++ /* Laptops with enhanced speed step. */
++ if (sysctlbyname("machdep.est.frequency.current",
++ NULL, &val_len, NULL, 0) == 0) {
++ sysctlbyname("machdep.est.frequency.current", &val, &val_len, NULL, 0);
++ sprintf(freq, "%d", val);
++ } else {
++ /* XXX: Parse out the clockspeed from machdep.cpu_brand */
++ }
++
++ return freq;
++}
++
+ void update_total_processes()
+ {
+ /* It's easier to use kvm here than sysctl */
+@@ -302,6 +330,7 @@ void update_cpu_usage()
+ }
+
+ double get_i2c_info(int fd, int div) {
++ (void) fd; (void) div;
+ return -1;
+ }
+
+@@ -315,24 +344,96 @@ void update_load_average() {
+ }
+
+ double get_acpi_temperature(int fd) {
++ (void) fd;
+ return -1;
+ }
+
+-void get_battery_stuff(char *buf, unsigned int n, const char *bat) {
+-}
+-
+ int open_i2c_sensor(const char *dev, const char *type, int n, int *div)
+ {
++ (void) dev; (void) type; (void) n; (void) div;
+ return -1;
+ }
+
+ int open_acpi_temperature(const char *name) {
++ (void) name;
+ return -1;
+ }
+
++static char acpi_ac_str[64] = "N/A";
+ char * get_acpi_ac_adapter(void)
+ {
+- return "N/A";
++ /* get_battery_stuff() actually populates this for us. */
++ return acpi_ac_str;
++}
++
++static char last_battery_str[64];
++static double last_battery_time;
++
++void get_battery_stuff(char *buf, unsigned int n, const char *bat) {
++ FILE *f;
++ char *foo;
++ char b[4096];
++ char b_name[32];
++ int bat_num;
++ int found_acpibat = 0;
++ int found_acpiacad = 0;
++ float bat_charge = 0.0;
++
++ /* Don't update battery too often. */
++ if (current_update_time - last_battery_time < 29.5) {
++ snprintf(buf, n, "%s", last_battery_str);
++ return;
++ }
++ last_battery_time = current_update_time;
++
++ sscanf(bat, "BAT%d", &bat_num);
++ sprintf(b_name, "acpibat%d", bat_num);
++
++ /*
++ * Using the envsys API is like pulling teeth without anesthetic.
++ * so just popen envstat and parse the output instead.
++ */
++ f = popen("/usr/sbin/envstat -r", "r");
++ if (f != NULL) {
++ while(!feof(f)) {
++ fgets(b, 4096, f);
++
++ /* AC adapter state. */
++ if (strstr(b, "acpiacad0")) {
++ if (strstr(b, "disconnected")) {
++ sprintf(acpi_ac_str, "disconnected");
++ } else {
++ sprintf(acpi_ac_str, "connected");
++ }
++ found_acpiacad = 1;
++ }
++
++ if (bat && strstr(b, b_name)) {
++ if (strstr(b, "charge:")) {
++ foo = strstr(b, "%)");
++ while (*foo != ' ' && *foo != '(') {
++ foo--;
++ }
++ foo = foo + 1;
++ sscanf(foo, "%f", &bat_charge);
++ found_acpibat = 1;
++ }
++ }
++ }
++ pclose(f);
++ }
++
++ if (found_acpibat) {
++ snprintf(last_battery_str, 64, "%.2f%%", bat_charge);
++ snprintf(buf, n, "%s", last_battery_str);
++ } else {
++ /* XXX: If that failed, try to use APM. */
++ }
++
++ if (!found_acpiacad) {
++ sprintf(acpi_ac_str, "N/A");
++ }
++
+ }
+
+ char* get_acpi_fan() {
diff --git a/sysutils/torsmo/patches/patch-ac b/sysutils/torsmo/patches/patch-ac
new file mode 100644
index 00000000000..10659768142
--- /dev/null
+++ b/sysutils/torsmo/patches/patch-ac
@@ -0,0 +1,19 @@
+$NetBSD: patch-ac,v 1.1.1.1 2006/03/29 21:42:55 ghen Exp $
+
+--- torsmo.c.orig 2004-12-21 23:14:46.000000000 +0100
++++ torsmo.c
+@@ -888,12 +888,14 @@ static void generate_text() {
+ OBJ(freq) {
+ snprintf(p, n, "%s", get_freq());
+ }
++#if defined(__linux__)
+ OBJ(adt746xcpu) {
+ snprintf(p, n, "%s", get_adt746x_cpu());
+ }
+ OBJ(adt746xfan) {
+ snprintf(p, n, "%s", get_adt746x_fan());
+ }
++#endif
+ OBJ(acpifan) {
+ snprintf(p, n, "%s", get_acpi_fan());
+ }