mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-03 01:23:49 +00:00
sysutils/rsfetch: fix memory reporting and add DragonFlyBSD support
Import upstream fix [1] to fix fix memory reporting and add DragonFlyBSD support.
[1] 2bd3ef9eaf
PR: 244861
Approved by: Lewis Cook (maintainer), manu (mentor, implicit)
This commit is contained in:
parent
61838c3a6d
commit
865ff6c103
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=528635
@ -2,6 +2,7 @@
|
||||
|
||||
PORTNAME= rsfetch
|
||||
DISTVERSION= 2.0.0
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= sysutils
|
||||
|
||||
MAINTAINER= vulcan@wired.sh
|
||||
|
20
sysutils/rsfetch/files/patch-src_memory.rs
Normal file
20
sysutils/rsfetch/files/patch-src_memory.rs
Normal file
@ -0,0 +1,20 @@
|
||||
--- src/memory.rs.orig 2020-03-16 13:12:22 UTC
|
||||
+++ src/memory.rs
|
||||
@@ -74,12 +74,15 @@ impl RAMInfo {
|
||||
self.used = Some(used / 1024_f64 / 1024_f64);
|
||||
self.total = Some(total / 1024_f64 / 1024_f64);
|
||||
return Ok(());
|
||||
- } else if os == &OS::FreeBSD || os == &OS::Other {
|
||||
+ } else if os == &OS::FreeBSD || os == &OS::DragonflyBSD {
|
||||
let mut buffer = String::new();
|
||||
Command::new("sysctl").arg("-n").arg("hw.physmem")
|
||||
.output().context(RAMErr)?.stdout.iter()
|
||||
.for_each(|b| buffer.push(*b as char));
|
||||
- total = buffer.parse::<f64>().unwrap();
|
||||
+
|
||||
+ // remove non-integer chars from buffer
|
||||
+ buffer = buffer.trim().replace("\n", "");
|
||||
+ total = buffer.parse::<u64>().unwrap() as f64;
|
||||
|
||||
let pagesize: f64;
|
||||
let inactive: f64;
|
28
sysutils/rsfetch/files/patch-src_util.rs
Normal file
28
sysutils/rsfetch/files/patch-src_util.rs
Normal file
@ -0,0 +1,28 @@
|
||||
--- src/util.rs.orig 2020-03-16 13:14:06 UTC
|
||||
+++ src/util.rs
|
||||
@@ -8,6 +8,7 @@ pub enum OS {
|
||||
FreeBSD,
|
||||
OpenBSD,
|
||||
NetBSD,
|
||||
+ DragonflyBSD,
|
||||
Other
|
||||
}
|
||||
|
||||
@@ -23,11 +24,12 @@ impl OSInfo {
|
||||
.output()?.stdout.iter()
|
||||
.for_each(|b| uname.push(*b as char));
|
||||
let os = match uname.replace("\n", "").trim().as_ref() {
|
||||
- "Linux" => OS::Linux,
|
||||
- "FreeBSD" => OS::FreeBSD,
|
||||
- "NetBSD" => OS::NetBSD,
|
||||
- "OpenBSD" => OS::OpenBSD,
|
||||
- &_ => OS::Other,
|
||||
+ "Linux" => OS::Linux,
|
||||
+ "FreeBSD" => OS::FreeBSD,
|
||||
+ "NetBSD" => OS::NetBSD,
|
||||
+ "OpenBSD" => OS::OpenBSD,
|
||||
+ "DragonFly" => OS::DragonflyBSD,
|
||||
+ &_ => OS::Other,
|
||||
};
|
||||
|
||||
Ok(os)
|
Loading…
Reference in New Issue
Block a user